Пример #1
0
 /// <summary>
 /// Retorna el detalle de las entradas de mercadería según el filtro.
 /// </summary>
 public List<BEEntryGoodsDetail> Get_PSGN_SPLS_SVTD_ALMA_ENTR(BEEntryGoods obeg)
 {
     using (var odr = oda.Get_PSGN_SPLS_SVTD_ALMA_ENTR(obeg))
     {
         var olst = new List<BEEntryGoodsDetail>();
         ((IList)olst).LoadFromReader<BEEntryGoodsDetail>(odr);
         Dispose(false);
         return (olst);
     }
 }
Пример #2
0
        private void Get_RowSelecion()
        {
            try
            {
                if (gdvSearch.RowCount == 0)
                    throw new ArgumentException(WhMessage.MsgZeroRows);

                rowsel = (BEEntryGoods)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 entradas de mercadería según el filtro.
 /// </summary>
 public IDataReader Get_PSGN_SPLS_SVTD_ALMA_ENTR(BEEntryGoods obeg)
 {
     try
     {
         if (ocn.State == ConnectionState.Closed) ocn.Open();
         var ocmd = odb.GetStoredProcCommand("PSGN_SPLS_SVTD_ALMA_ENTR", obeg.COD_ALMA_ENTR);
         ocmd.CommandTimeout = 2000;
         var odr = odb.ExecuteReader(ocmd);
         Dispose(false);
         return (odr);
     }
     finally
     {
         ocn.Close();
     }
 }
Пример #4
0
        private void Search()
        {
            try
            {
                var opar = new BEEntryGoods();
                opar.COD_ALMA = (int?)lkeCOD_ALMA.EditValue;
                opar.COD_MOTI = (int?)lkeCOD_MOTI.EditValue;
                opar.FEC_ENTR = (DateTime?)dteFEC_ENTR.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 BREntryGoods();
                var olst = obr.Get_PSGN_SPLS_SVTC_ALMA_ENTR(opar);

                gdcSearch.DataSource = olst;
                gdvSearch.MoveFirst();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #5
0
        /// <summary>
        /// Mantenimiento de entrada de mercaderías.
        /// Inserta
        /// </summary>
        public void Set_PSGN_SPMT_SVTC_ALMA_ENTR(BEEntryGoods obeg, List<BEEntryGoodsDetail> lseg)
        {
            if (ocn.State == ConnectionState.Closed) ocn.Open();
            using (var obts = ocn.BeginTransaction())
            {
                try
                {
                    using (var ocmd = odb.GetStoredProcCommand("PSGN_SPMT_SVTC_ALMA_ENTR", obeg.COD_ALMA_ENTR,
                                                                                            obeg.COD_ALMA,
                                                                                            obeg.COD_SOCI_NEGO_RESP,
                                                                                            obeg.COD_MOTI,
                                                                                            obeg.FEC_ENTR,
                                                                                            obeg.FEC_REGI,
                                                                                            obeg.ALF_COME,
                                                                                            obeg.COD_COMP,
                                                                                            obeg.ALF_DOCU_REFE,
                                                                                            obeg.COD_USUA_CREA))
                    {
                        ocmd.CommandTimeout = 2000;
                        odb.ExecuteNonQuery(ocmd, obts);
                        obeg.COD_ALMA_ENTR = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_ALMA_ENTR"));

                        DbCommand cmdo;
                        lseg.ForEach(item =>
                        {
                            item.COD_ALMA_ENTR = obeg.COD_ALMA_ENTR;
                            cmdo = odb.GetStoredProcCommand("PSGN_SPMT_SVTD_ALMA_ENTR", item.COD_ENTR_DETA,
                                                                                        item.COD_ALMA_ENTR,
                                                                                        item.COD_ARTI,
                                                                                        item.NUM_CANT,
                                                                                        item.NUM_CANT_MALO,
                                                                                        item.COD_USUA_CREA);
                            cmdo.CommandTimeout = 2000;
                            odb.ExecuteNonQuery(cmdo, obts);
                            item.COD_ENTR_DETA = Convert.ToInt32(odb.GetParameterValue(cmdo, "@COD_ENTR_DETA"));
                        });

                        obts.Commit();
                    }
                }
                catch (Exception ex)
                {
                    obts.Rollback();
                    obeg.MSG_MNTN = ex.Message;
                }
                finally
                {
                    ocn.Close();
                }
            }
        }
Пример #6
0
 /// <summary>
 /// Mantenimiento de entrada de mercaderías.
 /// Inserta
 /// </summary>
 public void Set_PSGN_SPMT_SVTC_ALMA_ENTR(BEEntryGoods obeg, List<BEEntryGoodsDetail> lseg)
 {
     oda.Set_PSGN_SPMT_SVTC_ALMA_ENTR(obeg, lseg);
     Dispose(false);
 }
Пример #7
0
        public void Set_Save()
        {
            MessageBoxIcon msgIcon = MessageBoxIcon.Warning;
            try
            {
                if (!string.IsNullOrWhiteSpace(txtCOD_ALMA_ENTR.Text))
                {
                    msgIcon = MessageBoxIcon.Warning;
                    throw new ArgumentException(WhMessage.MsgNotModyRegis);
                }
                var obeg = new BEEntryGoods()
                {
                    ALF_DOCU_REFE = txtALF_DOCU_REFE.Text.Trim(),
                    FEC_ENTR = (DateTime?)dteFEC_ENTR.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_USUA_CREA = SESSION_USER,
                    COD_USUA_MODI = SESSION_USER ,
                    COD_COMP = SESSION_COMP
                };

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

                gdvDetail.CloseEditor();
                gdvDetail.RefreshData();
                var olst = (List<BEEntryGoodsDetail>)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 obr = new BREntryGoods();
                obr.Set_PSGN_SPMT_SVTC_ALMA_ENTR(obeg, olst);
                if (!string.IsNullOrWhiteSpace(obeg.MSG_MNTN))
                {
                    msgIcon = MessageBoxIcon.Error;
                    throw new ArgumentException(obeg.MSG_MNTN);
                }
                txtCOD_ALMA_ENTR.Text = obeg.COD_ALMA_ENTR.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);
            }
        }
Пример #8
0
        private void Set_EntryGoods(BEEntryGoods row)
        {
            ClearControls();
            txtCOD_ALMA_ENTR.Text = row.COD_ALMA_ENTR.ToString();
            txtALF_DOCU_REFE.Text = row.ALF_DOCU_REFE;
            dteFEC_ENTR.EditValue = row.FEC_ENTR;
            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 obeg = new BEEntryGoods() { COD_ALMA_ENTR = row.COD_ALMA_ENTR };
            var obr = new BREntryGoods();
            var olst = obr.Get_PSGN_SPLS_SVTD_ALMA_ENTR(obeg);

            gdcDetail.DataSource = olst;
            gdvDetail.RefreshData();
        }