Esempio n. 1
0
 /// <summary>
 /// Email TextBox Leave Event.
 /// </summary>
 private void EmailTB_Leave(object sender, EventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(EmailTB.Text) && !Regex.IsMatch(EmailTB.Text.Trim(), @"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$", RegexOptions.IgnoreCase))
     {
         EmailTB.BackColor = Color.MistyRose;
         EmailTB.Focus();
         MessageBox.Show("请输入正确的Email", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     EmailTB.BackColor = String.IsNullOrWhiteSpace(EmailTB.Text) ? Color.MistyRose : SystemColors.Window;
 }
Esempio n. 2
0
 private void RegisterBTN_Click(object sender, RoutedEventArgs e)
 {
     if (AgreementCB.IsChecked == true)
     {
         if (EmailTB.Text.Length >= 5 &&
             LoginTB.Text.Length >= 5 &&
             PasswordTB.Password.Length >= 5 &&
             RepeatPasswordTB.Password.Length >= 5)
         {
             if (PasswordTB.Password == RepeatPasswordTB.Password)
             {
                 string email    = EmailTB.Text;
                 string password = PasswordTB.Password;
                 string username = LoginTB.Text;
                 var    user     = new ApplicationUser()
                 {
                     Email = email, UserName = username, Password = password
                 };
                 if (new HttpHelper().Request(user, new AppSettingsReader().GetValue("ServerHost", typeof(string)) + "api/Auth/Register"))
                 {
                     SessionHelper.SetActiveUserSession(user);
                     ConnectToRoom connectToRoomForm = new ConnectToRoom();
                     connectToRoomForm.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("User with this login or email already exist", "Sync Player");
                 }
             }
             else
             {
                 RepeatPasswordTB.Password = string.Empty;
                 RepeatPasswordTB.Focus();
             }
         }
         else
         {
             EmailTB.Focus();
         }
     }
     else
     {
         var converter = new BrushConverter();
         var brush     = (Brush)converter.ConvertFromString("#FF0000");
         AgreementCB.BorderBrush = brush;
         AgreementCB.Background  = brush;
     }
 }
 private void passwordTB_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
     {
         EmailTB.Focus();
         textBox_clicked(sender, e);
         if (passwordTB.Text == "")
         {
             passwordTB.ForeColor = original_text_Color;
             passwordTB.Text      = "last name";
         }
     }
     else
     {
         if (passwordTB.ForeColor == original_text_Color)
         {
             passwordTB.ForeColor = original_text_Color_Active;
             passwordTB.Text      = "";
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Save Employee.
        /// </summary>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try {
                if (String.IsNullOrWhiteSpace(EmpIDTB.Text) ||
                    String.IsNullOrWhiteSpace(EmpNameTB.Text) ||
                    String.IsNullOrWhiteSpace(MobilePhoneTB.Text) ||
                    String.IsNullOrWhiteSpace(EmailTB.Text))
                {
                    if (String.IsNullOrWhiteSpace(EmailTB.Text))
                    {
                        EmailTB.BackColor = Color.MistyRose;
                        EmailTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(MobilePhoneTB.Text))
                    {
                        MobilePhoneTB.BackColor = Color.MistyRose;
                        MobilePhoneTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(EmpNameTB.Text))
                    {
                        EmpNameTB.BackColor = Color.MistyRose;
                        EmpNameTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(EmpIDTB.Text))
                    {
                        EmpIDTB.BackColor = Color.MistyRose;
                        EmpIDTB.Focus();
                    }

                    MessageBox.Show("请输入必填项(红色标示区域)", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (CurBehavior == EnmSaveBehavior.Add && EmpEntity.ExistOrgEmployee(EmpIDTB.Text.Trim()))
                {
                    EmpIDTB.BackColor = Color.MistyRose;
                    EmpIDTB.Focus();
                    MessageBox.Show("工号已存在", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (String.IsNullOrWhiteSpace(CurEmployee.DepId))
                {
                    DeptTB.Clear();
                    CurEmployee.DepId   = String.Empty;
                    CurEmployee.DepName = String.Empty;
                    MessageBox.Show("请选择所属部门", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                CurEmployee.EmpId       = EmpIDTB.Text.Trim();
                CurEmployee.EmpType     = ComUtility.DBNullWorkerTypeHandler(EmpTypeCB.SelectedValue);
                CurEmployee.EmpName     = EmpNameTB.Text.Trim();
                CurEmployee.EnglishName = EmpEnglishNameTB.Text.Trim();
                CurEmployee.Sex         = SexMRB.Checked ? "M" : "F";
                CurEmployee.CardId      = CardIDTB.Text.Trim();
                CurEmployee.Hometown    = HometownTB.Text.Trim();
                CurEmployee.BirthDay    = BirthDayDTP.Value;
                CurEmployee.Marriage    = ComUtility.DBNullMarriageTypeHandler(MarriageTypeCB.SelectedValue);
                CurEmployee.HomeAddress = HomeAddressTB.Text.Trim();
                CurEmployee.HomePhone   = HomePhoneTB.Text.Trim();
                CurEmployee.EntryDay    = EntryDayDTP.Value;
                CurEmployee.PositiveDay = PositiveDayDTP.Value;
                //CurEmployee.DepId = null;
                //CurEmployee.DepName = null;
                CurEmployee.DutyName    = DutyNameTB.Text.Trim();
                CurEmployee.OfficePhone = OfficePhoneTB.Text.Trim();
                CurEmployee.MobilePhone = MobilePhoneTB.Text.Trim();
                CurEmployee.Email       = EmailTB.Text.Trim();
                CurEmployee.Comment     = RemarkTB.Text.Trim();
                //CurEmployee.Photo = null;
                CurEmployee.PhotoLayout       = (int)PhotoPanel.BackgroundImageLayout;
                CurEmployee.Enabled           = !EmpStatusCB.Checked;
                CurEmployee.ResignationDate   = CurEmployee.Enabled ? ComUtility.DefaultDateTime : ResignationDateDTP.Value;
                CurEmployee.ResignationRemark = CurEmployee.Enabled ? ComUtility.DefaultString : ResignationRemarkTB.Text.Trim();

                var result = Common.ShowWait(() => {
                    EmpEntity.SaveOrgEmployees(new List <OrgEmployeeInfo> {
                        CurEmployee
                    });
                }, default(String), "正在保存,请稍后...", default(Int32), default(Int32));

                if (result == DialogResult.OK)
                {
                    Common.CopyObjectValues(CurEmployee, OriEmployee);
                    Common.WriteLog(DateTime.Now, EnmMsgType.Info, Common.CurUser.UserName, "Delta.MPS.AccessSystem.SaveEmployeeForm.SaveBtn.Click", String.Format("{0}员工:[{1},{2}]", CurBehavior == EnmSaveBehavior.Add ? "新增" : "更新", CurEmployee.EmpId, CurEmployee.EmpName), null);
                    MessageBox.Show("数据保存完成", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("数据保存失败", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SaveEmployeeForm.SaveBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Save Out Employee.
        /// </summary>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try {
                if (String.IsNullOrWhiteSpace(EmpIDTB.Text) ||
                    String.IsNullOrWhiteSpace(EmpNameTB.Text) ||
                    String.IsNullOrWhiteSpace(MobilePhoneTB.Text) ||
                    String.IsNullOrWhiteSpace(EmailTB.Text))
                {
                    if (String.IsNullOrWhiteSpace(EmailTB.Text))
                    {
                        EmailTB.BackColor = Color.MistyRose;
                        EmailTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(MobilePhoneTB.Text))
                    {
                        MobilePhoneTB.BackColor = Color.MistyRose;
                        MobilePhoneTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(EmpNameTB.Text))
                    {
                        EmpNameTB.BackColor = Color.MistyRose;
                        EmpNameTB.Focus();
                    }
                    if (String.IsNullOrWhiteSpace(EmpIDTB.Text))
                    {
                        EmpIDTB.BackColor = Color.MistyRose;
                        EmpIDTB.Focus();
                    }

                    MessageBox.Show("请输入必填项(红色标示区域)", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (CurBehavior == EnmSaveBehavior.Add && EmpEntity.ExistOutEmployee(EmpIDTB.Text.Trim()))
                {
                    EmpIDTB.BackColor = Color.MistyRose;
                    EmpIDTB.Focus();
                    MessageBox.Show("工号已存在", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (String.IsNullOrWhiteSpace(CurEmployee.ParentEmpId))
                {
                    PEmpNameTB.Clear();
                    CurEmployee.DepId         = String.Empty;
                    CurEmployee.DepName       = String.Empty;
                    CurEmployee.ParentEmpId   = String.Empty;
                    CurEmployee.ParentEmpName = String.Empty;
                    MessageBox.Show("请选择外协人员的责任人", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                CurEmployee.EmpId       = EmpIDTB.Text.Trim();
                CurEmployee.EmpName     = EmpNameTB.Text.Trim();
                CurEmployee.Sex         = SexMRB.Checked ? "M" : "F";
                CurEmployee.Hometown    = HometownTB.Text.Trim();
                CurEmployee.CardId      = CardIDTB.Text.Trim();
                CurEmployee.CardIssue   = CardIssueTB.Text.Trim();
                CurEmployee.CardAddress = CardAddressTB.Text.Trim();
                CurEmployee.CompanyName = CompanyNameTB.Text.Trim();
                CurEmployee.ProjectName = ProjectNameTB.Text.Trim();
                CurEmployee.OfficePhone = OfficePhoneTB.Text.Trim();
                CurEmployee.MobilePhone = MobilePhoneTB.Text.Trim();
                CurEmployee.Email       = EmailTB.Text.Trim();
                //CurEmployee.ParentEmpName = null;
                CurEmployee.Enabled = EmpStatusCB.Checked;
                CurEmployee.Comment = RemarkTB.Text.Trim();
                //CurEmployee.Photo = null;
                CurEmployee.PhotoLayout = (int)PhotoPanel.BackgroundImageLayout;

                var result = Common.ShowWait(() => {
                    EmpEntity.SaveOutEmployees(new List <OutEmployeeInfo> {
                        CurEmployee
                    });
                }, default(String), "正在保存,请稍后...", default(Int32), default(Int32));

                if (result == DialogResult.OK)
                {
                    Common.CopyObjectValues(CurEmployee, OriEmployee);
                    Common.WriteLog(DateTime.Now, EnmMsgType.Info, Common.CurUser.UserName, "Delta.MPS.AccessSystem.SaveOutEmployeeForm.SaveBtn.Click", String.Format("{0}外协人员:[{1},{2}]", CurBehavior == EnmSaveBehavior.Add ? "新增" : "更新", CurEmployee.EmpId, CurEmployee.EmpName), null);
                    MessageBox.Show("数据保存完成", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("数据保存失败", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SaveOutEmployeeForm.SaveBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
        private void Updatebutton_Click(object sender, EventArgs e)
        {
            if (CompanyNameTB.Text == "")
            {
                CompanyNameTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Company Name Is Required", "Please Enter Company Name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                CompanyNameTB.Focus();
                return;
            }

            if (SaloganTB.Text == "")
            {
                SaloganTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Salogan Is Required", "Please Enter Salogan", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                SaloganTB.Focus();
                return;
            }

            if (AddressTB.Text == "")
            {
                AddressTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Address Is Required", "Please Enter Address", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AddressTB.Focus();
                return;
            }

            if (ContactTB.Text == "")
            {
                ContactTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Contact Number Is Required", "Please Enter Number", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ContactTB.Focus();
                return;
            }

            if (EmailTB.Text == "")
            {
                EmailTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Email Is Required", "Please Enter Email", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                EmailTB.Focus();
                return;
            }

            if (WebsiteTb.Text == "")
            {
                WebsiteTb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Website Is Required", "Please Enter Website", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                WebsiteTb.Focus();
                return;
            }

            if (UserNameGetter.Text == "")
            {
                UserNameTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("UserName Is Required", "Please Enter UserName", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                UserNameTB.Focus();
                return;
            }



            UpdateMethod();
        }