Ejemplo n.º 1
0
 public SmsPersonPhoneAddChangeForm(AIS.SN.Model.DomainObjects.SmsPersonPhone smsPersonPhone)
     : this()
 {
     this.m_SmsPersonPhone = smsPersonPhone;
     if (this.m_SmsPersonPhone.IsNew)
     {
         this.set_Text("Добавление нового телефона, владельца");
         this.btOk.set_Text("Добавить");
     }
     else
     {
         this.set_Text("Изменение сведений по телефону, вледельцу");
         this.btOk.set_Text("Изменить");
     }
     this.bsSmsPersonPfone.set_DataSource(this.m_SmsPersonPhone);
     this.m_SmsPersonPhone.BeginEdit();
 }
Ejemplo n.º 2
0
 private void btnAdd_Click(object sender, System.EventArgs e)
 {
     if (this.m_Account != Account.Null)
     {
         SmsPersonPhone smsPersonPhone = new SmsPersonPhone {
             AccountId = this.m_Account.Id
         };
         SmsPersonPhoneAddChangeForm form = new SmsPersonPhoneAddChangeForm(smsPersonPhone);
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             smsPersonPhone = form.SmsPersonPhone;
             try
             {
                 smsPersonPhone.SaveChanges();
                 string valueByName = Setting.GetValueByName("Глобальные установки", "Адрес сервиса личного кабинета");
                 if ((valueByName != Setting.Null.Value) && (valueByName != string.Empty))
                 {
                     string pass = SmsPersonPhone.InSmsLKAddNewAbonent(smsPersonPhone.Phone, ObjectWithId.FindById<Account>(this.m_Account.Id).Number, new System.Data.SqlClient.SqlConnectionStringBuilder(Register.ConnectionString).get_InitialCatalog(), smsPersonPhone.Fio, smsPersonPhone.Email);
                     if (pass == "Ошибка")
                     {
                         Messages.ShowError("Ошибка передачи данных в личный кабинет. Обратитесь к системному администратору");
                     }
                     if ((pass != "Ошибка") && (pass != ""))
                     {
                         this.GenereateLkInformation(Setting.GetValueByName("Глобальные установки", "Адрес личного кабинета"), smsPersonPhone.Phone, pass);
                     }
                 }
             }
             catch (System.Exception exception)
             {
                 Messages.ShowException(this, "При создании записи о телефоне произошла ошибка", exception);
             }
             this.bsSmsPersonPhone.Add(smsPersonPhone);
             this.bsSmsPersonPhone.set_Sort(this.bsSmsPersonPhone.get_Sort());
             this.bsSmsPersonPhone.set_Position(this.bsSmsPersonPhone.IndexOf(smsPersonPhone));
         }
     }
 }
Ejemplo n.º 3
0
 private void btOk_Click(object sender, System.EventArgs e)
 {
     this.epValidation.Clear();
     bool flag = true;
     if (this.mtbPhoneNumber.get_Text().get_Length() != 11)
     {
         flag = false;
         this.epValidation.SetError(this.label5, "Номер телефона должен состоять из 11 цифр");
     }
     if (string.IsNullOrEmpty(this.tbName.get_Text()))
     {
         flag = false;
         this.epValidation.SetError(this.label4, "Необходимо указать ФИО владельца телефона");
     }
     if (!string.IsNullOrEmpty(this.tbEmail.get_Text()))
     {
         string str = @"[.\-_a-z0-9]+@([\-a-z0-9]+\.)+[a-z]{2,6}";
         if (!Regex.Match(this.tbEmail.get_Text(), str, RegexOptions.IgnoreCase).get_Success())
         {
             flag = false;
             this.epValidation.SetError(this.lbEmail, "Некорректно введена электронная почта.");
         }
     }
     if (flag)
     {
         AIS.SN.Model.DomainObjects.SmsPersonPhone @null = AIS.SN.Model.DomainObjects.SmsPersonPhone.Null;
         @null = AIS.SN.Model.DomainObjects.SmsPersonPhone.GetByAccountIdAndPhoneNumber(this.m_SmsPersonPhone.AccountId, this.m_SmsPersonPhone.Phone);
         if ((@null != AIS.SN.Model.DomainObjects.SmsPersonPhone.Null) && (@null.Id != this.m_SmsPersonPhone.Id))
         {
             if (Messages.QuestionYesNo(this, string.Format("В базе уже имеется запись о телефоне с номером \"{0}\", зарегистрированном на \"{1}\"\nИспользовать этот номер для текущего лицевого счёта?", @null.Phone, @null.Fio)) == System.Windows.Forms.DialogResult.Yes)
             {
                 long accountId = this.m_SmsPersonPhone.AccountId;
                 this.m_SmsPersonPhone = @null;
                 this.m_SmsPersonPhone.Fio = this.tbName.get_Text();
                 this.m_SmsPersonPhone.AccountId = accountId;
                 this.m_SmsPersonPhone.Email = this.tbEmail.get_Text();
                 base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
             }
             else
             {
                 this.m_SmsPersonPhone.CancelEdit();
                 this.m_SmsPersonPhone = AIS.SN.Model.DomainObjects.SmsPersonPhone.Null;
                 base.set_DialogResult(System.Windows.Forms.DialogResult.Abort);
             }
         }
         else
         {
             this.m_SmsPersonPhone.EndEdit();
             base.set_DialogResult(System.Windows.Forms.DialogResult.OK);
         }
     }
 }
Ejemplo n.º 4
0
 public SmsPersonPhoneAddChangeForm()
 {
     this.m_SmsPersonPhone = AIS.SN.Model.DomainObjects.SmsPersonPhone.Null;
     this.InitializeComponent();
     this.set_Font(Manager.WindowFont);
 }
 public SmsPhonePersonEventTypesForm(SmsPersonPhone smsPersonPhone)
     : this()
 {
     this.m_SmsPersonPhone = smsPersonPhone;
 }
 public SmsPhonePersonEventTypesForm()
 {
     this.m_SmsPersonPhone = SmsPersonPhone.Null;
     this.InitializeComponent();
     this.set_Font(Manager.WindowFont);
 }