/// <summary> /// OBTENER EL RESULTADO DE CUALQUIER CONSULTA /// </summary> /// <param name="oBe"></param> /// <returns></returns> public List<BEWarehouse> Get_SVPR_ALMA_LIST(BEWarehouse oBe) { try { using (IDataReader oDr = oda.Get_SVPR_ALMA_LIST(oBe)) { List<BEWarehouse> oList = new List<BEWarehouse>(); IList iList = oList; ((IList)iList).LoadFromReader<BEWarehouse>(oDr); Dispose(false); return (oList); } } catch (Exception ex) { throw new ArgumentException(ex.Message); } }
public IDataReader Get_SVPR_ALMA_LIST(BEWarehouse oBe) { try { if (ocn.State == ConnectionState.Closed) ocn.Open(); var ocmd = odb.GetStoredProcCommand("SVPR_ALMA_LIST", oBe.COD_ALMA, oBe.COD_COMP, oBe.ALF_ALMA, oBe.ALF_DESC, oBe.COD_SOCI_NEGO_ENCA, oBe.COD_USUA_CREA, oBe.COD_USUA_MODI, oBe.NUM_ACCI ); ocmd.CommandTimeout = 2000; var odr = odb.ExecuteReader(ocmd); Dispose(false); return (odr); } finally { ocn.Close(); } }
public void Set_SVPR_ALMA(BEWarehouse oBe) { if (ocn.State == ConnectionState.Closed) ocn.Open(); using (var obts = ocn.BeginTransaction()) { try { using (var ocmd = odb.GetStoredProcCommand("SVPR_ALMA", oBe.COD_ALMA, oBe.COD_COMP, oBe.ALF_ALMA, oBe.ALF_DESC, oBe.COD_SOCI_NEGO_ENCA, oBe.COD_USUA_CREA, oBe.COD_USUA_MODI, oBe.NUM_ACCI)) { ocmd.CommandTimeout = 2000; odb.ExecuteNonQuery(ocmd, obts); oBe.COD_ALMA = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_ALMA")); obts.Commit(); } } catch (Exception ex) { obts.Rollback(); throw new ArgumentException(ex.Message); } finally { ocn.Close(); } } }
/// <summary> /// Mantenimiento de almacenes. /// Inserta, Modifica y Elimina /// </summary> public void Set_PSGN_SPMT_SVMC_ALMA(BEWarehouse obej, List<BEWarehouse> olst) { if (ocn.State == ConnectionState.Closed) ocn.Open(); using (var obts = ocn.BeginTransaction()) { try { DbCommand ocmd; olst.Where(item => item.IND_MNTN != 0) .ToList() .ForEach(item => { using (ocmd = odb.GetStoredProcCommand("PSGN_SPMT_SVMC_ALMA", item.COD_ALMA, item.ALF_ALMA, item.ALF_DESC, item.COD_SOCI_NEGO_ENCA, item.COD_COMP, item.COD_USUA_CREA, item.COD_USUA_MODI, item.IND_MNTN)) { ocmd.CommandTimeout = 2000; odb.ExecuteNonQuery(ocmd, obts); item.COD_ALMA = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_ALMA")); } }); obts.Commit(); } catch (Exception ex) { obts.Rollback(); obej.MSG_MNTN = ex.Message; } finally { ocn.Close(); } } }
public void Save() { try { if (string.IsNullOrEmpty(txtALF_ALMA.Text)) throw new ArgumentException("Ingrese el nombre para el almacén"); if (lueCOD_SOCI_NEGO_ENCA.EditValue == null) throw new ArgumentException("Seleccione el encargado"); var oBe = new BEWarehouse(); var oBr = new BRWarehouse(); if (!string.IsNullOrEmpty(txtCOD_ALMA.Text)) { oBe.NUM_ACCI = 2; oBe.COD_ALMA = Convert.ToInt32(txtCOD_ALMA.Text); } else { oBe.NUM_ACCI = 1; } oBe.ALF_ALMA = txtALF_ALMA.Text; oBe.ALF_DESC = meALF_DESC.Text; oBe.COD_SOCI_NEGO_ENCA = Convert.ToInt32(lueCOD_SOCI_NEGO_ENCA.EditValue); oBe.COD_COMP = SESSION_COMP; oBe.COD_USUA_CREA = SESSION_USER; oBe.COD_USUA_MODI = SESSION_USER; oBr.Set_SVPR_ALMA(oBe); var oBeU = new BEWarehouse(); var oBrU = new BRWarehouse(); oBeU.COD_COMP = SESSION_COMP; oBeU.NUM_ACCI = 4; var oListWarehouse = oBrU.Get_SVPR_ALMA_LIST(oBeU); gdcWarehouse.DataSource = oListWarehouse; StateControl(true); XtraMessageBox.Show("Operacion realizada con exito!!!!", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void xfWarehouseMaster_Load(object sender, EventArgs e) { SESSION_USER = ((xfMain)MdiParent).SESSION_USER; SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF; SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP; var oBe = new BESVMC_SOCI_NEGO(); var oBr = new BRSVMC_SOCI_NEGO(); oBe.NUM_ACCI = 7; oBe.COD_COMP = SESSION_COMP; var oList = oBr.Get_SVPR_SOCI_NEGO_LIST(oBe); lueCOD_SOCI_NEGO_ENCA.Properties.DataSource = oList; lueCOD_SOCI_NEGO_ENCA.Properties.Columns.Clear(); lueCOD_SOCI_NEGO_ENCA.Properties.Columns.Add(new LookUpColumnInfo("ALF_NOMB", 100, "Empleados")); lueCOD_SOCI_NEGO_ENCA.Properties.DisplayMember = "ALF_NOMB"; lueCOD_SOCI_NEGO_ENCA.Properties.ValueMember = "COD_SOCI_NEGO"; var oBeU = new BEWarehouse(); var oBrU = new BRWarehouse(); oBeU.COD_COMP = SESSION_COMP; oBeU.NUM_ACCI = 4; var oListWarehouse = oBrU.Get_SVPR_ALMA_LIST(oBeU); gdcWarehouse.DataSource = oListWarehouse; StateControl(true); }
private void Set_Save() { MessageBoxIcon msgIcon = MessageBoxIcon.Warning; try { gdvGeneric.CloseEditor(); gdvGeneric.RefreshData(); var olst = (List<BEWarehouse>)gdvGeneric.DataSource; var i = 1; olst.ForEach(item => { var context = new ValidationContext(item, null, null); var errors = new List<ValidationResult>(); if (!Validator.TryValidateObject(item, context, errors, true)) { foreach (ValidationResult result in errors) { msgIcon = MessageBoxIcon.Warning; throw new ArgumentException(string.Format("{0}\nFila: {1}", result.ErrorMessage, i)); } } i++; }); var obr = new BRWarehouse(); var obej = new BEWarehouse(); olst.ForEach(item => item.COD_COMP = SESSION_COMP); obr.Set_PSGN_SPMT_SVMC_ALMA(obej, olst); if (!string.IsNullOrWhiteSpace(obej.MSG_MNTN)) { msgIcon = MessageBoxIcon.Error; throw new ArgumentException(obej.MSG_MNTN); } olst.RemoveAll(item => item.IND_MNTN == 3); olst.ForEach(item => item.IND_MNTN = 0); gdvGeneric.RefreshData(); XtraMessageBox.Show(WhMessage.MsgSuccessfully, WhMessage.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption, MessageBoxButtons.OK, msgIcon); } }
private void Set_Operation(int index) { try { if (index == 0) { gdvGeneric.CloseEditor(); gdvGeneric.RefreshData(); var olst = (List<BEWarehouse>)gdvGeneric.DataSource; var i = 1; olst.ForEach(obej => { var context = new ValidationContext(obej, null, null); var errors = new List<ValidationResult>(); if (!Validator.TryValidateObject(obej, context, errors, true)) { foreach (ValidationResult result in errors) throw new ArgumentException(string.Format("{0}\nFila: {1}", result.ErrorMessage, i)); } i++; }); var obj = new BEWarehouse() { IND_MNTN = 1, COD_USUA_CREA = SESSION_USER }; olst.Add(obj); gdvGeneric.RefreshData(); gdvGeneric.MoveLast(); gdvGeneric.FocusedColumn = gcALF_ALMA; gdvGeneric.ShowEditor(); } else if (index == 1) { var row = (BEWarehouse)gdvGeneric.GetRow(gdvGeneric.FocusedRowHandle); if (row.IND_MNTN != 0 && row.IND_MNTN != 3) { gdvGeneric.DeleteRow(gdvGeneric.FocusedRowHandle); } else { row.COD_USUA_MODI = SESSION_USER; row.IND_MNTN = 3; } gdvGeneric.RefreshData(); } else { gdvGeneric.CloseEditor(); gdvGeneric.RefreshData(); if (gdvGeneric.RowCount == 0) return; using (var osfl = new SaveFileDialog { Title = WhMessage.MsgSelFile, Filter = WhMessage.MsgFilExport, ValidateNames = true }) { if (osfl.ShowDialog() != DialogResult.OK) return; gdvGeneric.ExportToXlsx(osfl.FileName); if (XtraMessageBox.Show(WhMessage.MsgConExport, WhMessage.MsgInsCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) System.Diagnostics.Process.Start(osfl.FileName); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Get_Load() { var obr = new BRWarehouse(); var olen = obr.Get_PSGN_SPLS_SVMC_SOCI_NEGO(SESSION_COMP); rilCOD_SOCI_NEGO_ENCA.DataSource = olen; rilCOD_SOCI_NEGO_ENCA.Columns.Clear(); var lkci = new LookUpColumnInfo("ALF_NOMB", "Encargados", 20); rilCOD_SOCI_NEGO_ENCA.Columns.Add(lkci); rilCOD_SOCI_NEGO_ENCA.DisplayMember = "ALF_NOMB"; rilCOD_SOCI_NEGO_ENCA.ValueMember = "COD_SOCI_NEGO"; var olst = obr.Get_PSGN_SPLS_SVMC_ALMA(SESSION_COMP); if (olst.Count == 0) { var obj = new BEWarehouse() { IND_MNTN = 1, COD_USUA_CREA = SESSION_USER }; olst.Add(obj); } gdcGeneric.DataSource = olst; BeginInvoke(new MethodInvoker(() => { gdvGeneric.MoveLast(); gdvGeneric.FocusedColumn = gdvGeneric.VisibleColumns[1]; gdvGeneric.ShowEditor(); })); }
/// <summary> /// REALIZAR OPERACIONES DE MANTENIMIENTO /// </summary> /// <param name="oBe"></param> public void Set_SVPR_ALMA(BEWarehouse oBe) { try { oda.Set_SVPR_ALMA(oBe); Dispose(false); } catch (Exception ex) { throw new ArgumentException(ex.Message); } }
/// <summary> /// Mantenimiento de almacenes. /// Inserta, Modifica y Elimina /// </summary> public void Set_PSGN_SPMT_SVMC_ALMA(BEWarehouse obej, List<BEWarehouse> olst) { oda.Set_PSGN_SPMT_SVMC_ALMA(obej, olst); Dispose(false); }