Example #1
0
        private void Get_Load()
        {
            var obrtm = new BRTypeReason();
            var oltm = obrtm.Get_PSGN_SPLS_SVMC_TIPO_MOTI();
            rilCOD_TIPO_MOTI.DataSource = oltm;
            rilCOD_TIPO_MOTI.Columns.Clear();
            var lkci = new LookUpColumnInfo("ALF_TIPO_MOTI", "Tipos de Motivo", 20);
            rilCOD_TIPO_MOTI.Columns.Add(lkci);
            rilCOD_TIPO_MOTI.DisplayMember = "ALF_TIPO_MOTI";
            rilCOD_TIPO_MOTI.ValueMember = "COD_TIPO_MOTI";

            var obr = new BRReason();
            var olst = obr.Get_PSGN_SPLS_SVMC_MOTI(xfMain.SgIns.SESSION_COMP);
            if (olst.Count == 0)
            {
                var obj = new BEReason() { IND_MNTN = 1, COD_USUA_CREA = xfMain.SgIns.SESSION_USER };
                olst.Add(obj);
            }
            gdcGeneric.DataSource = olst;

            BeginInvoke(new MethodInvoker(() =>
            {
                gdvGeneric.MoveLast();
                gdvGeneric.FocusedColumn = gdvGeneric.VisibleColumns[1];
                gdvGeneric.ShowEditor();
            }));
        }
Example #2
0
 /// <summary>
 /// REALIZAR OPERACIONES DE MANTENIMIENTO
 /// </summary>
 /// <param name="oBe"></param>
 public void Set_SVPR_MOTI(BEReason oBe)
 {
     try
     {
         oDa.Set_SVPR_MOTI(oBe);
         Dispose(false);
     }
     catch(Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
Example #3
0
 /// <summary>
 /// OBTENER EL RESULTADO DE CUALQUIER CONSULTA
 /// </summary>
 /// <param name="oBe"></param>
 /// <returns></returns>
 public List<BEReason> Get_SVPR_MOTI_LIST(BEReason oBe)
 {
     try
     {
         using (IDataReader oDr = oDa.Get_SVPR_MOTI_LIST(oBe))
         {
             List<BEReason> oList = new List<BEReason>();
             IList iList = oList;
             ((IList)iList).LoadFromReader<BEReason>(oDr);
             Dispose(false);
             return (oList);
         }
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
Example #4
0
 /// <summary>
 /// Mantenimiento de motivos.
 /// Inserta, Modifica y Elimina
 /// </summary>
 public void Set_PSGN_SPMT_SVMC_MOTI(BEReason obej, List<BEReason> 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_MOTI", item.COD_MOTI,
                                                                                 item.COD_TIPO_MOTI,
                                                                                 item.ALF_MOTI,
                                                                                 item.COD_COMP,
                                                                                 item.COD_USUA_CREA,
                                                                                 item.COD_USUA_MODI,
                                                                                 item.IND_MNTN))
                 {
                     ocmd.CommandTimeout = 2000;
                     odb.ExecuteNonQuery(ocmd, obts);
                     item.COD_MOTI = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_MOTI"));
                 }
             });
             obts.Commit();
         }
         catch (Exception ex)
         {
             obts.Rollback();
             obej.MSG_MNTN = ex.Message;
         }
         finally
         {
             ocn.Close();
         }
     }
 }
        public List<BEReason> Get_SVPR_MOTI(BEReason oBe)
        {
            if (HttpContext.Current.Session["COD_COMP"] == null)
                return new List<BEReason>();

            oBe.COD_COMP = (int)HttpContext.Current.Session["COD_COMP"];
            oBe.COD_TIPO_MOTI = 2;
            var oBr = new BRSVMC_MOTI();
            var oList = oBr.Get_SVPR_MOTI_LIST(oBe);

            return oList;
        }
Example #6
0
 public void Set_SVPR_MOTI(BEReason oBe)
 {
     if (ocn.State == ConnectionState.Closed) ocn.Open();
     using (var obts = ocn.BeginTransaction())
     {
         try
         {
             using (var ocmd = odb.GetStoredProcCommand("SVPR_MOTI",
                                                                 oBe.COD_MOTI,
                                                                 oBe.COD_COMP,
                                                                 oBe.ALF_MOTI,
                                                                 oBe.COD_TIPO_MOTI,
                                                                 oBe.COD_USUA_CREA,
                                                                 oBe.COD_USUA_MODI,
                                                                 oBe.NUM_ACCI))
             {
                 ocmd.CommandTimeout = 2000;
                 odb.ExecuteNonQuery(ocmd, obts);
                 oBe.COD_MOTI = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_MOTI"));
                 obts.Commit();
             }
         }
         catch (Exception ex)
         {
             obts.Rollback();
             throw new ArgumentException(ex.Message);
         }
         finally
         {
             ocn.Close();
         }
     }
 }
