//Refresh Branch list private void RefreshBT_Click(object sender, RoutedEventArgs e) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); LoadData(); SaveBT.IsEnabled = false; }
public void SimpleLayout() { var margin = new Thickness(4); var form = new FormGrid { ColumnCount = 2, ChildMargin = margin }; var labels = new[] { new Label(), new Label(), new Label(), new Label() }; var texts = new[] { new TextBox(), new TextBox(), new TextBox(), new TextBox() }; for (int i = 0; i < 4; i++) { form.Children.Add(labels[i]); form.Children.Add(texts[i]); } form.RecalcLayout(); AssertCell(labels[0], 0, 0); AssertCell(texts[0], 0, 1); AssertCell(labels[1], 0, 2); AssertCell(texts[1], 0, 3); AssertCell(labels[2], 1, 0); AssertCell(texts[2], 1, 1); AssertCell(labels[3], 1, 2); AssertCell(texts[3], 1, 3); Assert.AreEqual(margin, labels[0].Margin); Assert.AreEqual(HorizontalAlignment.Right, labels[0].HorizontalAlignment); }
private async void NewSupplierBT_Click(object sender, RoutedEventArgs e) { if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); await Task.Delay(100); } //From grid animation if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); SuppSocialNameTX.Focus(); SaveBT.IsEnabled = true; } else if (SuppSocialNameTX.Text.Length == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } //Clear supplier values if (SuppSocialNameTX.Text.Length > 0) { ResetForm(); } }
public AbmUsuario(FormGrid anterior) { InitializeComponent(); this.ClientSize = new System.Drawing.Size(569, 355); this.ventanaAnterior = anterior; actualizarGrilla(); }
//Permissions Selected private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Source is TabControl) { if (PermissionsTab.IsSelected) { //Get rol index string selection = SelectedIndex == "" ? "1" : SelectedIndex; PermissionsGrid.IsEnabled = selection == "1" ? false : true; //Set disabled permission edit on administrator rol PermissionsSaveBT.IsEnabled = selection == "1" ? false : true; //Reset rol status form PermissionsSaveBT.Background = (SolidColorBrush)Application.Current.TryFindResource("ConfigHeader"); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); RolID = selection; var Data = NovaAPI.APIRoles.userrols.Find(x => x.rolid == selection).RolData; //Load permissions on selected rol or null rol PermissionsGrid.ItemsSource = Data; PermissionsGrid.Items.Refresh(); //Set rol name title LabelTitle.Content = NovaAPI.APIRoles.userrols.Find(x => x.rolid == selection).rolname; } } }
//Open client form for edit private void Edit_Click(object sender, RoutedEventArgs e) { //Hide filter if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; var Client = NovaAPI.APIClient.clients.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set supplier information to controls ClientNameTX.Text = Client.name; ClientIDTX.Text = Client.documentid; ClientTypeCB.SelectedIndex = Convert.ToInt32(Client.type); ClientPhoneTX.Text = Client.phone; ClientCelphoneTX.Text = Client.celphone; ClientAddressTX.Text = Client.address; ClientMailTX.Text = Client.mail; ClientCreditCB.IsChecked = Client.cancredit == "0" ? false : true; //Set selected supplier id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol ClientNameTX.Focus(); SaveBT.IsEnabled = true; }
private void EditRol_Click(object sender, RoutedEventArgs e) { //Get button control Button Control = (Button)sender; string rolid = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Control.Tag.ToString()).rolid; if (rolid == "1") { MessageBox.Show("No se puede editar el rol de administrador del sistema"); return; } if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set rol information to controls RolNameTX.Text = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Control.Tag.ToString()).rolname; RolDescriptTX.Text = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Control.Tag.ToString()).roldescription; EditPermBT.IsEnabled = true; //Set selected rol id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol RolNameTX.Focus(); SaveBT.IsEnabled = true; }
private async void Delete_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity != 0) { ResetForm(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; //Get User information var Product = NovaAPI.APIProdructs.products.Find(x => x.id == Control.Tag.ToString()); if (MessageBox.Show($"A continuación se eliminara el producto '{Product.name}'{Environment.NewLine}¿Desea continuar?", "Eliminar producto", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var Data = new NovaAPI.APIProdructs.ProductClass(); Data.id = Product.id; //Delete user string requestData = JsonConvert.SerializeObject(Data); bool response = await NovaAPI.APIProdructs.GetValues("3", DataConfig.LocalAPI, requestData); if (response) { NovaAPI.APIProdructs.products.Remove(Product); ProductsGrid.Items.Refresh(); } else { MessageBox.Show($"Error al eliminar el producto, INFO: {Environment.NewLine}{NovaAPI.APIProdructs.Message}"); } } }
public AbmCliente(FormGrid anterior) { InitializeComponent(); this.ClientSize = new System.Drawing.Size(900, 355); this.ventanaAnterior = anterior; reiniciarComando(); actualizarGrilla(); }
private void RefreshBT_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity == 1) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } ResetForm(); LoadData(); }
void Start() { // Initialize Variables // ******************** _grid = GetComponent <FormGrid> (); randCellHor = Random.Range(1, (FormGrid.SIZE)); randCellVert = Random.Range(1, (FormGrid.SIZE)); randStart = Random.Range(1, FormGrid.SIZE); randEnd = Random.Range(1, FormGrid.SIZE); }
//Edit product button toggle private void Edit_Click(object sender, RoutedEventArgs e) { //Get button control Button Control = (Button)sender; if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } var ProductData = NovaAPI.APIProdructs.products.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set popup name PopUpProductName.Content = ProductData.name; PopUpProductValue.Content = string.Format("Precio venta general: {0:C0}", Convert.ToInt32(ProductData.sellprice)); //Set product information to controls ProductCodeTX.Text = ProductData.code; ProductNameTX.Text = ProductData.name; ProductCatCB.SelectedItem = NovaAPI.APICategory.category.Find(x => x.id == ProductData.category); ProductCostTX.Number = Convert.ToInt32(ProductData.costprice); ProductPriceTX.Number = Convert.ToInt32(ProductData.sellprice); ProductTypeCB.SelectedIndex = Convert.ToInt32(ProductData.unity_type); MinStockTX.Text = ProductData.minstock; MaxStockTX.Text = ProductData.maxstock; //Set taxes if (ProductData.iva == "0" && ProductData.iac == "0" && ProductData.iva5 == "0") { TaxNoneRB.IsChecked = true; } else { TaxIvaRB.IsChecked = ProductData.iva == "1" ? true : false; TaxIva5RB.IsChecked = ProductData.iva5 == "1" ? true : false; TaxIacRB.IsChecked = ProductData.iac == "1" ? true : false; } //Set selected product id index for edition save ProductSelectIndex = Control.Tag.ToString(); //Focus editable product ProductCodeTX.Focus(); SaveProductBT.IsEnabled = true; PricesBT.IsEnabled = true; }
public cambioPass(FormGrid ventanaAnterior, bool primerIngreso) { InitializeComponent(); this.primerIngreso = primerIngreso; this.ventanaAnterior = ventanaAnterior; this.ClientSize = new System.Drawing.Size(365, 266); if (primerIngreso || DatosUsuario.usuarioAux != "-1") { textBoxOldPass.Enabled = false; textBoxOldPass.Text = "LOOOOOOL"; DatosUsuario.actualizarBanderasUsuario(); } }
private void FormTuning_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet.loadtype". При необходимости она может быть перемещена или удалена. this.loadtypeTableAdapter.Connection.ConnectionString = Utility.GetConnectionString(); this.loadtypeTableAdapter.Fill(this.academicLoadDataSet.loadtype); // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet1.view_semester_subject". При необходимости она может быть перемещена или удалена. //this.view_semester_subjectTableAdapter.Fill(this.academicLoadDataSet1.view_semester_subject); // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet.view_fio". При необходимости она может быть перемещена или удалена. //this.view_fioTableAdapter.Fill(this.academicLoadDataSet.view_fio); // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet.subject". При необходимости она может быть перемещена или удалена. //this.subjectTableAdapter.Fill(this.academicLoadDataSet.subject); // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet.view_fio". При необходимости она может быть перемещена или удалена. this.view_fioTableAdapter.Connection.ConnectionString = Utility.GetConnectionString(); this.view_fioTableAdapter.Fill(this.academicLoadDataSet.view_fio); // TODO: данная строка кода позволяет загрузить данные в таблицу "academicLoadDataSet.subject". При необходимости она может быть перемещена или удалена. //this.subjectTableAdapter.Fill(this.academicLoadDataSet.subject); this.view_semester_subjectTableAdapter.Connection.ConnectionString = Utility.GetConnectionString(); this.view_semester_subjectTableAdapter.Fill(this.academicLoadDataSet.view_semester_subject); formgrid = (FormGrid)Owner; radioButtonSelectSubjects.Checked = true; string strCon = Utility.GetConnectionString(); SqlConnection con = new SqlConnection(strCon); SqlCommand cmdGetAllLoadtype = new SqlCommand("SelectAllLoadtype", con); cmdGetAllLoadtype.CommandType = CommandType.StoredProcedure; try { con.Open(); SqlDataReader reader = cmdGetAllLoadtype.ExecuteReader(); while (reader.Read()) { selectedLoadtypes.Add(new Loadtype(reader.GetInt16(0), reader.GetString(1))); } reader.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } SetLoadtypesListDataSource(); }
public AltaVisibilidad(FormGrid anterior,string ID) { InitializeComponent(); this.ClientSize = new System.Drawing.Size(260, 207); ventanaAnterior = anterior; string consulta = "select * from THE_GRID.Visibilidad where ID_Visibilidad =" + ID; DataRow fila = TG.realizarConsulta(consulta).Rows[0]; txtNombre.Text = fila["Nombre"].ToString(); txtPrecio.Text = fila["Precio_Por_Publicar"].ToString(); txtPorcentaje.Text = fila["Porcentaje_Venta"].ToString(); txtDuracion.Text = fila["Duracion"].ToString(); //labelAviso.Text = "Recuerde que si desea guardar los cambios, debera insertar otro codigo para la visibilidad y la actual sera dada de baja"; IDBaja = ID; nombreBaja = fila["Nombre"].ToString(); ID_Tipo = fila["ID_Tipo"].ToString(); }
//Users action buttons private void Edit_Click(object sender, RoutedEventArgs e) { //Get button control Button Control = (Button)sender; //Set user information to controls var UserData = NovaAPI.APIUsers.users.Find(x => x.id == Control.Tag.ToString()); if (UserData.id == "1") { MessageBox.Show("No se puede modificar el usuario de administrador del sistema."); return; } if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //User principal data UserNameTX.Text = UserData.name; UserRealTX.Text = UserData.realname; UserPassword.Password = UserData.name; //User rol and branch data UserRolCB.SelectedItem = NovaAPI.APIRoles.userrols.Find(x => x.rolid == UserData.rolid); UserBranchCB.SelectedItem = NovaAPI.APIBranch.branch.Find(x => x.id == UserData.branchid); //user status data UserStatusCB.IsChecked = UserData.status == "1" ? true : false; //Set photo //------------------------- //Set selected rol id index for edition save SelectedIndex = Control.Tag.ToString(); UserRolCB.Items.Refresh(); UserBranchCB.Items.Refresh(); //Focus editable rol UserNameTX.Focus(); SaveBT.IsEnabled = true; }
bool usuarioNuevo = false; //Uso este boolean para saber mas adelante si tengo que hacer un update o un inserte en la base de datos #endregion Fields #region Constructors public Registro_de_Usuario(FormGrid anterior) { InitializeComponent(); ventanaAnterior = anterior; grupoEmpresa.Location = new System.Drawing.Point(15, 47); grupoEmpresa.Visible = false; this.ClientSize = new System.Drawing.Size(487, 428); comboBox1.SelectedIndex = 0; label31.Text += DatosUsuario.usuario.ToString(); switch (DatosUsuario.tipoUsuario) { case 1: //Administrador switch (DatosUsuario.tipoUsuarioModif) { case 2: levantarDatosCliente(); break; case 3: levantarDatosEmpresa(); break; default: radioButton1.Enabled = false; radioButton2.Enabled = false; grupoCliente.Enabled = false; break; } break; case 2: //Cliente label29.Text = "Por favor, mantenga sus datos actualizados"; levantarDatosCliente(); break; case 3: //Empresa label29.Text = "Por favor, mantenga sus datos actualizados"; levantarDatosEmpresa(); break; default: //usuario nuevo linkLabel1.Visible = false; label29.Visible = true; label31.Visible = false; usuarioNuevo = true; break; } }
private async void DeleteBranch_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity != 0) { ResetForm(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; int branchpoints = Convert.ToInt32(NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString()).boxes); if (branchpoints > 0) { MessageBox.Show("No se puede eliminar una sucursal con puntos de venta vinculados" + Environment.NewLine + "Por favor desvincule los puntos de venta antes de eliminar la sucursal"); return; } //Get Branch information string BranchName = NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString()).name; if (MessageBox.Show($"A continuación se eliminara la sucursal '{BranchName}{Environment.NewLine}¿Desea continuar?", "Eliminar sucursal", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var Data = new NovaAPI.APIBranch.BranchClass(); Data.id = Control.Tag.ToString(); //Delete rol string requestData = JsonConvert.SerializeObject(Data); bool response = await NovaAPI.APIBranch.GetValues("3", DataConfig.LocalAPI, requestData); if (response) { NovaAPI.APIBranch.branch.Remove(NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString())); BranchGrid.Items.Refresh(); } else { MessageBox.Show($"Error al eliminar la sucursal, INFO: {Environment.NewLine}{NovaAPI.APIRoles.Message}"); } } }
//New user action private void NewUserBT_Click(object sender, RoutedEventArgs e) { //From grid animation if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); UserNameTX.Focus(); SaveBT.IsEnabled = true; } else if (UserNameTX.Text.Length == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } //Clear branch values if (UserNameTX.Text.Length > 0) { ResetForm(); } }
//Refresh products data private void RefreshProducts_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity == 1) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } if (FilterGrid.Opacity == 1) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } TotalPages = 0; Pagination = 1; ResetForm(); LoadProducts(); NewProductBT.Focus(); }
private async void DeleteRol_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity != 0) { ResetForm(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; //Get rol information string rolname = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Control.Tag.ToString()).rolname; string rolid = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Control.Tag.ToString()).rolid; if (rolid == "1") { MessageBox.Show("No se puede eliminar el rol de administrador del sistema"); return; } if (MessageBox.Show($"A continuación se eliminara el rol '{rolname}{Environment.NewLine}¿Desea continuar?", "Eliminar rol", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var Data = new rolData(); Data.id = rolid; //Delete rol string requestData = JsonConvert.SerializeObject(Data); bool response = await NovaAPI.APIRoles.GetValues("3", DataConfig.LocalAPI, requestData); if (response) { NovaAPI.APIRoles.userrols.Remove(NovaAPI.APIRoles.userrols.Find(x => x.rolid == rolid)); RolGrid.Items.Refresh(); } else { MessageBox.Show($"Error al eliminar el rol, INFO: {Environment.NewLine}{NovaAPI.APIRoles.Message}"); } } }
private async void FilterBT_Click(object sender, RoutedEventArgs e) { if (FormGrid.Opacity != 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); await Task.Delay(100); } FilterTX.Clear(); if (FilterGrid.Opacity == 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); FilterTX.Focus(); } else { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } }
//Clear all form data and selections private void ClearFormData() { if (FormGrid.Opacity != 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } FilterTX.Clear(); ClientNameTX.Clear(); ClientIDTX.Clear(); ClientPhoneTX.Clear(); ClientAddressTX.Clear(); ClientMailTX.Clear(); ClientCelphoneTX.Clear(); ClientTypeCB.SelectedIndex = 0; ClientCreditCB.IsChecked = true; SaveBT.IsEnabled = false; }
private void EditBranch_Click(object sender, RoutedEventArgs e) { //Get button control Button Control = (Button)sender; if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set branch information to controls BranchNameTX.Text = NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString()).name; BranchAddTX.Text = NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString()).address; BranchPhoneTX.Text = NovaAPI.APIBranch.branch.Find(x => x.id == Control.Tag.ToString()).phone; //Set selected rol id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol BranchNameTX.Focus(); SaveBT.IsEnabled = true; }
private void Edit_Click(object sender, RoutedEventArgs e) { //Hide filter if (FilterGrid.Opacity != 0) { FilterGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); } //Get button control Button Control = (Button)sender; var Supplier = NovaAPI.APISupplier.suppliers.Find(x => x.id == Control.Tag.ToString()); if (FormGrid.Opacity == 0) { FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("PopUpGrid")); } //Set supplier information to controls SuppSocialNameTX.Text = Supplier.socialname; SuppComercialNameTX.Text = Supplier.comercialname; SuppidTypeCB.SelectedIndex = Convert.ToInt32(Supplier.idtype); SuppIDTX.Text = Supplier.documentid; SuppAddressTX.Text = Supplier.address; SuppPhoneTX.Text = Supplier.phone; SuppCelphoneTX.Text = Supplier.celphone; SuppEmailTX.Text = Supplier.mail; SuppContactTX.Text = Supplier.contact; SuppObvsTX.Text = Supplier.observation; StatusCB.IsChecked = Supplier.status == "1" ? true : false; //Set selected supplier id index for edition save SelectedIndex = Control.Tag.ToString(); //Focus editable rol SuppSocialNameTX.Focus(); SaveBT.IsEnabled = true; }
private async void SaveBT_Click(object sender, RoutedEventArgs e) { NewBranchBT.Focus(); if (BranchNameTX.Text.Length == 0 || BranchNameTX.Text.Length < 5) { MessageBox.Show("El nombre de la sucursal no puede estar en blanco o ser inferior a 5 caracteres"); BranchNameTX.Focus(); return; } //Get rol parameters var Data = new NovaAPI.APIBranch.BranchClass(); Data.id = SelectedIndex; Data.name = BranchNameTX.Text; Data.address = BranchAddTX.Text; Data.phone = BranchPhoneTX.Text; //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APIBranch.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APIBranch.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On branch modified NovaAPI.APIBranch.branch.Find(x => x.id == Data.id).name = Data.name; NovaAPI.APIBranch.branch.Find(x => x.id == Data.id).address = Data.address; NovaAPI.APIBranch.branch.Find(x => x.id == Data.id).phone = Data.phone; BranchGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); SaveBT.IsEnabled = false; } else { //On new branch created response var branch = new NovaAPI.APIBranch.BranchClass(); branch.name = Data.name; branch.address = Data.address; branch.phone = Data.phone; branch.id = NovaAPI.APIRoles.LastID; branch.count = "0"; FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); NovaAPI.APIBranch.branch.Add(branch); SaveBT.IsEnabled = false; //Reload rol data LoadData(); } } else { MessageBox.Show($"Error al crear la sucursal, INFO: {Environment.NewLine}{NovaAPI.APIRoles.Message}"); } }
public GenerarPublicacion(FormGrid anterior,string ID,bool valor) { InitializeComponent(); this.ClientSize = new System.Drawing.Size(451, 426); string comando = @"select * from THE_GRID.Visibilidad where Inhabilitado=0 order by Precio_Por_Publicar desc"; datosConsultaVisibilidad = TG.realizarConsulta(comando); comando = @"select Nombre from THE_GRID.Visibilidad where Inhabilitado = 0 order by Precio_Por_Publicar desc"; visibilidadComboBox1.DataSource = TG.ObtenerListado(comando); ventanaAnterior = anterior; IDAnterior = Convert.ToInt32(ID); esBorrador = valor; actualizar = true; esSubasta = false; comando = "select * from THE_GRID.Publicacion where ID_Publicacion ="+ID; datosPublicacionViejos = TG.realizarConsulta(comando); richTextBox1.Text = datosPublicacionViejos.Rows[0]["Descripcion"].ToString(); numericUpDown1.Value = Convert.ToDecimal(datosPublicacionViejos.Rows[0]["Stock"].ToString()); txtPrecio.Text =datosPublicacionViejos.Rows[0]["Precio"].ToString(); stockOriginal = numericUpDown1.Value; if (datosPublicacionViejos.Rows[0]["ID_Tipo"].ToString() == "100") radioCompra.Checked = true; else radioSubasta.Checked = true; datosPublicacionViejos.Rows[0]["ID_Tipo"].ToString(); if (Convert.ToBoolean(datosPublicacionViejos.Rows[0]["Permitir_Preguntas"].ToString())) preguntasComboBox.SelectedIndex = preguntasComboBox.FindStringExact("SI"); else preguntasComboBox.SelectedIndex = preguntasComboBox.FindStringExact("NO"); comando = "select * from THE_GRID.Visibilidad where ID_Visibilidad="+datosPublicacionViejos.Rows[0]["ID_Visibilidad"].ToString(); DataTable visibilidadAntigua= TG.realizarConsulta(comando); if(Convert.ToBoolean(visibilidadAntigua.Rows[0]["Inhabilitado"])) TG.ventanaEmergente("La visibilidad que usted habia seleccionado ya no es ta disponible, elija otra por favor"); else visibilidadComboBox1.SelectedIndex = visibilidadComboBox1.FindStringExact(visibilidadAntigua.Rows[0]["Nombre"].ToString()); botonPublicar.Text = "Actualizar"; if (!esBorrador) radioCompra.Enabled = radioSubasta.Enabled = txtPrecio.Enabled = visibilidadComboBox1.Enabled = preguntasComboBox.Enabled = txtRubro.Enabled = botonBorrador.Enabled = false; else botonPublicar.Text = "Publicar Borrador"; comando = "select * from THE_GRID.Rubros_x_Publicacion where ID_Publicacion=" + IDAnterior.ToString(); DataTable rubrosViejos = TG.realizarConsulta(comando); RubrosSeleccionados.rubros.Clear(); foreach(DataRow row in rubrosViejos.Rows) { comando = "select Nombre from THE_GRID.Rubro where ID_Rubro=" +row["ID_Rubro"].ToString(); DataTable rubrosViejosNombre=TG.realizarConsulta(comando); RubrosSeleccionados.rubros.Add(rubrosViejosNombre.Rows[0]["Nombre"].ToString()); } if (RubrosSeleccionados.rubros.Count > 0) foreach (string rubro in RubrosSeleccionados.rubros) { textBox1.Text = textBox1.Text + "<" + rubro + ">"; } comando = @"select COUNT(*) from THE_GRID.Publicacion p inner join THE_GRID.Estado_Publicacion e on e.ID_Estado = p.ID_Estado and e.Nombre = 'Publicada' inner join THE_GRID.Visibilidad v on v.ID_Visibilidad = p.ID_Visibilidad and v.Precio_Por_Publicar = 0 and v.Porcentaje_Venta = 0 where Facturada = 0 and ID_Vendedor = " + DatosUsuario.usuario; cantGratuitas = Convert.ToInt32(TG.consultaEscalar(comando).ToString()); labelActivas.Text += cantGratuitas; }
private async void SaveRolBT_Click(object sender, RoutedEventArgs e) { NewRolBT.Focus(); if (RolNameTX.Text.Length == 0 || RolNameTX.Text.Length < 5) { MessageBox.Show("El nombre del rol no puede estar en blanco o ser inferior a 5 caracteres"); RolNameTX.Focus(); return; } //Get rol parameters var Data = new rolData(); Data.id = SelectedIndex; Data.name = RolNameTX.Text; Data.description = RolDescriptTX.Text; //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APIRoles.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APIRoles.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On role modified NovaAPI.APIRoles.userrols.Find(x => x.rolid == Data.id).rolname = Data.name; NovaAPI.APIRoles.userrols.Find(x => x.rolid == Data.id).roldescription = Data.description; RolGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); SaveBT.IsEnabled = false; } else { //On new rol created response var newRol = new NovaAPI.APIRoles.Rols(); newRol.rolname = Data.name; newRol.roldescription = Data.description; newRol.rolid = NovaAPI.APIRoles.LastID; newRol.usercount = "0"; //CREATE ROL DEFAULT PERMISSION DATA FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); NovaAPI.APIRoles.userrols.Add(newRol); //Reload rol data LoadData(); SaveBT.IsEnabled = false; } } else { MessageBox.Show($"Error al crear el rol, INFO: {Environment.NewLine}{NovaAPI.APIRoles.Message}"); } }
/// <summary> /// Save user information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void SaveBT_Click(object sender, RoutedEventArgs e) { NewUserBT.Focus(); if (UserNameTX.Text.Length == 0 || UserNameTX.Text.Length < 5) { MessageBox.Show("El nombre de usuario no puede estar en blanco o ser inferior a 5 caracteres"); UserNameTX.Focus(); return; } else if (UserPassword.Password.Length == 0 || UserPassword.Password.Length < 5) { MessageBox.Show("la contraseña no puede estar en blanco o ser inferior a 5 caracteres"); UserPassword.Focus(); return; } //Get/Set user parameters var Data = new NovaAPI.APIUsers.UsersClass(); Data.id = SelectedIndex; Data.name = UserNameTX.Text; Data.realname = UserRealTX.Text; Data.rolid = ((NovaAPI.APIRoles.Rols)UserRolCB.SelectedItem).rolid; Data.branchid = ((NovaAPI.APIBranch.BranchClass)UserBranchCB.SelectedItem).id; Data.status = UserStatusCB.IsChecked == true ? "1" : "0"; //Password logic if (CheckPassword.Visibility == Visibility.Visible) { Data.hash = GeneralFunctions.GenerateMD5(UserPassword.Password); } //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APIUsers.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APIUsers.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On user modified var UserData = NovaAPI.APIUsers.users.Find(x => x.id == Data.id); UserData.name = Data.name; UserData.realname = Data.realname; UserData.branchid = Data.branchid; UserData.branchname = NovaAPI.APIBranch.branch.Find(x => x.id == Data.branchid).name; UserData.rolid = Data.rolid; UserData.rolname = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Data.rolid).rolname; UserData.status = Data.status; UsersGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } else { //On new user created response var UserData = new NovaAPI.APIUsers.UsersClass(); UserData.name = Data.name; UserData.realname = Data.realname; UserData.branchid = Data.branchid; UserData.branchname = NovaAPI.APIBranch.branch.Find(x => x.id == Data.branchid).name; UserData.rolid = Data.rolid; UserData.rolname = NovaAPI.APIRoles.userrols.Find(x => x.rolid == Data.rolid).rolname; UserData.status = Data.status; UserData.id = NovaAPI.APIUsers.LastID; FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); NovaAPI.APIUsers.users.Add(UserData); //Reload rol data LoadData(); } } else { MessageBox.Show($"Error al crear el usuario, INFO: {Environment.NewLine}{NovaAPI.APIUsers.Message}"); } }
private async void SaveProductBT_Click(object sender, RoutedEventArgs e) { NewProductBT.Focus(); if (ProductCodeTX.Text.Length == 0) { MessageBox.Show("El codigo del producto no puede estar en blanco"); ProductCodeTX.Focus(); return; } else if (ProductNameTX.Text.Length == 0 || ProductNameTX.Text.Length < 5) { MessageBox.Show("El nombre del producto no puede estar en blanco o ser inferior a 5 caracteres"); ProductNameTX.Focus(); return; } //Get/Set product parameters var Data = new NovaAPI.APIProdructs.ProductClass(); Data.id = ProductSelectIndex; Data.code = ProductCodeTX.Text; Data.name = ProductNameTX.Text; Data.category = ((NovaAPI.APICategory.CategoryClass)ProductCatCB.SelectedItem).id; Data.costprice = ProductCostTX.Number.ToString(); Data.sellprice = ProductPriceTX.Number.ToString(); Data.minstock = MinStockTX.Text; Data.maxstock = MaxStockTX.Text; Data.unity_type = ProductTypeCB.SelectedIndex.ToString(); Data.hproduct = H; Data.iva = TaxIvaRB.IsChecked == true ? "1" : "0"; Data.iac = TaxIacRB.IsChecked == true ? "1" : "0"; Data.iva5 = TaxIva5RB.IsChecked == true ? "1" : "0"; //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APIProdructs.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APIProdructs.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On Product modified var ProductData = NovaAPI.APIProdructs.products.Find(x => x.id == Data.id); ProductData.code = Data.code; ProductData.name = Data.name; ProductData.category = Data.category; ProductData.costprice = Data.costprice; ProductData.sellprice = Data.sellprice; ProductData.minstock = Data.minstock; ProductData.maxstock = Data.maxstock; ProductData.unity_type = Data.unity_type; ProductData.iac = Data.iac; ProductData.iva5 = Data.iva5; ProductData.iva = Data.iva; ProductsGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } else { //On new produict created response var ProductData = new NovaAPI.APIProdructs.ProductClass(); ProductData.code = Data.code; ProductData.name = Data.name; ProductData.category = Data.category; ProductData.costprice = Data.costprice; ProductData.sellprice = Data.sellprice; ProductData.minstock = Data.minstock; ProductData.maxstock = Data.maxstock; ProductData.iac = Data.iac; ProductData.iva5 = Data.iva5; ProductData.iva = Data.iva; ProductData.unity_type = Data.unity_type; ProductData.id = NovaAPI.APIProdructs.LastID; FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); NovaAPI.APIProdructs.products.Add(ProductData); //reset pagination TotalPages = 0; Pagination = 1; //Reload product data LoadProducts(null, ProductData.code); } } else { MessageBox.Show($"Error al crear el producto, INFO: {Environment.NewLine}{NovaAPI.APIProdructs.Message}"); } }
//Save client private async void SaveBT_Click(object sender, RoutedEventArgs e) { NewClientBT.Focus(); if (ClientNameTX.Text.Length == 0) { MessageBox.Show("El nombre del cliente no puede estar en blanco"); ClientNameTX.Focus(); return; } //Get/Set client parameters var Data = new NovaAPI.APIClient.ClientClass(); Data.id = SelectedIndex; Data.name = ClientNameTX.Text; Data.type = ClientTypeCB.SelectedIndex.ToString(); Data.documentid = ClientIDTX.Text; Data.phone = ClientPhoneTX.Text; Data.celphone = ClientCelphoneTX.Text; Data.mail = ClientMailTX.Text; Data.address = ClientAddressTX.Text; Data.cancredit = ClientCreditCB.IsChecked == true ? "1" : "0"; //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APIClient.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APIClient.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On client modified var ClientData = NovaAPI.APIClient.clients.Find(x => x.id == Data.id); ClientData.name = Data.name; ClientData.documentid = Data.documentid; ClientData.type = Data.type; ClientData.address = Data.address; ClientData.phone = Data.phone; ClientData.mail = Data.mail; ClientData.celphone = Data.celphone; ClientData.cancredit = Data.cancredit; ClientGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ClearFormData(); } else { //On new supplier created response var ClientData = new NovaAPI.APIClient.ClientClass(); ClientData.name = Data.name; ClientData.documentid = Data.documentid; ClientData.type = Data.type; ClientData.address = Data.address; ClientData.phone = Data.phone; ClientData.mail = Data.mail; ClientData.celphone = Data.celphone; ClientData.cancredit = Data.cancredit; ClientData.id = NovaAPI.APIClient.LastID; FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ClearFormData(); NovaAPI.APIClient.clients.Add(ClientData); //Reload rol data LoadClients(); } } else { MessageBox.Show($"Error al crear el cliente, INFO: {Environment.NewLine}{NovaAPI.APIClient.Message}"); } }
//Supplier create / modify functions private async void SaveBT_Click(object sender, RoutedEventArgs e) { NewSupplierBT.Focus(); if (SuppSocialNameTX.Text.Length == 0 || SuppSocialNameTX.Text.Length < 5) { MessageBox.Show("La razón social no puede estar en blanco o ser inferior a 5 caracteres"); SuppSocialNameTX.Focus(); return; } else if (SuppIDTX.Text.Length == 0 || SuppIDTX.Text.Length < 5) { MessageBox.Show("El numero de identificacion no puede estar en blanco o ser inferior a 5 caracteres"); SuppIDTX.Focus(); return; } //Get/Set Supplier parameters var Data = new NovaAPI.APISupplier.SupplierClass(); Data.id = SelectedIndex; Data.socialname = SuppSocialNameTX.Text; Data.comercialname = SuppComercialNameTX.Text.Length == 0 ? SuppSocialNameTX.Text : SuppComercialNameTX.Text; Data.idtype = SuppidTypeCB.SelectedIndex.ToString(); Data.documentid = SuppIDTX.Text; Data.address = SuppAddressTX.Text; Data.mail = SuppEmailTX.Text; Data.phone = SuppPhoneTX.Text; Data.celphone = SuppCelphoneTX.Text; Data.contact = SuppContactTX.Text; Data.observation = SuppObvsTX.Text; Data.status = StatusCB.IsChecked == true ? "1" : "0"; //rol json data string requestData = JsonConvert.SerializeObject(Data); bool response; //Modify / Create request if (Data.id.Length > 0) { response = await NovaAPI.APISupplier.GetValues("2", DataConfig.LocalAPI, requestData); } else { response = await NovaAPI.APISupplier.GetValues("1", DataConfig.LocalAPI, requestData); } //Request response if (response) { if (Data.id.Length > 0) { //On supplier modified var SuppData = NovaAPI.APISupplier.suppliers.Find(x => x.id == Data.id); SuppData.socialname = Data.socialname; SuppData.comercialname = Data.comercialname; SuppData.idtype = Data.idtype; SuppData.documentid = Data.documentid; SuppData.address = Data.address; SuppData.mail = Data.mail; SuppData.phone = Data.phone; SuppData.celphone = Data.celphone; SuppData.contact = Data.contact; SuppData.observation = Data.observation; SuppData.status = Data.status; SuppliersGrid.Items.Refresh(); FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); } else { //On new supplier created response var SuppData = new NovaAPI.APISupplier.SupplierClass(); SuppData.socialname = Data.socialname; SuppData.comercialname = Data.comercialname; SuppData.idtype = Data.idtype; SuppData.documentid = Data.documentid; SuppData.address = Data.address; SuppData.mail = Data.mail; SuppData.phone = Data.phone; SuppData.celphone = Data.celphone; SuppData.contact = Data.contact; SuppData.status = Data.status; SuppData.observation = Data.observation; SuppData.id = NovaAPI.APISupplier.LastID; FormGrid.BeginStoryboard((Storyboard)Application.Current.TryFindResource("FadeInGrid")); ResetForm(); NovaAPI.APISupplier.suppliers.Add(SuppData); //Reload rol data LoadData(); } } else { MessageBox.Show($"Error al crear el proveedor, INFO: {Environment.NewLine}{NovaAPI.APISupplier.Message}"); } }