private void ReadAutoGeneratedNumbers() { intValue = 0; int.TryParse(agencyIDTextBox.Text, out intValue); sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_AutoNumber = sol_AutoNumber_Sp.Select(intValue, 1); if (sol_AutoNumber == null) { sol_AutoNumber = new Sol_AutoNumber(); sol_AutoNumber.AgencyID = intValue; sol_AutoNumber.FolioID = 1; sol_AutoNumber.TagNumber = 0; sol_AutoNumber.RBillNumber = 0; sol_AutoNumber_Sp.Insert(sol_AutoNumber); } //checkBoxAutoTagNumber.Checked = Main.Sol_ControlInfo.AutoGenerateTagNumber; textBoxTagNumber.Text = sol_AutoNumber.TagNumber.ToString(); //checkBoxAutoRBillNumber.Checked = Main.Sol_ControlInfo.AutoGenerateRBillNumber; textBoxRBillNumber.Text = sol_AutoNumber.RBillNumber.ToString(); }
private void OK_Click(object sender, EventArgs e) { if (b_Add) { if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolAddCatalogues", true)) { return; } } else { if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolEditCatalogues", true)) { return; } } //bool flag = panelDetails.Visible; /*if (flag) * { * if (!ValidateForm()) * return; * * cambiarVista(); * }*/ ////hay cambios? //if (dataSetProducts.HasChanges()) //{ this.Validate(); this.sol_AgenciesBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.dataSetAgencies); try { //if (Convert.ToInt32(productIDTextBox.Text) < 0) if (b_Add) { b_Add = false; this.sol_AgenciesTableAdapter.Fill(this.dataSetAgencies.sol_Agencies); this.sol_AgenciesBindingSource.MoveLast(); } else { intValue = 0; int.TryParse(agencyIDTextBox.Text, out intValue); if (sol_AutoNumber_Sp == null) { sol_AutoNumber_Sp = new Sol_AutoNumber_Sp(Properties.Settings.Default.WsirDbConnectionString); } if (sol_AutoNumber == null) { sol_AutoNumber = new Sol_AutoNumber(); sol_AutoNumber.AgencyID = intValue; sol_AutoNumber.FolioID = 1; sol_AutoNumber.TagNumber = 0; sol_AutoNumber.RBillNumber = 0; sol_AutoNumber_Sp.Insert(sol_AutoNumber); } intValue = 0; int.TryParse(textBoxTagNumber.Text, out intValue); sol_AutoNumber.TagNumber = intValue; intValue = 0; int.TryParse(textBoxRBillNumber.Text, out intValue); sol_AutoNumber.RBillNumber = intValue; sol_AutoNumber_Sp.Update(sol_AutoNumber); //Main.Sol_ControlInfo.AutoGenerateTagNumber = checkBoxAutoTagNumber.Checked; //Main.Sol_ControlInfo.AutoGenerateRBillNumber = checkBoxAutoRBillNumber.Checked; } } catch { // } //} //if (!flag) Close(); }