用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - 其他代码库

extjs,request

2015-11-04 作者: ddlucky举报

[其他]代码库

    Ext.Ajax.request({
        waitMsg: '正在查询主表数据...',
        url: '/Import/approval/GetData',
        params: {
            handle: opstatus,
            condition: condition
        },
        callback: function (options, success, response) {
            if (success) {
                var result = Ext.JSON.decode(response.responseText);
                if (!result.Success) {
                    Ext.Msg.show({
                        title: '提示',
                        msg: result.Message,
                        icon: Ext.MessageBox.ERROR,
                        buttons: Ext.Msg.OK
                    });
                    return;
                }

                var data = result.data;
                this.formEdit.getForm().reset();

                // if (data.ex_ == "") { data.OilLrDate = currdate.format('yyyy-MM-dd') };

                this.formEdit.getForm().setValues(data);

                var sql = 'app_id=' + data.id;
                if (this.opStatus != 'add') {
                    this.storeUsing.load({
                        params: { start: 0, limit: 500, sort: '', condition: sql },
                        //params: { condition: sql },
                        waitMsg: "正在查询数据...",
                        scope: this
                    });
                }

            } else {
                Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
            }
        },
        scope: this
    });

===============================================
        public ContentResult GetData(string handle, string condition)
        {
            approvalmb head = null;

            if (handle == "edit")
            {
                var list = approvalDAL.GetDataList(condition);
                if (list.Count > 0)
                    head = list[0];
            }

            if (head == null)
            {
                head = new approvalmb();
            }

            var json = JsonConvert.Serialize(
               new { Success = true, Message = "查询成功", data = head });
            return new ContentResult() { Content = json };
        }

        public ContentResult GetDataList(int start, int limit, string sort, string condition)
        {
            var dataList = approvalDAL.GetDataList(condition);

            var list = dataList.Skip(start).Take(limit);

            var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
            return new ContentResult() { Content = json };
        }

        //
        // GET:/Import/approval/GetData/

        static public List<approvalmb> GetDataList(string strCondition)
        {
            var strSql = new StringBuilder();

            strSql.Append(" SELECT a.*,cp.name companyname, ");
            strSql.Append(" c.country,u.used,u.selected,  u.remain,u.canbeused, ");
            strSql.Append(" ci.code,ci.name,ciq.ciqcode,ciq.ciqname, ");
            strSql.Append(" (select EnumValueName from tSysEnumValue ");
            strSql.Append(" where LangId=0 and EnumTypeID=10 and EnumValueID=a.SLJG) as portRef, ");
            strSql.Append(" (select EnumValueName from tSysEnumValue ");
            strSql.Append(" where LangId=0 and EnumTypeID=0 and EnumValueID=a.isdeleted) as isdeletedRef ");
            strSql.Append(" FROM [Import_approval] a "); 
            strSql.Append(" left join import_cargoinfo ci on ci.id=a.cargoinfo_id "); 
            strSql.Append(" left join code_country c on a.[Countryid]=c.[Countryid] "); 
            strSql.Append(" left join vMsAppUsed U on U.[app_id]=a.[id] "); 
            strSql.Append(" left join import_cargociq ciq on ciq.id=a.cargociq_id ");
            strSql.Append(" left join company cp on cp.gid=a.company ");
            if (!string.IsNullOrEmpty(strCondition))
            {
                strSql.Append(" where " + strCondition);
            }

            return SetData(strSql);
        }

        private static List<approvalmb> SetData(StringBuilder strSql)
        {
            var headList = new List<approvalmb>();
            Database db = DatabaseFactory.CreateDatabase();
            using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                while (reader.Read())
                {
                    approvalmb data = new approvalmb();
                    #region Set DB data to Object
                    data.id = Convert.ToString(reader["id"]);
                    data.gid = Convert.ToString(reader["gid"]);
                    data.APPNO = Convert.ToString(reader["APPNO"]);
                    data.SQDH = Convert.ToString(reader["SQDH"]);
                    data.SLJG = Convert.ToString(reader["SLJG"]);
                    data.portRef = Convert.ToString(reader["portRef"]);
                    data.Countryid = Convert.ToString(reader["Countryid"]);
                    data.Country = Convert.ToString(reader["Country"]);
                    data.Weight = Convert.ToString(reader["Weight"]);
                    data.used = Convert.ToString(reader["used"]);
                    data.selected = Convert.ToString(reader["selected"]);
                    data.remain = Convert.ToString(reader["remain"]);
                    data.canbeused = Convert.ToString(reader["canbeused"]);
                    data.ValidDate = Convert.ToString(reader["ValidDate"]);
                    data.cargoinfo_id = Convert.ToString(reader["cargoinfo_id"]);
                    data.cargociq_id = Convert.ToString(reader["cargociq_id"]);
                    data.AppName = Convert.ToString(reader["AppName"]);
                    data.code = Convert.ToString(reader["code"]);
                    data.name = Convert.ToString(reader["name"]);
                    data.ciqcode = Convert.ToString(reader["ciqcode"]);
                    data.ciqname = Convert.ToString(reader["ciqname"]);
                    data.isdeletedRef = Convert.ToString(reader["isdeletedRef"]);
                    data.isdeleted = Convert.ToString(reader["isdeleted"]);
                    data.company = Convert.ToString(reader["company"]);
                    data.companyname = Convert.ToString(reader["companyname"]);
                    data.depot = Convert.ToString(reader["depot"]);
                    data.usedweight = Convert.ToString(reader["usedweight"]);
                    data.JustWriteoffs = Convert.ToString(reader["JustWriteoffs"]);
                    data.REMARK = Convert.ToString(reader["REMARK"]);
                    #endregion
                    headList.Add(data);
                }
                reader.Close();
            }
            return headList;
        }


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...