コード例 #1
0
        private void DBbind()
        {
            Session.Remove("oldOutCount");
            Session.Remove("OutForMod");
            strBeginDate = Request.Form["txtBegin"].ToString();
            strEndDate   = Request.Form["txtEnd"].ToString();
            if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null)
            {
                this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!");
                return;
            }

            Session.Remove("QUERY");

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            msb1 = new MaterialSBusi(strcons);
            string    strMaterialCode = txtMaterialCode.Text.Trim();
            string    strMaterialName = txtMaterialName.Text.Trim();
            string    strMaterialType = ddlMaterialType.SelectedValue;
            string    strOutSerial    = txtOutSerial.Text.Trim();
            Hashtable htpara          = new Hashtable();

            htpara.Add("strMaterialCode", strMaterialCode);
            htpara.Add("strMaterialName", strMaterialName);
            htpara.Add("strMaterialType", strMaterialType);
            htpara.Add("strOutSerial", strOutSerial);
            htpara.Add("strBeginDate", strBeginDate);
            htpara.Add("strEndDate", strEndDate);
            htpara.Add("strBatchNo", this.txtBatchNo.Text.Trim());
            htpara.Add("strDeptID", this.ddlDept.SelectedValue);

            try
            {
                DataTable dtout = msb1.GetMaterialOutForMod(htpara);
                if (dtout == null)
                {
                    this.SetErrorMsgPageBydir("查询出错,请重试!");
                    return;
                }
                else
                {
                    dtout.TableName                    = "原材料出库查询";
                    Session["OutForMod"]               = dtout;
                    this.DataGrid1.EditItemIndex       = -1;
                    this.DataGrid1.Columns[16].Visible = true;
                    CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
                    if (ls1.strDeptID == "CEN00" || ls1.strNewDeptID == "")
                    {
                        this.DataGrid1.Columns[15].Visible = false;
                        this.DataGrid1.Columns[16].Visible = false;
                    }
                    this.DataGrid1.DataSource = dtout;
                    this.DataGrid1.DataBind();
                }
                this.DataGrid1.DataSource = dtout;
                this.DataGrid1.DataBind();
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }