Esempio n. 1
0
        /// <summary>
        /// 添加客户信息
        /// </summary>
        /// <param name="custo"></param>
        /// <returns></returns>
        public bool InsertCustomerInfo(Custo custo)
        {
            string NewID  = Md5LockedUtil.MD5Encrypt32(custo.CustoID);
            string NewTel = Md5LockedUtil.MD5Encrypt32(custo.CustoTel);

            custo.CustoID  = NewID;
            custo.CustoTel = NewTel;
            return(base.Insert(custo));
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (WorkerName.Text != null /*&& ucHistory.txtCompany.Text != null*/ && cboSex.Text != null)
                {
                    string NewID  = Md5LockedUtil.MD5Encrypt32(WorkerID.Text.ToString());
                    string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString());

                    #region 员工信息添加代码块
                    Worker worker = new Worker
                    {
                        WorkerId        = WorkerNo.Text.Trim(),
                        WorkerName      = WorkerName.Text.Trim(),
                        WorkerBirthday  = dtpBirthday.Value,
                        WorkerSex       = cboSex.SelectedIndex,
                        WorkerTel       = NewTel,
                        WorkerClub      = cboClub.Text,
                        WorkerAddress   = txtAddress.Text,
                        WorkerPosition  = cboWorkerPosition.Text,
                        CardId          = NewID,
                        WorkerPwd       = Pwd.Text,
                        WorkerTime      = dtpTime.Value,
                        WorkerFace      = cboWorkerFace.Text,
                        WorkerEducation = cboEducation.Text
                    };
                    int n = WorkerManager.AddWorker(worker);
                    #endregion
                    #region 履历添加代码块
                    if (ucHistory.txtCompany != null && ucHistory.txtPosition != null && ucHistory.dtpStartDate.Value != null && ucHistory.dtpEndDate.Value != null)
                    {
                        WorkerHistory workerHistory = new WorkerHistory
                        {
                            StartDate = ucHistory.dtpStartDate.Value,
                            EndDate   = ucHistory.dtpEndDate.Value,
                            Postion   = ucHistory.txtPosition.Text,
                            Company   = ucHistory.txtCompany.Text
                        };
                        int j = WorkerHistoryManager.AddHistoryByWorkerId(workerHistory, WorkerNo.Text);
                        #endregion

                        #region 判断履历和信息代码块
                        if (n > 0 && j > 0)
                        {
                            MessageBox.Show("员工信息/履历添加成功!该员工登录密码为:" + Pwd.Text + ",请提醒员工妥善保管!");
                            FrmWorkerManager.Reload();
                            #region 获取添加操作日志所需的信息
                            OperationLog o = new OperationLog();
                            o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                                << << << < HEAD : SYS.FormUI / FrmAddWorker.cs
                                << << << < HEAD : SYS.FormUI / FrmAddWorker.cs
                                o.Operationlog = AdminInfo.admingroup + AdminInfo.adminType + "于" + DateTime.Now + "进行了添加员工操作,员工编号为:" + WorkerNo.Text + "!";
                            o.OperationAccount = AdminInfo.admingroup + AdminInfo.adminType;
                            OperationManager.InsertOperationLog(o);
Esempio n. 3
0
        public static int InsertCustomerInfo(Custo custo)
        {
            string NewID  = Md5LockedUtil.MD5Encrypt32(custo.CustoID);
            string NewTel = Md5LockedUtil.MD5Encrypt32(custo.CustoTel);

            string sql = "insert USERINFO(CustoNo,CustoName,CustoSex,CustoTel,PassportType,CustoID,CustoAdress,CustoBirth,CustoType)";

            sql += " values('" + custo.CustoNo + "','" + custo.CustoName + "','" + custo.CustoSex + "','" + NewTel + "','" + custo.PassportType + "','" + NewID + "','" + custo.CustoAdress + "','" + custo.CustoBirth + "','" + custo.CustoType + "') ";

            return(DBHelper.ExecuteNonQuery(sql));
        }
        private void btnUpd_Click(object sender, EventArgs e)
        {
            bool dr = UIMessageBox.Show("是否确认修改员工信息?", "修改提醒", UIStyle.Green, UIMessageBoxButtons.OKCancel);

            if (dr == true)
            {
                string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString());
                #region 员工信息代码块
                Worker worker = new Worker
                {
                    WorkerId        = WorkerNo.Text.Trim(),
                    WorkerName      = WorkerName.Text.Trim(),
                    WorkerNation    = cbWorkerNation.SelectedValue == null ? "N-00001" : cbWorkerNation.SelectedValue.ToString(),
                    WorkerTel       = NewTel,
                    WorkerAddress   = txtAddress.Text,
                    WorkerFace      = cboWorkerFace.Text,
                    WorkerEducation = cboEducation.SelectedValue.ToString() == null ? "E-00001" : cboEducation.SelectedValue.ToString(),
                    datachg_usr     = AdminInfo.Account,
                    datachg_date    = DateTime.Now
                };
                bool i = new WorkerService().UpdateWorker(worker);
                if (i == true)
                {
                    UIMessageBox.ShowSuccess("信息修改成功!");
                    return;
                }
                else
                {
                    UIMessageBox.ShowError("服务器繁忙!");
                    return;
                }
                #endregion
            }
            else
            {
                UIMessageBox.ShowWarning("修改操作已取消!");
                return;
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (WorkerName.Text != null && cboSex.Text != null)
                {
                    string NewID  = Md5LockedUtil.MD5Encrypt32(WorkerID.Text.ToString());
                    string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString());

                    #region 员工信息添加代码块
                    Worker worker = new Worker
                    {
                        WorkerId        = WorkerNo.Text.Trim(),
                        WorkerName      = WorkerName.Text.Trim(),
                        WorkerBirthday  = dtpBirthday.Value,
                        WorkerSex       = (int)cboSex.SelectedValue,
                        WorkerNation    = cbWorkerNation.SelectedValue.ToString(),
                        WorkerTel       = NewTel,
                        WorkerClub      = cboClub.SelectedValue.ToString(),
                        WorkerAddress   = txtAddress.Text,
                        WorkerPosition  = cboWorkerPosition.SelectedValue.ToString(),
                        CardId          = NewID,
                        WorkerTime      = dtpTime.Value,
                        WorkerFace      = cboWorkerFace.Text,
                        WorkerEducation = cboEducation.SelectedValue.ToString(),
                        datains_usr     = AdminInfo.Account,
                        datains_date    = DateTime.Now
                    };
                    bool n = new WorkerService().AddWorker(worker);
                    #endregion

                    if (ucHistory.txtCompany != null && ucHistory.txtPosition != null && ucHistory.dtpStartDate.Value != null && ucHistory.dtpEndDate.Value != null)
                    {
                        #region 履历添加代码块
                        WorkerHistory workerHistory = new WorkerHistory
                        {
                            StartDate = ucHistory.dtpStartDate.Value,
                            EndDate   = ucHistory.dtpEndDate.Value,
                            Position  = ucHistory.txtPosition.Text,
                            Company   = ucHistory.txtCompany.Text,
                            WorkerId  = WorkerNo.Text.Trim()
                        };
                        bool j = new WorkerHistoryService().AddHistoryByWorkerId(workerHistory);
                        #endregion

                        #region 判断履历和信息代码块
                        if (n == true && j == true)
                        {
                            UIMessageBox.Show("员工信息/履历添加成功!该员工登录密码为:123456,请提醒员工妥善保管并首次登录系统时修改密码!");
                            FrmWorkerManager.Reload();
                            #region 获取添加操作日志所需的信息
                            OperationLog o = new OperationLog();
                            o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                            o.Operationlog     = AdminInfo.Account + AdminInfo.Name + "于" + DateTime.Now + "进行了添加员工操作,员工编号为:" + WorkerNo.Text + "!";
                            o.OperationAccount = AdminInfo.Account + AdminInfo.Name;
                            o.datains_usr      = AdminInfo.Account;
                            o.datachg_date     = DateTime.Now;
                            new OperationlogService().InsertOperationLog(o);
                            #endregion
                        }
                        else
                        {
                            UIMessageBox.Show("员工信息/履历添加失败,请检查数据格式或稍后再试!");
                        }
                        #endregion
                    }
                }
                else
                {
                    UIMessageBox.Show("信息不能为空!");
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                UIMessageBox.Show("服务器繁忙或数据格式为空!");
            }
            finally
            {
                this.Close();
            }
        }