示例#1
0
 /// <summary>
 /// Retorna el detalle de las salidas de mercadería según el filtro.
 /// </summary>
 public List<BEOutputGoodsDetail> Get_PSGN_SPLS_SVTD_ALMA_SALI(BEOutputGoods obog)
 {
     using (var odr = oda.Get_PSGN_SPLS_SVTD_ALMA_SALI(obog))
     {
         var olst = new List<BEOutputGoodsDetail>();
         ((IList)olst).LoadFromReader<BEOutputGoodsDetail>(odr);
         Dispose(false);
         return (olst);
     }
 }
        private void Get_RowSelecion()
        {
            try
            {
                if (gdvSearch.RowCount == 0)
                    throw new ArgumentException(WhMessage.MsgZeroRows);

                rowsel = (BEOutputGoods)gdvSearch.GetRow(gdvSearch.FocusedRowHandle);
                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#3
0
 /// <summary>
 /// Retorna el detalle de las salidas de mercadería según el filtro.
 /// </summary>
 public IDataReader Get_PSGN_SPLS_SVTD_ALMA_SALI(BEOutputGoods obog)
 {
     try
     {
         if (ocn.State == ConnectionState.Closed) ocn.Open();
         var ocmd = odb.GetStoredProcCommand("PSGN_SPLS_SVTD_ALMA_SALI", obog.COD_ALMA_SALI);
         ocmd.CommandTimeout = 2000;
         var odr = odb.ExecuteReader(ocmd);
         Dispose(false);
         return (odr);
     }
     finally
     {
         ocn.Close();
     }
 }
        private void Search()
        {
            try
            {
                var opar = new BEOutputGoods();
                opar.COD_ALMA = (int?)lkeCOD_ALMA.EditValue;
                opar.COD_MOTI = (int?)lkeCOD_MOTI.EditValue;
                opar.FEC_SALI = (DateTime?)dteFEC_SALI.EditValue;
                opar.FEC_REGI = (DateTime?)dteFEC_REGI.EditValue;
                opar.ALF_DOCU_REFE = txtALF_DOCU_REFE.Text;
                opar.COD_COMP = xfMain.SgIns.SESSION_COMP;

                var obr = new BROutputGoods();
                var olst = obr.Get_PSGN_SPLS_SVTC_ALMA_SALI(opar);

                gdcSearch.DataSource = olst;
                gdvSearch.MoveFirst();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#5
0
        /// <summary>
        /// Mantenimiento de salida de mercaderías.
        /// Inserta
        /// </summary>
        public void Set_PSGN_SPMT_SVTC_ALMA_SALI(BEOutputGoods obog, List<BEOutputGoodsDetail> lsog)
        {
            if (ocn.State == ConnectionState.Closed) ocn.Open();
            using (var obts = ocn.BeginTransaction())
            {
                try
                {
                    using (var ocmd = odb.GetStoredProcCommand("PSGN_SPMT_SVTC_ALMA_SALI", obog.COD_ALMA_SALI,
                                                                                            obog.COD_ALMA,
                                                                                            obog.COD_SOCI_NEGO_RESP,
                                                                                            obog.COD_MOTI,
                                                                                            obog.FEC_SALI,
                                                                                            obog.FEC_REGI,
                                                                                            obog.ALF_COME,
                                                                                            obog.COD_COMP,
                                                                                            obog.ALF_DOCU_REFE,
                                                                                            obog.COD_USUA_CREA))
                    {
                        ocmd.CommandTimeout = 2000;
                        odb.ExecuteNonQuery(ocmd, obts);
                        obog.COD_ALMA_SALI = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_ALMA_SALI"));

                        DbCommand cmdo;
                        lsog.ForEach(item =>
                        {
                            item.COD_ALMA_SALI = obog.COD_ALMA_SALI;
                            cmdo = odb.GetStoredProcCommand("PSGN_SPMT_SVTD_ALMA_SALI", item.COD_SALI_DETA,
                                                                                        item.COD_ALMA_SALI,
                                                                                        item.COD_ARTI,
                                                                                        item.NUM_CANT,
                                                                                        item.NUM_CANT_MALO,
                                                                                        item.COD_USUA_CREA);
                            cmdo.CommandTimeout = 2000;
                            odb.ExecuteNonQuery(cmdo, obts);
                            item.COD_SALI_DETA = Convert.ToInt32(odb.GetParameterValue(cmdo, "@COD_SALI_DETA"));
                        });

                        obts.Commit();
                    }
                }
                catch (Exception ex)
                {
                    obts.Rollback();
                    obog.MSG_MNTN = ex.Message;
                }
                finally
                {
                    ocn.Close();
                }
            }
        }
示例#6
0
        public void Set_Save()
        {
            MessageBoxIcon msgIcon = MessageBoxIcon.Warning;
            try
            {
                if (!string.IsNullOrWhiteSpace(txtCOD_ALMA_SALI.Text))
                {
                    msgIcon = MessageBoxIcon.Warning;
                    throw new ArgumentException(WhMessage.MsgNotModyRegis);
                }
                var obog = new BEOutputGoods()
                {
                    ALF_DOCU_REFE = txtALF_DOCU_REFE.Text.Trim(),
                    FEC_SALI = (DateTime?)dteFEC_SALI.EditValue,
                    FEC_REGI = (DateTime?)dteFEC_REGI.EditValue,
                    COD_ALMA = (int?)lkeCOD_ALMA.EditValue,
                    COD_SOCI_NEGO_RESP = (int?)lkeCOD_SOCI_NEGO_RESP.EditValue,
                    COD_MOTI = (int?)lkeCOD_MOTI.EditValue,
                    ALF_COME = memALF_COME.Text.Trim(),
                    COD_COMP = SESSION_COMP,
                    COD_USUA_CREA = SESSION_USER,
                    COD_USUA_MODI = SESSION_USER
                };

                var context = new ValidationContext(obog, null, null);
                var errors = new List<ValidationResult>();
                if (!Validator.TryValidateObject(obog, context, errors, true))
                {
                    foreach (ValidationResult result in errors)
                    {
                        msgIcon = MessageBoxIcon.Warning;
                        throw new ArgumentException(result.ErrorMessage);
                    }
                }

                gdvDetail.CloseEditor();
                gdvDetail.RefreshData();
                var olst = (List<BEOutputGoodsDetail>)gdvDetail.DataSource;
                if (olst.Count == 0)
                {
                    msgIcon = MessageBoxIcon.Warning;
                    throw new ArgumentException(WhMessage.MsgManyRows);
                }

                var i = 1;
                olst.ForEach(item =>
                {
                    context = new ValidationContext(item, null, null);
                    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 manywh = olst.Select(item => item.COD_ALMA).Distinct().Count();
                if (manywh > 1)
                {
                    msgIcon = MessageBoxIcon.Warning;
                    throw new ArgumentException(WhMessage.MsgManyWhArt);
                }

                var obr = new BROutputGoods();
                obr.Set_PSGN_SPMT_SVTC_ALMA_SALI(obog, olst);
                if (!string.IsNullOrWhiteSpace(obog.MSG_MNTN))
                {
                    msgIcon = MessageBoxIcon.Error;
                    throw new ArgumentException(obog.MSG_MNTN);
                }
                txtCOD_ALMA_SALI.Text = obog.COD_ALMA_SALI.ToString();
                gdvDetail.RefreshData();
                StateControls(true);
                XtraMessageBox.Show(WhMessage.MsgSuccessfully, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message,
                                    WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK,
                                    msgIcon);
            }
        }
示例#7
0
        private void Set_OutputGoods(BEOutputGoods row)
        {
            ClearControls();
            txtCOD_ALMA_SALI.Text = row.COD_ALMA_SALI.ToString();
            txtALF_DOCU_REFE.Text = row.ALF_DOCU_REFE;
            dteFEC_SALI.EditValue = row.FEC_SALI;
            dteFEC_REGI.EditValue = row.FEC_REGI;
            lkeCOD_ALMA.EditValue = row.COD_ALMA;
            lkeCOD_SOCI_NEGO_RESP.EditValue = row.COD_SOCI_NEGO_RESP;
            lkeCOD_MOTI.EditValue = row.COD_MOTI;
            memALF_COME.Text = row.ALF_COME;

            var obog = new BEOutputGoods() { COD_ALMA_SALI = row.COD_ALMA_SALI };
            var obr = new BROutputGoods();
            var olst = obr.Get_PSGN_SPLS_SVTD_ALMA_SALI(obog);

            gdcDetail.DataSource = olst;
            gdvDetail.RefreshData();
        }
示例#8
0
 /// <summary>
 /// Mantenimiento de salida de mercaderías.
 /// Inserta
 /// </summary>
 public void Set_PSGN_SPMT_SVTC_ALMA_SALI(BEOutputGoods obog, List<BEOutputGoodsDetail> lsog)
 {
     oda.Set_PSGN_SPMT_SVTC_ALMA_SALI(obog, lsog);
     Dispose(false);
 }