Ejemplo n.º 1
0
        public CMSMStruct.EmployeeStruct GetEmpInfoByName(string strEmpName)
        {
            DataTable dtout = Ea.GetEmpInfoByName(strEmpName);

            CMSMStruct.EmployeeStruct es1 = new CommCenter.CMSMStruct.EmployeeStruct();
            if (dtout != null)
            {
                es1.strCardID  = dtout.Rows[0]["vcCardID"].ToString();
                es1.strEmpName = dtout.Rows[0]["vcEmpName"].ToString();
                es1.strOfficer = dtout.Rows[0]["vcCommName"].ToString();
            }
            return(es1);
        }
Ejemplo n.º 2
0
        public CMSMStruct.EmployeeStruct GetEmpInfo(string strCardid)
        {
            DataTable dtout = Ea.GetEmpInfo(strCardid);

            CMSMStruct.EmployeeStruct es1 = new CommCenter.CMSMStruct.EmployeeStruct();
            if (dtout != null)
            {
                es1.strCardID    = dtout.Rows[0]["vcCardID"].ToString();
                es1.strEmpName   = dtout.Rows[0]["vcEmpName"].ToString();
                es1.strSex       = dtout.Rows[0]["vcSex"].ToString();
                es1.strEmpNbr    = dtout.Rows[0]["vcEmpNbr"].ToString();
                es1.strInDate    = dtout.Rows[0]["dtInDate"].ToString();
                es1.strDegree    = dtout.Rows[0]["vcDegree"].ToString();
                es1.strLinkPhone = dtout.Rows[0]["vcLinkPhone"].ToString();
                es1.strAddress   = dtout.Rows[0]["vcAddress"].ToString();
                es1.strOfficer   = dtout.Rows[0]["vcOfficer"].ToString();
                es1.strDeptID    = dtout.Rows[0]["vcDeptID"].ToString();
                es1.strFlag      = dtout.Rows[0]["vcFlag"].ToString();
                es1.strComments  = dtout.Rows[0]["vcComments"].ToString();
            }
            return(es1);
        }
Ejemplo n.º 3
0
        private void btMod_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.EmployeeStruct esnew = new CommCenter.CMSMStruct.EmployeeStruct();
            esnew.strCardID = txtCardID.Text.Trim();
            CMSMStruct.EmployeeStruct esold = (CMSMStruct.EmployeeStruct)Session["esold"];
            if (esold == null)
            {
                this.SetErrorMsgPageBydir("调整员工信息出错,请退出本页面重试!");
                return;
            }
            else if (esold.strCardID != esnew.strCardID)
            {
                this.SetErrorMsgPageBydir("调整员工信息出错,请退出本页面重试!");
                return;
            }
            if (txtEmpName.Text.Trim() == "")
            {
                this.SetErrorMsgPageBydir("员工姓名不能为空!");
                return;
            }
            else
            {
                esnew.strEmpName = txtEmpName.Text.Trim();
                if (esold.strEmpName == esnew.strEmpName)
                {
                    esnew.strEmpName = txtEmpName.Text.Trim();
                }
                else
                {
                    if (esins.ChkEmpNameDup(txtEmpName.Text.Trim()))
                    {
                        esnew.strEmpName = txtEmpName.Text.Trim();
                    }
                    else
                    {
                        this.SetErrorMsgPageBydir("该员工姓名已经存在,请重新输入!");
                        return;
                    }
                }
            }

            if (txtEmpNbr.Text.Trim() != "" && txtEmpNbr.Text.Trim().Length != 15 && txtEmpNbr.Text.Trim().Length != 18)
            {
                this.SetErrorMsgPageBydir("身份证号不正确!");
                return;
            }
            else
            {
                esnew.strEmpNbr = txtEmpNbr.Text.Trim();
            }

            if (strInDate == "" || strInDate == null)
            {
                this.SetErrorMsgPageBydir("入职时间不能为空!");
                return;
            }
            else
            {
                esnew.strInDate = strInDate;
            }

            esnew.strFlag      = ddlFlag.SelectedValue;
            esnew.strOfficer   = ddlOfficer.SelectedValue;
            esnew.strDeptID    = ddlDept.SelectedValue;
            esnew.strSex       = ddlSex.SelectedValue;
            esnew.strDegree    = ddlDegree.SelectedValue;
            esnew.strLinkPhone = txtLinkPhone.Text.Trim();
            esnew.strAddress   = txtAddress.Text.Trim();
            esnew.strComments  = txtComments.Text.Trim();

            if (!esins.ModEmployee(esold, esnew))
            {
                this.SetErrorMsgPageBydir("调整员工信息失败或者没有做任何调整!");
                return;
            }
            else
            {
                this.SetSuccMsgPageBydir("调整员工信息成功!", "EmpLoy/wfmEmpInfo.aspx");
                return;
            }
        }
