Beispiel #1
0
 private void btnChangePassword_Click(object sender, EventArgs e)
 {
     if (txtCurrentPassword.Text == user.UserPassword &&
         txtNewPassword.Text != "" &&
         txtNewPassword.Text == txtNewPasswordRepeated.Text)
     {
         try
         {
             user.UserPassword = txtNewPassword.Text;
             UnitOfWork.Users.Update(user);
             UnitOfWork.Save();
             UnitOfWork.Dispose();
             MessageBox.Show("رمز عبور جدید با موفقیت ذخیره شد.");
             this.DialogResult = DialogResult.OK;
         }
         catch (Exception)
         {
             MessageBox.Show("عملیات با خطا مواجه شد.");
         }
     }
     else
     {
         MessageBox.Show("فیلدها به درستی تکمیل نشده اند.");
     }
 }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtFamily.Text != "" &&
         txtPhone.Text != "" &&
         cbInsurance.Text != "" &&
         cbDoctor.Text != "" &&
         txtPrice.Text != "")
     {
         try
         {
             VisitReception visitReception = new VisitReception()
             {
                 FirstName   = txtName.Text,
                 LastName    = txtFamily.Text,
                 PhoneNumber = txtPhone.Text,
                 Price       = int.Parse(txtPrice.Text, System.Globalization.NumberStyles.AllowThousands),
                 Date        = DateTime.Now,
                 UserId      = this.UserId,
                 InsuranceId = insurance.InsuranceId,
                 DoctorId    = ((Doctor)(cbDoctor.SelectedItem)).DoctorId
             };
             UnitOfWork.VisitReceptions.Insert(visitReception);
             printRecipt.Print();
             UnitOfWork.Save();
             UnitOfWork.Dispose();
             this.DialogResult = DialogResult.OK;
         }
         catch (Exception)
         {
             MessageBox.Show("امکان ثبت این رکورد وجود ندارد.");
         }
     }
     else
     {
         MessageBox.Show("لطفا فیلدها را به شکل صحیح پر کنید");
     }
 }
Beispiel #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtFamily.Text != "" &&
         txtPhone.Text != "" &&
         cbService.Text != "" &&
         txtPrice.Text != "")
     {
         //try
         //{
         ServiceReception serviceReception = new ServiceReception()
         {
             FirstName      = txtName.Text,
             LastName       = txtFamily.Text,
             PhoneNumber    = txtPhone.Text,
             Price          = int.Parse(txtPrice.Text, System.Globalization.NumberStyles.AllowThousands),
             Date           = DateTime.Now,
             UserId         = this.UserId,
             ServiceId      = service.ServiceId,
             ServiceGroupId = service.ServiceGroupId
         };
         UnitOfWork.ServiceReceptions.Insert(serviceReception);
         printRecipt.Print();
         UnitOfWork.Save();
         UnitOfWork.Dispose();
         this.DialogResult = DialogResult.OK;
         //}
         //catch (Exception)
         //{
         //    MessageBox.Show("امکان ثبت این رکورد وجود ندارد.");
         //}
     }
     else
     {
         MessageBox.Show("لطفا فیلدها را به شکل صحیح پر کنید");
     }
 }