public DataSet GetAll_DET(string empresaid, tb_me_proyeccion BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeProyeccion_SEARCH_DET", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.anio; cmd.Parameters.Add("@temporadaid", SqlDbType.Char, 1).Value = BE.temporadaid; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Delete(string empresaid, tb_me_proyeccion BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeProyeccion_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@perinanio", SqlDbType.Char, 4).Value = BE.anio; cmd.Parameters.Add("@temporadaid", SqlDbType.Char, 1).Value = BE.temporadaid; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void Mdi_dgv_tiendalist_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) { tb_me_proyeccion BE = new tb_me_proyeccion(); //BE.anio = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "perianio").ToString(); //BE.temporadaid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "temporadaid").ToString(); //BE.canalventaid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "canalventaid").ToString(); //BE.marcaid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "marcaid").ToString(); //BE.lineaid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "lineaid").ToString(); //BE.entalleid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "entalleid").ToString(); //BE.generoid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "generoid").ToString(); //BE.lineatelaid = dgv_proyeccion.GetRowCellValue(dgv_proyeccion.FocusedRowHandle, "lineatelaid").ToString(); Data_ProyDet(BE); } }
private void dgv_tiendalist_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { tb_me_proyeccion BE = new tb_me_proyeccion(); //BE.anio = dgv_proyeccion.GetRowCellValue(e.RowHandle, "perianio").ToString(); //BE.temporadaid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "temporadaid").ToString(); //BE.canalventaid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "canalventaid").ToString(); //BE.marcaid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "marcaid").ToString(); //BE.lineaid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "lineaid").ToString(); //BE.entalleid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "entalleid").ToString(); //BE.generoid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "generoid").ToString(); //BE.lineatelaid = dgv_proyeccion.GetRowCellValue(e.RowHandle, "lineatelaid").ToString(); Data_ProyDet(BE); }
private void Data_ProyDet(tb_me_proyeccion BE) { var rowproydet = TablaOrdenProdColor.Select(" perianio ='" + BE.anio + "' and temporadaid = '" + BE.temporadaid + "' and canalventaid = '" + BE.canalventaid + "' and " + " marcaid = '" + BE.marcaid + "' and lineaid = '" + BE.lineaid + "' and entalleid = '" + BE.entalleid + "' and generoid = '" + BE.generoid + "' and " + " lineatelaid = '" + BE.lineatelaid + "' "); if (rowproydet.Length > 0) { foreach (DataRow row in rowproydet) { //cmb_marcaid.SelectedValue = row["marcaid"].ToString(); //cmb_lineaid.SelectedValue = row["lineaid"].ToString(); //cmb_entalleid.SelectedValue = row["entalleid"].ToString(); //cmb_generoid.SelectedValue = row["generoid"].ToString(); //cmb_lineatelaid.SelectedValue = row["lineatelaid"].ToString(); //txt_01.Text = row["cantmod01"].ToString(); //txt_02.Text = row["cantmod02"].ToString(); //txt_03.Text = row["cantmod03"].ToString(); //txt_04.Text = row["cantmod04"].ToString(); //txt_05.Text = row["cantmod05"].ToString(); //txt_06.Text = row["cantmod06"].ToString(); //txt_totmodels.Text = row["canttotal"].ToString(); //txt_profun.Text = row["profundidad"].ToString(); //txt_totprendas.Text = row["totalprendas"].ToString(); //btn_editar.Enabled = true; } } }
private void Insert() { try { tb_me_proyeccionBL BL = new tb_me_proyeccionBL(); tb_me_proyeccion BE = new tb_me_proyeccion(); var Detalle = new tb_me_proyeccion.Item(); var ListaItems = new List<tb_me_proyeccion.Item>(); BE.anio = cmb_perianio.SelectedValue.ToString(); BE.temporadaid = cmb_temporadaid.SelectedValue.ToString(); BE.canalventaid = cmb_canalvta.SelectedValue.ToString(); BE.cantmod01 = Convert.ToInt32(txt_cantmod01.Text); BE.cantmod02 = Convert.ToInt32(txt_cantmod02.Text); BE.cantmod03 = Convert.ToInt32(txt_cantmod03.Text); BE.cantmod04 = Convert.ToInt32(txt_cantmod04.Text); BE.cantmod05 = Convert.ToInt32(txt_cantmod05.Text); BE.cantmod06 = Convert.ToInt32(txt_cantmod06.Text); BE.canttotal = Convert.ToInt32(txt_canttotalcab.Text); BE.totalprendas = Convert.ToInt32(txt_totalprendascab.Text); BE.status = rb_status.EditValue.ToString(); BE.usuar = VariablesPublicas.Usuar.Trim().ToUpper(); var item = 0; foreach (DataRow fila in TablaProyeccion.Rows) { Detalle = new tb_me_proyeccion.Item(); item++; Detalle.anio = cmb_perianio.SelectedValue.ToString(); Detalle.temporadaid = cmb_temporadaid.SelectedValue.ToString(); Detalle.canalventaid = cmb_canalvta.SelectedValue.ToString(); Detalle.marcaid = fila["marcaid"].ToString(); Detalle.lineaid = fila["lineaid"].ToString(); Detalle.entalleid = fila["entalleid"].ToString(); Detalle.generoid = fila["generoid"].ToString(); Detalle.lineatelaid = fila["lineatelaid"].ToString(); Detalle.cantmod01 = Convert.ToInt32(fila["cantmod01"].ToString()); Detalle.cantmod02 = Convert.ToInt32(fila["cantmod02"].ToString()); Detalle.cantmod03 = Convert.ToInt32(fila["cantmod03"].ToString()); Detalle.cantmod04 = Convert.ToInt32(fila["cantmod04"].ToString()); Detalle.cantmod05 = Convert.ToInt32(fila["cantmod05"].ToString()); Detalle.cantmod06 = Convert.ToInt32(fila["cantmod06"].ToString()); Detalle.canttotal = Convert.ToInt32(fila["canttotal"].ToString()); Detalle.profundidad = Convert.ToInt32(fila["profundidad"].ToString()); Detalle.totalprendas = Convert.ToInt32(fila["totalprendas"].ToString()); if (Convert.ToInt32(fila["cantmod01"]) > 0 && Convert.ToInt32(fila["cantmod02"]) > 0 && Convert.ToInt32(fila["cantmod03"]) > 0 && Convert.ToInt32(fila["cantmod04"]) > 0 && Convert.ToInt32(fila["cantmod05"]) > 0 && Convert.ToInt32(fila["cantmod06"]) > 0) { ListaItems.Add(Detalle); } else { MessageBox.Show("Documento DETALLE EN FORMATO INCORRECTO !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (ListaItems.Count == 0) { MessageBox.Show("Documento SIN DETALLE Y/O DETALLE INCORRECTO !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BE.ListaItems = ListaItems; if (BL.Insert(EmpresaID, BE)) { MessageBox.Show("Datos Grabados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Delete() { try { tb_me_proyeccionBL BL = new tb_me_proyeccionBL(); tb_me_proyeccion BE = new tb_me_proyeccion(); BE.anio = cmb_perianio.SelectedValue.ToString(); BE.temporadaid = cmb_temporadaid.SelectedValue.ToString(); BE.canalventaid = cmb_canalvta.SelectedValue.ToString(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos Eliminado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); limpiar_documento(); form_bloqueado(false); //CargarDatos(); btn_nuevo.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void CargarDatos() { if (cmb_perianio.SelectedIndex != -1 && cmb_temporadaid.SelectedIndex != -1 && cmb_canalvta.SelectedIndex != -1) { tb_me_proyeccionBL BL = new tb_me_proyeccionBL(); tb_me_proyeccion BE = new tb_me_proyeccion(); DataTable dt = new DataTable(); BE.anio = cmb_perianio.SelectedValue.ToString(); BE.temporadaid = cmb_temporadaid.SelectedValue.ToString(); BE.canalventaid = cmb_canalvta.SelectedValue.ToString(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { txt_cantmod01.Text = dt.Rows[0]["cantmod01"].ToString(); txt_cantmod02.Text = dt.Rows[0]["cantmod02"].ToString(); txt_cantmod03.Text = dt.Rows[0]["cantmod03"].ToString(); txt_cantmod04.Text = dt.Rows[0]["cantmod04"].ToString(); txt_cantmod05.Text = dt.Rows[0]["cantmod05"].ToString(); txt_cantmod06.Text = dt.Rows[0]["cantmod06"].ToString(); txt_totalprendascab.Text = dt.Rows[0]["totalprendas"].ToString(); txt_canttotalcab.Text = dt.Rows[0]["canttotal"].ToString(); rb_status.EditValue = dt.Rows[0]["status"].ToString(); CargamosDetalle(BE); btn_editar.Enabled = true; } else { nuevo2(); } } }
void CargamosDetalle(tb_me_proyeccion BE) { tb_me_proyeccionBL BL = new tb_me_proyeccionBL(); ArmadoTablasTmp(); TablaProyeccion = BL.GetAll_DET(EmpresaID, BE).Tables[0]; Mdi_dgv_proyeccion.DataSource = TablaProyeccion; CalculosTotales(); }
public bool Update(string empresaid, tb_me_proyeccion BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeProyeccion_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.anio; cmd.Parameters.Add("@temporadaid", SqlDbType.Char, 1).Value = BE.temporadaid; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; cmd.Parameters.Add("@cantmod01", SqlDbType.Int).Value = BE.cantmod01; cmd.Parameters.Add("@cantmod02", SqlDbType.Int).Value = BE.cantmod02; cmd.Parameters.Add("@cantmod03", SqlDbType.Int).Value = BE.cantmod03; cmd.Parameters.Add("@cantmod04", SqlDbType.Int).Value = BE.cantmod04; cmd.Parameters.Add("@cantmod05", SqlDbType.Int).Value = BE.cantmod05; cmd.Parameters.Add("@cantmod06", SqlDbType.Int).Value = BE.cantmod06; cmd.Parameters.Add("@canttotal", SqlDbType.BigInt).Value = BE.canttotal; cmd.Parameters.Add("@totalprendas", SqlDbType.BigInt).Value = BE.totalprendas; cmd.Parameters.Add("@status", SqlDbType.Char, 2).Value = BE.status; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; cmd.Parameters.Add("@XML", SqlDbType.Xml).Value = BE.GetItemXML(); } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_me_proyeccion BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_me_proyeccion BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll_DET(string empresaid, tb_me_proyeccion BE) { return tablaDA.GetAll_DET(empresaid, BE); }