Ejemplo n.º 4
0
        private DataSet CheckEmpSch(DataSet ds)
        {
            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            emb = new EmpBusi(strcons);
            DataTable dtEmp       = emb.GetEmployInfo();
            Hashtable htEmpCardID = new Hashtable();

            foreach (DataRow dr in dtEmp.Rows)
            {
                CMSMStruct.EmployeeStruct emp1 = new CommCenter.CMSMStruct.EmployeeStruct();
                emp1.strCardID  = dr["vcCardID"].ToString();
                emp1.strEmpName = dr["vcEmpName"].ToString();
                emp1.strOfficer = dr["vcOfficer"].ToString();
                emp1.strDeptID  = dr["vcDeptName"].ToString();
                htEmpCardID.Add(emp1.strCardID, emp1);
            }

            DataTable dtDeptManager = emb.GetDeptManagerList();
            Hashtable htManager     = new Hashtable();
            string    strManaDeptID = "";
            string    strManager    = "";

            if (dtDeptManager != null && dtDeptManager.Rows.Count > 0)
            {
                strManaDeptID = dtDeptManager.Rows[0]["vcDeptID"].ToString();
            }
            for (int i = 0; i < dtDeptManager.Rows.Count; i++)
            {
                if (strManaDeptID == dtDeptManager.Rows[i]["vcDeptID"].ToString())
                {
                    strManager += dtDeptManager.Rows[i]["vcEmpName"].ToString() + ",";
                }
                else
                {
                    if (strManager != "")
                    {
                        strManager = strManager.Substring(0, strManager.Length - 1);
                    }
                    htManager.Add(strManaDeptID, strManager);
                    strManaDeptID = dtDeptManager.Rows[i]["vcDeptID"].ToString();
                    strManager    = dtDeptManager.Rows[i]["vcEmpName"].ToString() + ",";
                }
                if (i == dtDeptManager.Rows.Count - 1)
                {
                    if (strManager != "")
                    {
                        strManager = strManager.Substring(0, strManager.Length - 1);
                    }
                    htManager.Add(strManaDeptID, strManager);
                }
            }

            int       iError = 0;
            DataTable dt     = ds.Tables[0];

            dt.Columns.Add("校验错误");
            dt.Columns.Add("vcSchID");
            dt.Columns.Add("vcDeptName");
            dt.Columns.Add("vcManager");
            dt.Columns.Add("vcCardID");
            dt.Columns.Add("vcEmpName");
            dt.Columns.Add("vcEmpOF");
            dt.Columns.Add("vcClass");
            dt.Columns.Add("dtCheckIn");
            dt.Columns.Add("dtCheckOut");
            foreach (DataRow dr in dt.Rows)
            {
                string strSchID = dr["排班日期"].ToString().Trim();
                if (strSchID.Length != 8)
                {
                    dr["校验错误"] += strSchID + ":排班日期应为8位日期;";
                    iError     += 1;
                }
                else
                {
                    DateTime dtsch = new DateTime(int.Parse(strSchID.Substring(0, 4)), int.Parse(strSchID.Substring(4, 2)), int.Parse(strSchID.Substring(6, 2)));
                    if (dtsch.CompareTo(DateTime.Today) < 0)
                    {
                        dr["校验错误"] += strSchID + ":不能排今天以前的班;";
                        iError     += 1;
                    }
                    else
                    {
                        dr["vcSchID"] = strSchID;
                    }
                }

                string    strDeptName  = dr["门店"].ToString().Trim();
                string    strDeptOldID = "";
                bool      isdeptexist  = false;
                DataTable dtDept       = (DataTable)Application["AllMD"];
                foreach (DataRow dr1 in dtDept.Rows)
                {
                    if (dr1["vcCommName"].ToString() == strDeptName)
                    {
                        isdeptexist  = true;
                        strDeptOldID = dr1["vcCommCode"].ToString();
                        break;
                    }
                }
                if (!isdeptexist)
                {
                    dr["校验错误"] += strDeptName + ":门店不存在;";
                    iError     += 1;
                }
                else
                {
                    dr["vcDeptName"] = strDeptName;
                }

                if (dr["vcDeptName"].ToString() != "" && strDeptOldID != "")
                {
                    if (htManager.ContainsKey(strDeptOldID))
                    {
                        dr["vcManager"] = htManager[strDeptOldID].ToString();
                    }
                }

                string strCardID  = dr["员工卡号"].ToString();
                string strEmpName = dr["员工姓名"].ToString();
                string strOfficer = dr["职务"].ToString();
                if (!htEmpCardID.ContainsKey(strCardID))
                {
                    dr["校验错误"] += strCardID + ":卡号不正确,员工不存在;";
                    iError     += 1;
                }
                else
                {
                    dr["vcCardID"] = strCardID;
                    CMSMStruct.EmployeeStruct emptmp2 = (CMSMStruct.EmployeeStruct)htEmpCardID[strCardID];
                    if (emptmp2.strEmpName != strEmpName)
                    {
                        dr["校验错误"] += strEmpName + ":员工姓名不正确;";
                        iError     += 1;
                    }
                    else
                    {
                        dr["vcEmpName"] = strEmpName;
                    }
                    if (emptmp2.strOfficer != strOfficer)
                    {
                        dr["校验错误"] += strOfficer + ":职务不正确;";
                        iError     += 1;
                    }
                    else
                    {
                        dr["vcEmpOF"] = strOfficer;
                    }
                    if (emptmp2.strDeptID != strDeptName)
                    {
                        dr["校验错误"] += strDeptName + ":员工所属部门不正确;";
                        iError     += 1;
                    }
                }

                string strClass = dr["班次"].ToString();
                if (emb.IsEmpSchExist(strSchID, strDeptName, strCardID, strClass))
                {
                    dr["校验错误"] += "系统中已有该员工的本条排班信息;";
                    iError     += 1;
                }
                else
                {
                    dr["vcClass"] = strClass;
                }

                string InHour      = dr["上班-小时"].ToString().Trim();
                string InMin       = dr["上班-分钟"].ToString().Trim();
                string OutHour     = dr["下班-小时"].ToString().Trim();
                string OutMin      = dr["下班-分钟"].ToString().Trim();
                string nextoutflag = dr["次日下班"].ToString().Trim();
                if (!(this.JudgeIsNum(InHour) && this.JudgeIsNum(InMin) && this.JudgeIsNum(OutHour) && this.JudgeIsNum(OutMin)))
                {
                    dr["校验错误"] += "上下班的小时数或分钟数中有非数字字符;";
                    iError     += 1;
                }
                else
                {
                    if (!(this.JudgeIs24Hour(InHour) && this.JudgeIs60Minute(InMin) && this.JudgeIs24Hour(OutHour) && this.JudgeIs60Minute(OutMin)))
                    {
                        dr["校验错误"] += "上下班的小时数或分钟数有误;";
                        iError     += 1;
                    }
                    else
                    {
                        if (dr["vcSchID"].ToString() != "")
                        {
                            DateTime dtIn  = new DateTime(int.Parse(dr["vcSchID"].ToString().Substring(0, 4)), int.Parse(dr["vcSchID"].ToString().Substring(4, 2)), int.Parse(dr["vcSchID"].ToString().Substring(6, 2)), int.Parse(InHour), int.Parse(InMin), 0);
                            DateTime dtOut = DateTime.Now;
                            if (nextoutflag == "是")
                            {
                                dtOut = new DateTime(dtIn.AddDays(1).Year, dtIn.AddDays(1).Month, dtIn.AddDays(1).Day, int.Parse(OutHour), int.Parse(OutMin), 0);
                            }
                            else
                            {
                                dtOut = new DateTime(int.Parse(dr["vcSchID"].ToString().Substring(0, 4)), int.Parse(dr["vcSchID"].ToString().Substring(4, 2)), int.Parse(dr["vcSchID"].ToString().Substring(6, 2)), int.Parse(OutHour), int.Parse(OutMin), 0);
                            }
                            if (dtIn.CompareTo(dtOut) > 0)
                            {
                                dr["校验错误"] += "上班时间不能大于下班时间;";
                                iError     += 1;
                            }
                            TimeSpan tsIn     = new TimeSpan(dtIn.Ticks);
                            TimeSpan tsOut    = new TimeSpan(dtOut.Ticks);
                            TimeSpan ts       = tsIn.Subtract(tsOut).Duration();
                            double   diffdate = Math.Round(double.Parse(ts.Hours.ToString()) + double.Parse(ts.Minutes.ToString()) / 60, 2);
                            if (diffdate < 8.5)
                            {
                                dr["校验错误"] += "每班次的上班时间应大于8小时30分钟;";
                                iError     += 1;
                            }

                            dr["dtCheckIn"]  = dtIn;
                            dr["dtCheckOut"] = dtOut;
                        }
                    }
                }
            }
            this.txtError.Text = iError.ToString();
            return(ds);
        }