Example #7
0
 public IDataReader Get_SVPR_MOTI_LIST(BEReason oBe)
 {
     try
     {
         if (ocn.State == ConnectionState.Closed) ocn.Open();
         var ocmd = odb.GetStoredProcCommand("SVPR_MOTI_LIST",
                                                             oBe.COD_MOTI,
                                                             oBe.COD_COMP,
                                                             oBe.ALF_MOTI,
                                                             oBe.COD_TIPO_MOTI,
                                                             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();
     }
 }
Example #8
0
        private void xfReasonReceiving_Load(object sender, EventArgs e)
        {
            SESSION_USER = ((xfMain)MdiParent).SESSION_USER;
            SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF;
            SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP;

            StateControl(true);
            var oBeC = new BEReason();
            var oBrC = new BRSVMC_MOTI();

            oBeC.NUM_ACCI = 4;
            oBeC.COD_TIPO_MOTI = 4;
            oBeC.COD_COMP = SESSION_COMP;

            var oListC = oBrC.Get_SVPR_MOTI_LIST(oBeC);
            gdcReason.DataSource = oListC;
        }
Example #9
0
        public void Save()
        {
            try
            {
                if (string.IsNullOrEmpty(txtALF_MOTI.Text))
                    throw new ArgumentException("Ingresar nombre para el motivo");

                var oBe = new BEReason();
                var oBr = new BRSVMC_MOTI();

                if (string.IsNullOrEmpty(txtCOD_MOTI.Text))
                {
                    oBe.NUM_ACCI = 1;
                }
                else
                {
                    oBe.NUM_ACCI = 2;
                    oBe.COD_MOTI = Convert.ToInt32(txtCOD_MOTI.Text);
                }

                oBe.ALF_MOTI = txtALF_MOTI.Text;
                oBe.COD_USUA_CREA = SESSION_USER;
                oBe.COD_USUA_MODI = SESSION_USER;
                oBe.COD_COMP = SESSION_COMP;
                oBe.COD_TIPO_MOTI = 4;

                oBr.Set_SVPR_MOTI(oBe);
                txtCOD_MOTI.Text = oBe.COD_MOTI.ToString();
                var oBeC = new BEReason();
                var oBrC = new BRSVMC_MOTI();

                oBeC.NUM_ACCI = 4;
                oBeC.COD_TIPO_MOTI = 4;
                oBeC.COD_COMP = SESSION_COMP;

                var oListC = oBrC.Get_SVPR_MOTI_LIST(oBeC);
                gdcReason.DataSource = oListC;
                StateControl(true);
                XtraMessageBox.Show("Operación realizada con exito!!!", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #10
0
        private void xfQuote_Load(object sender, EventArgs e)
        {
            SESSION_USER = ((xfMain)MdiParent).SESSION_USER;
            SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF;
            SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP;
            SESSION_IMPU = ((xfMain)MdiParent).SESSION_IMPU;
            SESSION_PORC_IMPU = ((xfMain)MdiParent).SESSION_PORC_IMPU;
            lblALF_IMPU.Text = SESSION_IMPU;

            //MONEDAS
            var oBeMo = new BESVMC_MONE();
            var oBrMo = new BRSVMC_MONE();

            oBeMo.NUM_ACCI = 4;
            oBeMo.COD_COMP = SESSION_COMP;
            var oListMo = oBrMo.Get_SVPR_MONE_LIST(oBeMo);

            lueCOD_MONE.Properties.DataSource = oListMo;
            lueCOD_MONE.Properties.Columns.Clear();
            lueCOD_MONE.Properties.Columns.Add(new LookUpColumnInfo("ALF_MONE", 100, "Moneda"));
            lueCOD_MONE.Properties.DisplayMember = "ALF_MONE";
            lueCOD_MONE.Properties.ValueMember = "COD_MONE";
            //PROYECTOS
            var oBePr = new BESVMC_PROY();
            var oBrPr = new BRSVMC_PROY();

            oBePr.NUM_ACCI = 5;
            oBePr.COD_COMP = SESSION_COMP;
            var oListPr = oBrPr.Get_SVPR_PROY_LIST(oBePr);

            lueCOD_PROY.Properties.DataSource = oListPr;
            lueCOD_PROY.Properties.Columns.Clear();
            lueCOD_PROY.Properties.Columns.Add(new LookUpColumnInfo("ALF_PROY", 100, "Proyecto"));
            lueCOD_PROY.Properties.DisplayMember = "ALF_PROY";
            lueCOD_PROY.Properties.ValueMember = "COD_PROY";
            //MOTIVOS
            var oBeM = new BEReason();
            oBeM.COD_COMP = SESSION_COMP;
            oBeM.COD_TIPO_MOTI = 2;
            oBeM.NUM_ACCI = 4;
            var obrmo = new BRSVMC_MOTI();
            var olsmo = obrmo.Get_SVPR_MOTI_LIST(oBeM);
            lkeCOD_MOTI.Properties.DataSource = olsmo;
            lkeCOD_MOTI.Properties.Columns.Clear();
            var lkci = new LookUpColumnInfo("ALF_MOTI", "Motivo", 20);
            lkeCOD_MOTI.Properties.Columns.Add(lkci);
            lkeCOD_MOTI.Properties.DisplayMember = "ALF_MOTI";
            lkeCOD_MOTI.Properties.ValueMember = "COD_MOTI";
            //EJECUTIVO COMERCIAL
            var oBeE = new BESVMC_SOCI_NEGO();
            var oBrE = new BRSVMC_SOCI_NEGO();

            oBeE.NUM_ACCI = 5;
            oBeE.COD_COMP = SESSION_COMP;
            var oListE = oBrE.Get_SVPR_SOCI_NEGO_LIST(oBeE);

            lueCOD_EJEC_COME.Properties.DataSource = oListE;
            lueCOD_EJEC_COME.Properties.Columns.Clear();
            lueCOD_EJEC_COME.Properties.Columns.Add(new LookUpColumnInfo("ALF_NOMB", 100, "Ejecutivo comercial"));
            lueCOD_EJEC_COME.Properties.DisplayMember = "ALF_NOMB";
            lueCOD_EJEC_COME.Properties.ValueMember = "COD_SOCI_NEGO";

            gdcArticles.DataSource = oListArti;
            gdcArticlesGroup.DataSource = oListArtiGroup;
            gdcGroups.DataSource = oListGroup;

            StateControl(true);
        }
Example #11
0
        private void Get_Load()
        {
            SESSION_USER = ((xfMain)MdiParent).SESSION_USER;
            SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF;
            SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP;

            var obral = new BRWarehouse();
            var oBeM = new BEReason();
            oBeM.COD_COMP = SESSION_COMP;
            oBeM.COD_TIPO_MOTI = 2;
            oBeM.NUM_ACCI = 4;
            var obrmo = new BRSVMC_MOTI();

            var olsal = obral.Get_PSGN_SPLS_SVMC_ALMA(SESSION_COMP);
            var olsre = obral.Get_PSGN_SPLS_SVMC_SOCI_NEGO(SESSION_COMP);
            var olsmo = obrmo.Get_SVPR_MOTI_LIST(oBeM);

            lkeCOD_ALMA.Properties.DataSource = olsal;
            lkeCOD_ALMA.Properties.Columns.Clear();
            var lkci = new LookUpColumnInfo("ALF_ALMA", "Almacén", 20);
            lkeCOD_ALMA.Properties.Columns.Add(lkci);
            lkeCOD_ALMA.Properties.DisplayMember = "ALF_ALMA";
            lkeCOD_ALMA.Properties.ValueMember = "COD_ALMA";

            lkeCOD_SOCI_NEGO_RESP.Properties.DataSource = olsre;
            lkeCOD_SOCI_NEGO_RESP.Properties.Columns.Clear();
            lkci = new LookUpColumnInfo("ALF_NOMB", "Responsable", 20);
            lkeCOD_SOCI_NEGO_RESP.Properties.Columns.Add(lkci);
            lkeCOD_SOCI_NEGO_RESP.Properties.DisplayMember = "ALF_NOMB";
            lkeCOD_SOCI_NEGO_RESP.Properties.ValueMember = "COD_SOCI_NEGO";

            lkeCOD_MOTI.Properties.DataSource = olsmo;
            lkeCOD_MOTI.Properties.Columns.Clear();
            lkci = new LookUpColumnInfo("ALF_MOTI", "Motivo", 20);
            lkeCOD_MOTI.Properties.Columns.Add(lkci);
            lkeCOD_MOTI.Properties.DisplayMember = "ALF_MOTI";
            lkeCOD_MOTI.Properties.ValueMember = "COD_MOTI";

            var obj = new BEOutputGoodsDetail() { COD_USUA_CREA = SESSION_USER };
            var olst = new List<BEOutputGoodsDetail>();
            olst.Add(obj);
            gdcDetail.DataSource = olst;
        }
Example #12
0
        /// <summary>
        /// EVENTO LOAD DEL FORMULARIO
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xfSalesOrder_Load(object sender, EventArgs e)
        {
            SESSION_USER = ((xfMain)MdiParent).SESSION_USER;
            SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF;
            SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP;
            SESSION_IMPU = ((xfMain)MdiParent).SESSION_IMPU;
            SESSION_PORC_IMPU = ((xfMain)MdiParent).SESSION_PORC_IMPU;
            lblALF_IMPU.Text = SESSION_IMPU;

            var obral = new BRWarehouse();
            var olsal = obral.Get_PSGN_SPLS_SVMC_ALMA(SESSION_COMP);

            lueCOD_ALMA.Properties.DataSource = olsal;
            lueCOD_ALMA.Properties.Columns.Clear();
            var lkci = new LookUpColumnInfo("ALF_ALMA", "Almacén", 20);
            lueCOD_ALMA.Properties.Columns.Add(lkci);
            lueCOD_ALMA.Properties.DisplayMember = "ALF_ALMA";
            lueCOD_ALMA.Properties.ValueMember = "COD_ALMA";

            //MONEDAS
            var oBeMo = new BESVMC_MONE();
            var oBrMo = new BRSVMC_MONE();

            oBeMo.NUM_ACCI = 4;
            oBeMo.COD_COMP = SESSION_COMP;
            var oListMo = oBrMo.Get_SVPR_MONE_LIST(oBeMo);

            lueCOD_MONE.Properties.DataSource = oListMo;
            lueCOD_MONE.Properties.Columns.Clear();
            lueCOD_MONE.Properties.Columns.Add(new LookUpColumnInfo("ALF_MONE", 100, "Moneda"));
            lueCOD_MONE.Properties.DisplayMember = "ALF_MONE";
            lueCOD_MONE.Properties.ValueMember = "COD_MONE";
            //MOTIVOS
            var oBeM = new BEReason();
            oBeM.COD_COMP = SESSION_COMP;
            oBeM.COD_TIPO_MOTI = 2;
            oBeM.NUM_ACCI = 4;
            var obrmo = new BRSVMC_MOTI();
            var olsmo = obrmo.Get_SVPR_MOTI_LIST(oBeM);
            lkeCOD_MOTI.Properties.DataSource = olsmo;
            lkeCOD_MOTI.Properties.Columns.Clear();
            lkci = new LookUpColumnInfo("ALF_MOTI", "Motivo", 20);
            lkeCOD_MOTI.Properties.Columns.Add(lkci);
            lkeCOD_MOTI.Properties.DisplayMember = "ALF_MOTI";
            lkeCOD_MOTI.Properties.ValueMember = "COD_MOTI";

            gdcArticles.DataSource = oListArti;
            gdcArticlesCompleted.DataSource = oListArtiCompleted;
            gdcArticlesGroup.DataSource = oListArtiGroup;
            gdcGroups.DataSource = oListGroup;

            StateControl(true);
        }
Example #13
0
        private void Set_Save()
        {
            MessageBoxIcon msgIcon = MessageBoxIcon.Warning;
            try
            {
                gdvGeneric.CloseEditor();
                gdvGeneric.RefreshData();
                var olst = (List<BEReason>)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 BRReason();
                var obej = new BEReason();
                olst.ForEach(item => item.COD_COMP = xfMain.SgIns.SESSION_COMP);
                obr.Set_PSGN_SPMT_SVMC_MOTI(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);
            }
        }
Example #14
0
        private void Set_Operation(int index)
        {
            try
            {
                if (index == 0)
                {
                    gdvGeneric.CloseEditor();
                    gdvGeneric.RefreshData();
                    var olst = (List<BEReason>)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 BEReason() { IND_MNTN = 1, COD_USUA_CREA = xfMain.SgIns.SESSION_USER };
                    olst.Add(obj);
                    gdvGeneric.RefreshData();
                    gdvGeneric.MoveLast();
                    gdvGeneric.FocusedColumn = gcALF_MOTI;
                    gdvGeneric.ShowEditor();
                }
                else if (index == 1)
                {
                    var row = (BEReason)gdvGeneric.GetRow(gdvGeneric.FocusedRowHandle);
                    if (row.IND_MNTN != 0 &&
                        row.IND_MNTN != 3)
                    {
                        gdvGeneric.DeleteRow(gdvGeneric.FocusedRowHandle);
                    }
                    else
                    {
                        row.COD_USUA_MODI = xfMain.SgIns.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);
            }
        }
Example #15
0
 /// <summary>
 /// Mantenimiento de motivos.
 /// Inserta, Modifica y Elimina
 /// </summary>
 public void Set_PSGN_SPMT_SVMC_MOTI(BEReason obej, List<BEReason> olst)
 {
     oda.Set_PSGN_SPMT_SVMC_MOTI(obej, olst);
     Dispose(false);
 }