コード例 #1
0
 /// <summary>
 /// Retorna el detalle de las transferencias de mercadería según el filtro.
 /// </summary>
 public List<BETransferGoodsDetail> Get_PSGN_SPLS_SVTD_ALMA_TRAN(BETransferGoods obj)
 {
     using (var odr = oda.Get_PSGN_SPLS_SVTD_ALMA_TRAN(obj))
     {
         var olst = new List<BETransferGoodsDetail>();
         ((IList)olst).LoadFromReader<BETransferGoodsDetail>(odr);
         Dispose(false);
         return (olst);
     }
 }
コード例 #2
0
        private void Get_RowSelecion()
        {
            try
            {
                if (gdvSearch.RowCount == 0)
                    throw new ArgumentException(WhMessage.MsgZeroRows);

                rowsel = (BETransferGoods)gdvSearch.GetRow(gdvSearch.FocusedRowHandle);
                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #3
0
 /// <summary>
 /// Retorna las transferencias de mercadería para la recepción.
 /// </summary>
 public IDataReader Get_PSGN_SPLS_SVTC_ALMA_TRAN_RECE(BETransferGoods obj)
 {
     try
     {
         if (ocn.State == ConnectionState.Closed) ocn.Open();
         var ocmd = odb.GetStoredProcCommand("PSGN_SPLS_SVTC_ALMA_TRAN_RECE", obj.COD_ALMA,
                                                                             obj.COD_MOTI,
                                                                             obj.FEC_TRAN,
                                                                             obj.FEC_REGI,
                                                                             obj.ALF_DOCU_REFE,
                                                                             obj.COD_COMP);
         ocmd.CommandTimeout = 2000;
         var odr = odb.ExecuteReader(ocmd);
         Dispose(false);
         return (odr);
     }
     finally
     {
         ocn.Close();
     }
 }
コード例 #4
0
 /// <summary>
 /// Mantenimiento de transferencias de mercadería.
 /// Inserta
 /// </summary>
 public void Set_PSGN_SPMT_SVTC_ALMA_TRAN(BETransferGoods obj, List<BETransferGoodsDetail> lsob)
 {
     oda.Set_PSGN_SPMT_SVTC_ALMA_TRAN(obj, lsob);
     Dispose(false);
 }
コード例 #5
0
        private void Search()
        {
            try
            {
                var opar = new BETransferGoods()
                {
                    COD_ALMA = (int?)lkeCOD_ALMA.EditValue,
                    COD_MOTI = (int?)lkeCOD_MOTI.EditValue,
                    FEC_TRAN = (DateTime?)dteFEC_SALI.EditValue,
                    FEC_REGI = (DateTime?)dteFEC_REGI.EditValue,
                    ALF_DOCU_REFE = txtALF_DOCU_REFE.Text,
                    COD_COMP = xfMain.SgIns.SESSION_COMP
                };

                var obr = new BRTransferGoods();
                var olst = obr.Get_PSGN_SPLS_SVTC_ALMA_TRAN(opar);

                gdcSearch.DataSource = olst;
                gdvSearch.MoveFirst();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #6
0
 /// <summary>
 /// Retorna el detalle de las transferencias de mercadería según el filtro.
 /// </summary>
 public IDataReader Get_PSGN_SPLS_SVTD_ALMA_TRAN(BETransferGoods obj)
 {
     try
     {
         if (ocn.State == ConnectionState.Closed) ocn.Open();
         var ocmd = odb.GetStoredProcCommand("PSGN_SPLS_SVTD_ALMA_TRAN", obj.COD_ALMA_TRAN);
         ocmd.CommandTimeout = 2000;
         var odr = odb.ExecuteReader(ocmd);
         Dispose(false);
         return (odr);
     }
     finally
     {
         ocn.Close();
     }
 }
コード例 #7
0
        /// <summary>
        /// Mantenimiento de transferencia de mercaderías.
        /// Inserta
        /// </summary>
        public void Set_PSGN_SPMT_SVTC_ALMA_TRAN(BETransferGoods obj, List<BETransferGoodsDetail> lsob)
        {
            if (ocn.State == ConnectionState.Closed) ocn.Open();
            using (var obts = ocn.BeginTransaction())
            {
                try
                {
                    using (var ocmd = odb.GetStoredProcCommand("PSGN_SPMT_SVTC_ALMA_TRAN", obj.COD_ALMA_TRAN,
                                                                                            obj.COD_ALMA,
                                                                                            obj.COD_SOCI_NEGO_RESP,
                                                                                            obj.COD_ALMA_DEST,
                                                                                            obj.COD_SOCI_NEGO_RESP_DEST,
                                                                                            obj.COD_MOTI,
                                                                                            obj.FEC_TRAN,
                                                                                            obj.FEC_REGI,
                                                                                            obj.ALF_COME,
                                                                                            obj.ALF_DOCU_REFE,
                                                                                            obj.COD_COMP,
                                                                                            obj.COD_USUA_CREA))
                    {
                        ocmd.CommandTimeout = 2000;
                        odb.ExecuteNonQuery(ocmd, obts);
                        obj.COD_ALMA_TRAN = Convert.ToInt32(odb.GetParameterValue(ocmd, "@COD_ALMA_TRAN"));

                        DbCommand cmdo;
                        lsob.ForEach(item =>
                        {
                            item.COD_ALMA_TRAN = obj.COD_ALMA_TRAN;
                            cmdo = odb.GetStoredProcCommand("PSGN_SPMT_SVTD_ALMA_TRAN", item.COD_ALMA_TRAN_DETA,
                                                                                        item.COD_ALMA_TRAN,
                                                                                        item.COD_ARTI,
                                                                                        item.NUM_CANT,
                                                                                        item.NUM_CANT_MALO,
                                                                                        item.COD_USUA_CREA);
                            cmdo.CommandTimeout = 2000;
                            odb.ExecuteNonQuery(cmdo, obts);
                            item.COD_ALMA_TRAN_DETA = Convert.ToInt32(odb.GetParameterValue(cmdo, "@COD_ALMA_TRAN_DETA"));
                        });

                        obts.Commit();
                    }
                }
                catch (Exception ex)
                {
                    obts.Rollback();
                    obj.MSG_MNTN = ex.Message;
                }
                finally
                {
                    ocn.Close();
                }
            }
        }
コード例 #8
0
        public void Set_Save()
        {
            MessageBoxIcon msgIcon = MessageBoxIcon.Warning;
            try
            {
                if (!string.IsNullOrWhiteSpace(txtCOD_ALMA_TRAN.Text))
                {
                    msgIcon = MessageBoxIcon.Warning;
                    throw new ArgumentException(WhMessage.MsgNotModyRegis);
                }
                var obtg = new BETransferGoods()
                {
                    ALF_DOCU_REFE = txtALF_DOCU_REFE.Text.Trim(),
                    FEC_TRAN = (DateTime?)dteFEC_TRAN.EditValue,
                    FEC_REGI = (DateTime?)dteFEC_REGI.EditValue,
                    COD_MOTI = (int?)lkeCOD_MOTI.EditValue,
                    COD_ALMA = (int?)lkeCOD_ALMA.EditValue,
                    COD_SOCI_NEGO_RESP = (int?)lkeCOD_SOCI_NEGO_RESP.EditValue,
                    COD_ALMA_DEST = (int?)lkeCOD_ALMA_DEST.EditValue,
                    COD_SOCI_NEGO_RESP_DEST = (int?)lkeCOD_SOCI_NEGO_RESP_DEST.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(obtg, null, null);
                var errors = new List<ValidationResult>();
                if (!Validator.TryValidateObject(obtg, context, errors, true))
                {
                    foreach (ValidationResult result in errors)
                    {
                        msgIcon = MessageBoxIcon.Warning;
                        throw new ArgumentException(result.ErrorMessage);
                    }
                }

                gdvDetail.CloseEditor();
                gdvDetail.RefreshData();
                var olst = (List<BETransferGoodsDetail>)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 BRTransferGoods();
                obr.Set_PSGN_SPMT_SVTC_ALMA_TRAN(obtg, olst);
                if (!string.IsNullOrWhiteSpace(obtg.MSG_MNTN))
                {
                    msgIcon = MessageBoxIcon.Error;
                    throw new ArgumentException(obtg.MSG_MNTN);
                }
                txtCOD_ALMA_TRAN.Text = obtg.COD_ALMA_TRAN.ToString();
                gdvDetail.RefreshData();
                XtraMessageBox.Show(WhMessage.MsgSuccessfully, WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message,
                                    WhMessage.MsgInsCaption,
                                    MessageBoxButtons.OK,
                                    msgIcon);
            }
        }
コード例 #9
0
        private void Set_TransferGoods(BETransferGoods row)
        {
            ClearControls();
            txtCOD_ALMA_TRAN.Text = row.COD_ALMA_TRAN.ToString();
            txtALF_DOCU_REFE.Text = row.ALF_DOCU_REFE;
            dteFEC_TRAN.EditValue = row.FEC_TRAN;
            dteFEC_REGI.EditValue = row.FEC_REGI;
            lkeCOD_ALMA.EditValue = row.COD_ALMA;
            lkeCOD_SOCI_NEGO_RESP.EditValue = row.COD_SOCI_NEGO_RESP;
            lkeCOD_ALMA_DEST.EditValue = row.COD_ALMA_DEST;
            lkeCOD_SOCI_NEGO_RESP_DEST.EditValue = row.COD_SOCI_NEGO_RESP_DEST;
            lkeCOD_MOTI.EditValue = row.COD_MOTI;
            memALF_COME.Text = row.ALF_COME;

            var obtg = new BETransferGoods() { COD_ALMA_TRAN = row.COD_ALMA_TRAN };
            var obr = new BRTransferGoods();
            var olst = obr.Get_PSGN_SPLS_SVTD_ALMA_TRAN(obtg);

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