Ejemplo n.º 1
0
        private void DgBind()
        {
            string strCardID  = txtCardID.Text.Trim();
            string strEmpName = txtEmpName.Text.Trim();
            string strDeptID  = cmbDept.Text.Trim();
            string strPhone   = txtPhone.Text.Trim();

            if (strDeptID == "全部")
            {
                strDeptID = "";
            }
            else
            {
                strDeptID = this.GetColEn(strDeptID, "MD");
            }
            Hashtable htpara = new Hashtable();

            htpara.Add("cardid", strCardID);
            htpara.Add("empname", strEmpName);
            htpara.Add("deptid", strDeptID);
            htpara.Add("phone", strPhone);

            Exception err = null;
            DataTable dt  = new DataTable();

            dt = ca.GetEmpInfo(htpara, out err);
            if (err != null)
            {
                MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                return;
            }
            if (dt.Rows.Count >= 0)
            {
                this.DataTableConvert(dt, "vcDegree", "DE", "vcCommCode", "vcCommName");
                this.DataTableConvert(dt, "vcFlag", "ES", "vcCommCode", "vcCommName");
                this.DataTableConvert(dt, "vcOfficer", "OF", "vcCommCode", "vcCommName");
                this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName");
            }
            if (dt != null)
            {
                this.dataGrid1.SetDataBinding(dt, "");
                this.EnToCh("员工卡号,员工姓名,性别,证件号码,入职时间,学历,联系电话,地址,职务,门店,员工状态,备注,操作时间", "60,100,60,100,80,100,100,100,90,60", dt, this.dataGrid1);
            }
            else
            {
                MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }