Ejemplo n.º 1
0
        public EditEmployee(int employeeId, SignSocketClient sc)
            : this()
        {
            this.m_id = employeeId;
            this.m_employee = null;
            this._sc = sc;

            this.m_isRepicture = false;
        }
Ejemplo n.º 2
0
 public EditEmployee(Employee employee, SignSocketClient sc)
 :this()
 {
     this.m_employee = employee;
     this.m_id = -1;
     this._sc = sc;
     
     this.m_isRepicture = false;         //  初始化不修改签字图片
 }
Ejemplo n.º 3
0
        public EditEmployee(int employeeId, SignSocketClient sc, ModifyEmployeeType type)
            : this()
        {
            this.m_id = employeeId;
            this.m_employee = null;
            this._sc = sc;

            this.m_isRepicture = false;
            this.m_type = type;         //  用户修改自己的信息和管理员修改时看到的不一样
        }
Ejemplo n.º 4
0
 public HDJContract(HDJContract contract)
 {
     this.m_name = contract.m_name;
     this.m_submitDate = contract.m_submitDate;
     this.m_id = contract.m_id;
     this.m_columnDatas = contract.m_columnDatas;
     this.m_submitEmployee = contract.m_submitEmployee;
     this.m_conTemp = contract.m_conTemp;
     //            this.m_currLevel = contract.m_currLevel;
     //            this.m_maxLevel = contract.m_maxLevel;
     this.m_signResults = contract.m_signResults;
     this.m_signRemarks = contract.m_signRemarks;
 }
Ejemplo n.º 5
0
        private async void button1_Click(object sender, EventArgs e)                //添加人员
        {
            //  首先进行容错
            if (this.Position.Text.Trim() == ""
            || this.UserName.Text.Trim() == ""
            || this.UserPassword.Text.Trim() == "")
            {
                MessageBox.Show("请将信息填写完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (this.CanSign.Checked
            && this.pictureBox1.ImageLocation == null)
            {
                MessageBox.Show("签字人需要提交签字图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (UserHelper.EmpList.Where(o => o.User.Username == this.UserName.Text.Trim()).ToList().Count > 0)
            {
                MessageBox.Show("员工信息已经存在,无法再次插入\n请检查用户名是否与他人重复!!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Employee emp = new Employee();
            emp.Name = this.eName.Text.Trim();

            Department d = new Department();
            d.Id = Convert.ToInt32(this.SelectedDepartment.SelectedValue);
            d.Name = this.SelectedDepartment.SelectedItem.ToString();
            emp.Department = d;

            emp.Position = this.Position.Text.Trim();
            User u = new User();
            u.Username = this.UserName.Text.Trim();
            u.Password = this.UserPassword.Text.Trim();
            emp.User = u;

            if (this.CanSubmit.Checked)
            {
                emp.CanSubmit = 1;
            }
            else
            {
                emp.CanSubmit = 0;
            }

            if (this.CanSign.Checked)
            {
                emp.CanSign = 1;
            }
            else
            {
                emp.CanSign = 0;
            }

            if (this.CanAdmin.Checked)
            {
                emp.IsAdmin = 1;
            }
            else
            {
                emp.IsAdmin = 0;
            }

            if (this.CanStatistic.Checked)
            {
                emp.CanStatistic = 1;
            }
            else
            {
                emp.CanStatistic = 0;
            }

            int id = _sc.InsertEmployee(emp);
            if (id == -2)
            {
                MessageBox.Show("员工信息已经存在,无法再次插入\n请检查用户名是否与他人重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (id == -1)
            {
                MessageBox.Show("添加人员失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (id == 0)
            {
                MessageBox.Show("服务器连接中断!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show("添加人员成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (this.CanSign.Checked && this.pictureBox1.ImageLocation != null)
                {
                    await _sc.UploadPicture(id, this.pictureBox1.ImageLocation);
                }
            }
            BindEmployee(0);
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.CheckIntegrity() == false)
            {
                return;
            }

            Templete temp = new Templete();
            SignatureTemplate signtemp1 = new SignatureTemplate();
            SignatureTemplate signtemp2 = new SignatureTemplate();
            SignatureTemplate signtemp3 = new SignatureTemplate();
            SignatureTemplate signtemp4 = new SignatureTemplate();
            SignatureTemplate signtemp5 = new SignatureTemplate();
            SignatureTemplate signtemp6 = new SignatureTemplate();
            SignatureTemplate signtemp7 = new SignatureTemplate();
            SignatureTemplate signtemp8 = new SignatureTemplate();
            List<string> list = new List<string>();
            List<SignatureTemplate> tlist = new List<SignatureTemplate>();

            // 会签单的名称
            temp.Name = this.ConTempName.Text.ToString();

            // 添加前5行的会签单基本信息
            list.Add(this.Column1.Text.ToString());
            list.Add(this.Column2.Text.ToString());
            list.Add(this.Column3.Text.ToString());
            list.Add(this.Column4.Text.ToString());
            list.Add(this.Column5.Text.ToString());
            temp.ColumnNames = list;

            ///  添加后8行的签字人的信息基本信息
            signtemp1.SignInfo = this.Sign1.Text.ToString();
            Employee emp1 = new Employee();
            emp1.Name = this.SignPer1.SelectedText;
            emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString());
            Department dep1 = new Department();
            dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString());
            dep1.Name = this.SignDep1.SelectedText;
            emp1.Department = dep1;
            signtemp1.SignEmployee = emp1;
            signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString());
            signtemp1.CanView = this.View1.SelectedIndex;
            signtemp1.CanDownload = this.Download1.SelectedIndex;
            tlist.Add(signtemp1);

            signtemp2.SignInfo = this.Sign2.Text.ToString();
            Employee emp2 = new Employee();
            emp2.Name = this.SignPer2.SelectedText;
            emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString());
            Department dep2 = new Department();
            dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString());
            dep2.Name = this.SignDep2.SelectedText;
            emp2.Department = dep2;
            signtemp2.SignEmployee = emp2;
            signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString());
            signtemp2.CanView = this.View2.SelectedIndex;
            signtemp2.CanDownload = this.Download2.SelectedIndex;
            tlist.Add(signtemp2);

            signtemp3.SignInfo = this.Sign3.Text.ToString();
            Employee emp3 = new Employee();
            emp3.Name = this.SignPer3.SelectedText;
            emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString());
            Department dep3 = new Department();
            dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString());
            dep3.Name = this.SignDep3.SelectedText;
            emp3.Department = dep3;
            signtemp3.SignEmployee = emp3;
            signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString());
            signtemp3.CanView = this.View3.SelectedIndex;
            signtemp3.CanDownload = this.Download3.SelectedIndex;
            tlist.Add(signtemp3);

            signtemp4.SignInfo = this.Sign4.Text.ToString();
            Employee emp4 = new Employee();
            emp4.Name = this.SignPer4.SelectedText;
            emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString());
            Department dep4 = new Department();
            dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString());
            dep4.Name = this.SignDep4.SelectedText;
            emp4.Department = dep4;
            signtemp4.SignEmployee = emp4;
            signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString());
            signtemp4.CanView = this.View4.SelectedIndex;
            signtemp4.CanDownload = this.Download4.SelectedIndex;
            tlist.Add(signtemp4);

            signtemp5.SignInfo = this.Sign5.Text.ToString();
            Employee emp5 = new Employee();
            emp5.Name = this.SignPer5.SelectedText;
            emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString());
            Department dep5 = new Department();
            dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString());
            dep5.Name = this.SignDep5.SelectedText;
            emp5.Department = dep5;
            signtemp5.SignEmployee = emp5;
            signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString());
            signtemp5.CanView = this.View5.SelectedIndex;
            signtemp5.CanDownload = this.Download5.SelectedIndex;
            tlist.Add(signtemp5);

            signtemp6.SignInfo = this.Sign6.Text.ToString();
            Employee emp6 = new Employee();
            emp6.Name = this.SignPer6.SelectedText;
            emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString());
            Department dep6 = new Department();
            dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString());
            dep6.Name = this.SignDep6.SelectedText;
            emp6.Department = dep6;
            signtemp6.SignEmployee = emp6;
            signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString());
            signtemp6.CanView = this.View6.SelectedIndex;
            signtemp6.CanDownload = this.Download6.SelectedIndex;
            tlist.Add(signtemp6);

            signtemp7.SignInfo = this.Sign7.Text.ToString();
            Employee emp7 = new Employee();
            emp7.Name = this.SignPer7.SelectedText;
            emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString());
            Department dep7 = new Department();
            dep7.Id = Convert.ToInt32(this.SignDep7.SelectedValue.ToString());
            dep7.Name = this.SignDep7.SelectedText;
            emp7.Department = dep7;
            signtemp7.SignEmployee = emp7;
            signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString());
            signtemp7.CanView = this.View7.SelectedIndex;
            signtemp7.CanDownload = this.Download7.SelectedIndex;
            tlist.Add(signtemp7);

            signtemp8.SignInfo = this.Sign8.Text.ToString();
            Employee emp8 = new Employee();
            emp8.Name = this.SignPer8.SelectedText;
            emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString());
            Department dep8 = new Department();
            dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString());
            dep8.Name = this.SignDep8.SelectedText;
            emp8.Department = dep8;
            signtemp8.SignEmployee = emp8;
            signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString());
            signtemp8.CanView = this.View8.SelectedIndex;
            signtemp8.CanDownload = this.Download8.SelectedIndex;
            tlist.Add(signtemp8);

            temp.SignDatas = tlist;

            string result =  _sc.AddConTemplete(temp);

            if (result == Response.INSERT_CONTRACT_TEMPLATE_SUCCESS.ToString())
            {
                MessageBox.Show("添加模板" + this.ConTempName.Text + "成功!");
            }
            else
            {
                MessageBox.Show("添加模板失败!");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 添加人员
        /// </summary>
        /// <param name="emp"></param>
        /// <returns></returns>
        public int InsertEmployee(Employee emp)
        {
            //return Task.Factory.StartNew(() =>
            {
                try
                {
                    SocketMessage sm = new SocketMessage(Request.INSERT_EMPLOYEE_REQUEST, emp);
                    ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package));

                    recLength = ClientSocket.Receive(recivebuffer);
                    string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength);
                    string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR);
                    
                    if (Msg[0] == Response.INSERT_EMPLOYEE_SUCCESS.ToString())
                    {
                        Logging.AddLog("添加人员成功!");
                        return Convert.ToInt32(Msg[2]);
                    }
                    else if (Msg[0] == Response.INSERT_EMPLOYEE_EXIST.ToString())
                    {
                        Logging.AddLog("员工已经存在,无法继续插入");
                        return -2;
                    }
                    else
                    {
                        Logging.AddLog("添加人员失败!");
                        return -1;
                    }
                }
                catch
                {
                    Logging.AddLog("添加人员失败(服务器连接中断)!");
                    return 0;
                }
            //});
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 登陆验证
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        public Task<Employee> Login(string UserName, string PassWord)
        {
            return Task.Factory.StartNew(() =>
            {
                    User user = new User { Username = UserName, Password = PassWord };
                    SocketMessage sm = new SocketMessage(Request.LOGIN_REQUEST, user);
                    try
                    {
                        //  scoket发送请求信息
                        ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package));

                        //socket接收信息
                        recLength = ClientSocket.Receive(recivebuffer);
                        string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength);
                        string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR);
                        
                        if (Msg[0] == Response.LOGIN_SUCCESS.ToString().Trim())
                        {
                            //将接收的信息(json格式)转化为类
                            Employee emp = new Employee();
                            emp = JsonConvert.DeserializeObject<Employee>(Msg[2]);

                            return emp;
                        }
                        else
                        {
                            Logging.AddLog("登录失败!");
                            return null;
                        }
                    }
                    catch
                    {
                        if (ClientSocket.Connected)
                        {
                            return null;
                        }
                        else
                        {
                            Logging.AddLog("连接服务器失败!");
                            return null;
                        }
                    }
                });
        }
Ejemplo n.º 9
0
         public String ModifyEmployee(Employee employee)
         {
             //return Task.Factory.StartNew(() =>
             {
                 try
                 {
                     SocketMessage sm = new SocketMessage(Request.MODIFY_EMPLOYEE_REQUEST, employee);
                     ClientSocket.Send(Encoding.UTF8.GetBytes(sm.Package));

                     recLength = ClientSocket.Receive(recivebuffer);
                     string recMsg = Encoding.UTF8.GetString(recivebuffer, 0, recLength);

                     string[] Msg = recMsg.Split(SocketMessage.DEFAULT_SEPARATOR);

                     if (Msg[0] == Response.MODIFY_EMPLOYEE_SUCCESS.ToString())
                     {
                         Logging.AddLog("重置密码成功");
                     }
                     else
                     {
                         Logging.AddLog("重置用户密码失败!");
                     }
                     return Msg[0];
                 }
                 catch
                 {
                     Logging.AddLog("重置用户密码失败(服务器连接中断)!");
                     return "服务器连接中断";
                 }
             //});
             }
         }
Ejemplo n.º 10
0
        private async void Submit_Click(object sender, EventArgs e)                       //登陆验证
        {
            string username = this.UserName.Text.Trim();
            string password = this.PassWord.Text.Trim();

            if (username == "")
            {
                errormessage.IsBalloon = true;
                errormessage.SetToolTip(this.UserName, "请填写用户名后再登录");
                errormessage.Show("请填写用户名后再登录", this.UserName, 1, this.UserName.Height / 2, 2000);
                errormessage.UseFading = false;
                UserName.Focus();
                return;
            }
            else if (password == "")
            {
                errormessage.IsBalloon = true;
                errormessage.SetToolTip(this.PassWord, "请填写密码后再登录");
                errormessage.Show("请填写密码后再登录", this.PassWord, 1, this.PassWord.Height / 2, 2000);
                errormessage.UseFading = false;
                PassWord.Focus();
                return;
            }
            else
            {
                User user = new User();
                //BUser bUser = new BUser();
                FileStream fs = new FileStream("data.bin", FileMode.Create);
                BinaryFormatter bf = new BinaryFormatter();
                user.Username = username;
                if (this.RemeberPassword.Checked)       //  如果单击了记住密码的功能
                {   //  在文件中保存密码
                    user.Password = password;
                }
                else
                {   //  不在文件中保存密码
                    user.Password = "";
                }
                
                //  选在集合中是否存在用户名 
                if (users.ContainsKey(user.Username))
                {
                    users.Remove(user.Username);
                }
                users.Add(user.Username, user);
                //要先将User类先设为可以序列化(即在类的前面加[Serializable])
                bf.Serialize(fs, users);
                //user.Password = this.PassWord.Text;
                fs.Close();
            
                try
                {
                    _sc = new SignSocketClient();
                    cmd.ShowOpaqueLayer(AllForm, 125, true, true, "正在登录");
                    Employee emp = new Employee();

                    emp = await _sc.Login(username, password);

                    if (emp != null)
                    {
                        UserHelper.UserInfo = emp;
                        this.DialogResult = DialogResult.OK;
                        cmd.HideOpaqueLayer();
                        this.Close();
                        
                        Logging.AddLog("用户:" + emp.Name + "登陆成功!");
                    }
                    else
                    {
                        cmd.HideOpaqueLayer();
                        PassWord.Text = "";
                        errormessage.IsBalloon = true;
                        errormessage.SetToolTip(this.PassWord, "用户名与密码不匹配");
                        errormessage.Show("用户名与密码不匹配", this.PassWord, 1, this.PassWord.Height / 2, 2000);
                        errormessage.UseFading = false;
                        PassWord.Focus();
                        return;
                    }
                }
                catch
                {
                    MessageBox.Show("无法连接服务器", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.CheckIntegrity() == false)
            {
                return;
            }

            Templete temp = new Templete();
            SignatureTemplate signtemp1 = new SignatureTemplate();
            SignatureTemplate signtemp2 = new SignatureTemplate();
            SignatureTemplate signtemp3 = new SignatureTemplate();
            SignatureTemplate signtemp4 = new SignatureTemplate();
            SignatureTemplate signtemp5 = new SignatureTemplate();
            SignatureTemplate signtemp6 = new SignatureTemplate();
            SignatureTemplate signtemp7 = new SignatureTemplate();
            SignatureTemplate signtemp8 = new SignatureTemplate();
            List<string> list = new List<string>();
            List<SignatureTemplate> tlist = new List<SignatureTemplate>();

            temp.Name = this.ConTempName.Text.ToString();
            list.Add(this.Column1.Text.ToString());
            list.Add(this.Column2.Text.ToString());
            list.Add(this.Column3.Text.ToString());
            list.Add(this.Column4.Text.ToString());
            list.Add(this.Column5.Text.ToString());
            temp.ColumnNames = list;

            signtemp1.SignInfo = this.Sign1.Text.ToString();
            Employee emp1 = new Employee();
            emp1.Name = this.SignPer1.SelectedText;
            emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString());
            Department dep1 = new Department();
            dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString());
            dep1.Name = this.SignDep1.SelectedText;
            emp1.Department = dep1;
            signtemp1.SignEmployee = emp1;
            signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString());
            signtemp1.CanView = this.View1.SelectedIndex;
            signtemp1.CanDownload = this.Download1.SelectedIndex;
            tlist.Add(signtemp1);

            signtemp2.SignInfo = this.Sign2.Text.ToString();
            Employee emp2 = new Employee();
            emp2.Name = this.SignPer2.SelectedText;
            emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString());
            Department dep2 = new Department();
            dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString());
            dep2.Name = this.SignDep2.SelectedText;
            emp2.Department = dep2;
            signtemp2.SignEmployee = emp2;
            signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString());
            signtemp2.CanView = this.View2.SelectedIndex;
            signtemp2.CanDownload = this.Download2.SelectedIndex;
            tlist.Add(signtemp2);

            signtemp3.SignInfo = this.Sign3.Text.ToString();
            Employee emp3 = new Employee();
            emp3.Name = this.SignPer3.SelectedText;
            emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString());
            Department dep3 = new Department();
            dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString());
            dep3.Name = this.SignDep3.SelectedText;
            emp3.Department = dep3;
            signtemp3.SignEmployee = emp3;
            signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString());
            signtemp3.CanView = this.View3.SelectedIndex;
            signtemp3.CanDownload = this.Download3.SelectedIndex;
            tlist.Add(signtemp3);

            signtemp4.SignInfo = this.Sign4.Text.ToString();
            Employee emp4 = new Employee();
            emp4.Name = this.SignPer4.SelectedText;
            emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString());
            Department dep4 = new Department();
            dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString());
            dep4.Name = this.SignDep4.SelectedText;
            emp4.Department = dep4;
            signtemp4.SignEmployee = emp4;
            signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString());
            signtemp4.CanView = this.View4.SelectedIndex;
            signtemp4.CanDownload = this.Download4.SelectedIndex;
            tlist.Add(signtemp4);

            signtemp5.SignInfo = this.Sign5.Text.ToString();
            Employee emp5 = new Employee();
            emp5.Name = this.SignPer5.SelectedText;
            emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString());
            Department dep5 = new Department();
            dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString());
            dep5.Name = this.SignDep5.SelectedText;
            emp5.Department = dep5;
            signtemp5.SignEmployee = emp5;
            signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString());
            signtemp5.CanView = this.View5.SelectedIndex;
            signtemp5.CanDownload = this.Download5.SelectedIndex;
            tlist.Add(signtemp5);

            signtemp6.SignInfo = this.Sign6.Text.ToString();
            Employee emp6 = new Employee();
            emp6.Name = this.SignPer6.SelectedText;
            emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString());
            Department dep6 = new Department();
            dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString());
            dep6.Name = this.SignDep6.SelectedText;
            emp6.Department = dep6;
            signtemp6.SignEmployee = emp6;
            signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString());
            signtemp6.CanView = this.View6.SelectedIndex;
            signtemp6.CanDownload = this.Download6.SelectedIndex;
            tlist.Add(signtemp6);

            signtemp7.SignInfo = this.Sign7.Text.ToString();
            Employee emp7 = new Employee();
            emp7.Name = this.SignPer7.SelectedText;
            emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString());
            Department dep7 = new Department();
            dep7.Id = Convert.ToInt32(this.SignDep7.SelectedValue.ToString());
            dep7.Name = this.SignDep7.SelectedText;
            emp7.Department = dep7;
            signtemp7.SignEmployee = emp7;
            signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString());
            signtemp7.CanView = this.View7.SelectedIndex;
            signtemp7.CanDownload = this.Download7.SelectedIndex;
            tlist.Add(signtemp7);

            signtemp8.SignInfo = this.Sign8.Text.ToString();
            Employee emp8 = new Employee();
            emp8.Name = this.SignPer8.SelectedText;
            emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString());
            Department dep8 = new Department();
            dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString());
            dep8.Name = this.SignDep8.SelectedText;
            emp8.Department = dep8;
            signtemp8.SignEmployee = emp8;
            signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString());
            signtemp8.CanView = this.View8.SelectedIndex;
            signtemp8.CanDownload = this.Download8.SelectedIndex;
            tlist.Add(signtemp8);

            temp.SignDatas = tlist;
            temp.TempId = Id;

            string result = _sc.ModifyContractTemplate(temp);
            if (result == Response.MODIFY_CONTRACT_TEMPLATE_SUCCESS.ToString())
            {
                MessageBox.Show("修改模板成功!", "提示", MessageBoxButtons.OK);
                this.DialogResult = DialogResult.OK;
            }
            else if (result == "服务器连接中断")
            {
                MessageBox.Show("服务器连接中断,修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存为新模版
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSaveNew_Click(object sender, EventArgs e)
        {
            if (this.CheckIntegrity() == false)
            {
                return;
            }
            Templete temp = new Templete();
            SignatureTemplate signtemp1 = new SignatureTemplate();
            SignatureTemplate signtemp2 = new SignatureTemplate();
            SignatureTemplate signtemp3 = new SignatureTemplate();
            SignatureTemplate signtemp4 = new SignatureTemplate();
            SignatureTemplate signtemp5 = new SignatureTemplate();
            SignatureTemplate signtemp6 = new SignatureTemplate();
            SignatureTemplate signtemp7 = new SignatureTemplate();
            SignatureTemplate signtemp8 = new SignatureTemplate();
            List<string> list = new List<string>();
            List<SignatureTemplate> tlist = new List<SignatureTemplate>();

            temp.Name = this.ConTempName.Text.ToString();
            list.Add(this.Column1.Text.ToString());
            list.Add(this.Column2.Text.ToString());
            list.Add(this.Column3.Text.ToString());
            list.Add(this.Column4.Text.ToString());
            list.Add(this.Column5.Text.ToString());
            temp.ColumnNames = list;

            signtemp1.SignInfo = this.Sign1.Text.ToString();
            Employee emp1 = new Employee();
            emp1.Name = this.SignPer1.SelectedText;
            emp1.Id = Convert.ToInt32(this.SignPer1.SelectedValue.ToString());
            Department dep1 = new Department();
            dep1.Id = Convert.ToInt32(this.SignDep1.SelectedValue.ToString());
            dep1.Name = this.SignDep1.SelectedText;
            emp1.Department = dep1;
            signtemp1.SignEmployee = emp1;
            signtemp1.SignLevel = Convert.ToInt32(this.Sign1Level.SelectedItem.ToString());
            tlist.Add(signtemp1);

            signtemp2.SignInfo = this.Sign2.Text.ToString();
            Employee emp2 = new Employee();
            emp2.Name = this.SignPer2.SelectedText;
            emp2.Id = Convert.ToInt32(this.SignPer2.SelectedValue.ToString());
            Department dep2 = new Department();
            dep2.Id = Convert.ToInt32(this.SignDep2.SelectedValue.ToString());
            dep2.Name = this.SignDep2.SelectedText;
            emp2.Department = dep2;
            signtemp2.SignEmployee = emp2;
            signtemp2.SignLevel = Convert.ToInt32(this.Sign2Level.SelectedItem.ToString());
            tlist.Add(signtemp2);

            signtemp3.SignInfo = this.Sign3.Text.ToString();
            Employee emp3 = new Employee();
            emp3.Name = this.SignPer3.SelectedText;
            emp3.Id = Convert.ToInt32(this.SignPer3.SelectedValue.ToString());
            Department dep3 = new Department();
            dep3.Id = Convert.ToInt32(this.SignDep3.SelectedValue.ToString());
            dep3.Name = this.SignDep3.SelectedText;
            emp3.Department = dep3;
            signtemp3.SignEmployee = emp3;
            signtemp3.SignLevel = Convert.ToInt32(this.Sign3Level.SelectedItem.ToString());
            tlist.Add(signtemp3);

            signtemp4.SignInfo = this.Sign4.Text.ToString();
            Employee emp4 = new Employee();
            emp4.Name = this.SignPer4.SelectedText;
            emp4.Id = Convert.ToInt32(this.SignPer4.SelectedValue.ToString());
            Department dep4 = new Department();
            dep4.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString());
            dep4.Name = this.SignDep4.SelectedText;
            emp4.Department = dep4;
            signtemp4.SignEmployee = emp4;
            signtemp4.SignLevel = Convert.ToInt32(this.Sign4Level.SelectedItem.ToString());
            tlist.Add(signtemp4);

            signtemp5.SignInfo = this.Sign5.Text.ToString();
            Employee emp5 = new Employee();
            emp5.Name = this.SignPer5.SelectedText;
            emp5.Id = Convert.ToInt32(this.SignPer5.SelectedValue.ToString());
            Department dep5 = new Department();
            dep5.Id = Convert.ToInt32(this.SignDep5.SelectedValue.ToString());
            dep5.Name = this.SignDep5.SelectedText;
            emp5.Department = dep5;
            signtemp5.SignEmployee = emp5;
            signtemp5.SignLevel = Convert.ToInt32(this.Sign5Level.SelectedItem.ToString());
            tlist.Add(signtemp5);

            signtemp6.SignInfo = this.Sign6.Text.ToString();
            Employee emp6 = new Employee();
            emp6.Name = this.SignPer6.SelectedText;
            emp6.Id = Convert.ToInt32(this.SignPer6.SelectedValue.ToString());
            Department dep6 = new Department();
            dep6.Id = Convert.ToInt32(this.SignDep6.SelectedValue.ToString());
            dep6.Name = this.SignDep6.SelectedText;
            emp6.Department = dep6;
            signtemp6.SignEmployee = emp6;
            signtemp6.SignLevel = Convert.ToInt32(this.Sign6Level.SelectedItem.ToString());
            tlist.Add(signtemp6);

            signtemp7.SignInfo = this.Sign7.Text.ToString();
            Employee emp7 = new Employee();
            emp7.Name = this.SignPer7.SelectedText;
            emp7.Id = Convert.ToInt32(this.SignPer7.SelectedValue.ToString());
            Department dep7 = new Department();
            dep7.Id = Convert.ToInt32(this.SignDep4.SelectedValue.ToString());
            dep7.Name = this.SignDep7.SelectedText;
            emp7.Department = dep7;
            signtemp7.SignEmployee = emp7;
            signtemp7.SignLevel = Convert.ToInt32(this.Sign7Level.SelectedItem.ToString());
            tlist.Add(signtemp7);

            signtemp8.SignInfo = this.Sign8.Text.ToString();
            Employee emp8 = new Employee();
            emp8.Name = this.SignPer8.SelectedText;
            emp8.Id = Convert.ToInt32(this.SignPer8.SelectedValue.ToString());
            Department dep8 = new Department();
            dep8.Id = Convert.ToInt32(this.SignDep8.SelectedValue.ToString());
            dep8.Name = this.SignDep8.SelectedText;
            emp8.Department = dep8;
            signtemp8.SignEmployee = emp8;
            signtemp8.SignLevel = Convert.ToInt32(this.Sign8Level.SelectedItem.ToString());
            tlist.Add(signtemp8);

            temp.SignDatas = tlist;

            string result =  _sc.AddConTemplete(temp);

            if (result == Response.INSERT_CONTRACT_TEMPLATE_SUCCESS.ToString())
            {
                MessageBox.Show("保存为新模板" + this.ConTempName.Text + "成功!");
                this.DialogResult = DialogResult.OK;

            }
            else
            {
                MessageBox.Show("保存为新模板!");
            }
        }