public void Actualiza(CommimentBE pItem, List <CommimentDetailBE> pListaCommimentDetail)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    CommimentDL       Commiment       = new CommimentDL();
                    CommimentDetailDL CommimentDetail = new CommimentDetailDL();

                    foreach (var item in pListaCommimentDetail)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdCommiment = pItem.IdCommiment;
                            CommimentDetail.Inserta(item);
                        }
                        else
                        {
                            CommimentDetail.Actualiza(item);
                        }
                    }


                    Commiment.Actualiza(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        public Int32 Inserta(CommimentBE pItem, List <CommimentDetailBE> pListaCommimentDetail)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    CommimentDL       Commiment       = new CommimentDL();
                    CommimentDetailDL CommimentDetail = new CommimentDetailDL();

                    int IdCommiment = 0;
                    IdCommiment = Commiment.Inserta(pItem);

                    foreach (var item in pListaCommimentDetail)
                    {
                        item.IdCommiment = IdCommiment;
                        CommimentDetail.Inserta(item);
                    }

                    ts.Complete();

                    return(IdCommiment);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        public void Elimina(CommimentBE pItem)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    CommimentDL       Commiment       = new CommimentDL();
                    CommimentDetailDL CommimentDetail = new CommimentDetailDL();

                    //Client SENSOR
                    List <CommimentDetailBE> lstCommimentDetail = null;
                    lstCommimentDetail = new CommimentDetailDL().ListaTodosActivo(pItem.IdCommiment);

                    foreach (var item in lstCommimentDetail)
                    {
                        CommimentDetail.Elimina(item);
                    }

                    Commiment.Elimina(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
        private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        CommimentBE objE_Commiment = new CommimentBE();
                        objE_Commiment.IdCommiment = int.Parse(gvCommiment.GetFocusedRowCellValue("IdCommiment").ToString());
                        objE_Commiment.Login       = Parametros.strUsuarioLogin;
                        objE_Commiment.Machine     = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Commiment.IdCompany   = Parametros.intEmpresaId;

                        CommimentBL objBL_Commiment = new CommimentBL();
                        objBL_Commiment.Elimina(objE_Commiment);
                        XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        public void Actualiza(CommimentBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Commiment_Actualiza");

            db.AddInParameter(dbCommand, "pIdCommiment", DbType.Int32, pItem.IdCommiment);
            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany);
            db.AddInParameter(dbCommand, "pIdClient", DbType.Int32, pItem.IdClient);
            db.AddInParameter(dbCommand, "pNumberCommiment", DbType.String, pItem.NumberCommiment);
            db.AddInParameter(dbCommand, "pIdVendor", DbType.Int32, pItem.IdVendor);
            db.AddInParameter(dbCommand, "pCommimentDate", DbType.DateTime, pItem.CommimentDate);
            db.AddInParameter(dbCommand, "pContractShipDate", DbType.DateTime, pItem.ContractShipDate);
            db.AddInParameter(dbCommand, "pRevisionDate", DbType.DateTime, pItem.RevisionDate);
            db.AddInParameter(dbCommand, "pNumberRevision", DbType.String, pItem.NumberRevision);
            db.AddInParameter(dbCommand, "pIdOrigen", DbType.Int32, pItem.IdOrigen);
            db.AddInParameter(dbCommand, "pIdDestination", DbType.Int32, pItem.IdDestination);
            db.AddInParameter(dbCommand, "pIdCurrency", DbType.Int32, pItem.IdCurrency);
            db.AddInParameter(dbCommand, "pFreightPaid", DbType.String, pItem.FreightPaid);
            db.AddInParameter(dbCommand, "pAddionational", DbType.String, pItem.Addionational);
            db.AddInParameter(dbCommand, "pFlagState", DbType.Boolean, pItem.FlagState);
            db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login);
            db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine);

            db.ExecuteNonQuery(dbCommand);
        }
 public CommimentBE Selecciona(int IdCommiment)
 {
     try
     {
         CommimentDL Commiment = new CommimentDL();
         CommimentBE objEmp    = Commiment.Selecciona(IdCommiment);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#7
0
        public void Elimina(CommimentBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Commiment_Elimina");

            db.AddInParameter(dbCommand, "pIdCommiment", DbType.Int32, pItem.IdCommiment);
            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany);
            db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login);
            db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine);

            db.ExecuteNonQuery(dbCommand);
        }
示例#8
0
        public List <CommimentBE> ListaClientContractShipDate(int IdCompany, int IdClient, DateTime DateFrom, DateTime DateTo)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Commiment_ClientContractShipDate");

            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, IdCompany);
            db.AddInParameter(dbCommand, "pIdClient", DbType.Int32, IdClient);
            db.AddInParameter(dbCommand, "pDateFrom", DbType.DateTime, DateFrom);
            db.AddInParameter(dbCommand, "pDateTo", DbType.DateTime, DateTo);

            IDataReader        reader        = db.ExecuteReader(dbCommand);
            List <CommimentBE> Commimentlist = new List <CommimentBE>();
            CommimentBE        Commiment;

            while (reader.Read())
            {
                Commiment                  = new CommimentBE();
                Commiment.IdCommiment      = Int32.Parse(reader["IdCommiment"].ToString());
                Commiment.IdCompany        = Int32.Parse(reader["IdCompany"].ToString());
                Commiment.NameCompany      = reader["NameCompany"].ToString();
                Commiment.IdClient         = Int32.Parse(reader["IdClient"].ToString());
                Commiment.NameClient       = reader["NameClient"].ToString();
                Commiment.NumberCommiment  = reader["NumberCommiment"].ToString();
                Commiment.IdVendor         = Int32.Parse(reader["IdVendor"].ToString());
                Commiment.NameVendor       = reader["NameVendor"].ToString();
                Commiment.CommimentDate    = DateTime.Parse(reader["CommimentDate"].ToString());
                Commiment.ContractShipDate = DateTime.Parse(reader["ContractShipDate"].ToString());
                Commiment.RevisionDate     = DateTime.Parse(reader["RevisionDate"].ToString());
                Commiment.NumberRevision   = reader["NumberRevision"].ToString();
                Commiment.IdOrigen         = Int32.Parse(reader["IdOrigen"].ToString());
                Commiment.NameOrigen       = reader["NameOrigen"].ToString();
                Commiment.IdDestination    = Int32.Parse(reader["IdDestination"].ToString());
                Commiment.NameDestination  = reader["NameDestination"].ToString();
                Commiment.IdCurrency       = Int32.Parse(reader["IdCurrency"].ToString());
                Commiment.NameCurrency     = reader["NameCurrency"].ToString();
                Commiment.FreightPaid      = reader["FreightPaid"].ToString();
                Commiment.Addionational    = reader["Addionational"].ToString();
                Commiment.FlagState        = Boolean.Parse(reader["FlagState"].ToString());
                Commimentlist.Add(Commiment);
            }
            reader.Close();
            reader.Dispose();
            return(Commimentlist);
        }
示例#9
0
        private void frmRegCommimentEdit_Load(object sender, EventArgs e)
        {
            BSUtils.LoaderLook(cboClient, new LoginClientDepartmentBL().ListaClient(Parametros.intUsuarioId), "NameClient", "IdClient", true);
            cboClient.EditValue = IdClient;
            BSUtils.LoaderLook(cboVendor, new VendorBL().ListaTodosActivo(Parametros.intEmpresaId), "NameVendor", "IdVendor", true);
            BSUtils.LoaderLook(cboOrigin, new DestinationBL().ListaTodosActivo(Parametros.intEmpresaId), "NameDestination", "IdDestination", true);
            BSUtils.LoaderLook(cboDestination, new DestinationBL().ListaTodosActivo(Parametros.intEmpresaId), "NameDestination", "IdDestination", true);
            BSUtils.LoaderLook(cboCurrency, new CurrencyBL().ListaTodosActivo(Parametros.intEmpresaId), "NameCurrency", "IdCurrency", true);

            deCommimentDate.DateTime    = DateTime.Now;
            deContractShipDate.DateTime = DateTime.Now;
            deRevisionDate.DateTime     = DateTime.Now;

            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Commiment - New";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Commiment - Update";

                CommimentBE objE_Commiment = null;
                objE_Commiment = new CommimentBL().Selecciona(IdCommiment);
                if (objE_Commiment != null)
                {
                    IdCommiment                  = objE_Commiment.IdCommiment;
                    txtNumero.Text               = objE_Commiment.NumberCommiment;
                    cboClient.EditValue          = objE_Commiment.IdClient;
                    cboVendor.EditValue          = objE_Commiment.IdVendor;
                    deCommimentDate.EditValue    = objE_Commiment.CommimentDate;
                    deContractShipDate.EditValue = objE_Commiment.ContractShipDate;
                    deRevisionDate.EditValue     = objE_Commiment.RevisionDate;
                    txtNumberRevision.Text       = objE_Commiment.NumberRevision;
                    cboOrigin.EditValue          = objE_Commiment.IdOrigen;
                    cboDestination.EditValue     = objE_Commiment.IdDestination;
                    cboCurrency.EditValue        = objE_Commiment.IdCurrency;
                    txtFreightPaid.Text          = objE_Commiment.FreightPaid;
                    txtAddionational.Text        = objE_Commiment.Addionational;
                }
            }

            CargaCommimentDetail();
        }
        public void InicializarModificar()
        {
            if (gvCommiment.RowCount > 0)
            {
                CommimentBE objCommiment = new CommimentBE();

                objCommiment.IdCommiment = int.Parse(gvCommiment.GetFocusedRowCellValue("IdCommiment").ToString());

                frmRegCommimentEdit objManCommimentEdit = new frmRegCommimentEdit();
                objManCommimentEdit.pOperacion    = frmRegCommimentEdit.Operacion.Modificar;
                objManCommimentEdit.IdCommiment   = objCommiment.IdCommiment;
                objManCommimentEdit.StartPosition = FormStartPosition.CenterParent;
                objManCommimentEdit.ShowDialog();

                Cargar();
            }
            else
            {
                MessageBox.Show("No se pudo editar");
            }
        }
示例#11
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    CommimentBL objBL_Commiment = new CommimentBL();
                    CommimentBE objCommiment    = new CommimentBE();

                    objCommiment.IdCommiment      = IdCommiment;
                    objCommiment.NumberCommiment  = txtNumero.Text;
                    objCommiment.IdClient         = Convert.ToInt32(cboClient.EditValue);
                    objCommiment.IdVendor         = Convert.ToInt32(cboVendor.EditValue);
                    objCommiment.CommimentDate    = Convert.ToDateTime(deCommimentDate.DateTime.ToShortDateString());
                    objCommiment.ContractShipDate = Convert.ToDateTime(deContractShipDate.DateTime.ToShortDateString());
                    objCommiment.RevisionDate     = Convert.ToDateTime(deRevisionDate.DateTime.ToShortDateString());
                    objCommiment.NumberRevision   = txtNumberRevision.Text;
                    objCommiment.IdOrigen         = Convert.ToInt32(cboOrigin.EditValue);
                    objCommiment.IdDestination    = Convert.ToInt32(cboDestination.EditValue);
                    objCommiment.IdCurrency       = Convert.ToInt32(cboCurrency.EditValue);
                    objCommiment.FreightPaid      = txtFreightPaid.Text;
                    objCommiment.Addionational    = txtAddionational.Text;
                    objCommiment.FlagState        = true;
                    objCommiment.Login            = Parametros.strUsuarioLogin;
                    objCommiment.Machine          = WindowsIdentity.GetCurrent().Name.ToString();
                    objCommiment.IdCompany        = Parametros.intEmpresaId;

                    //DETAIL
                    List <CommimentDetailBE> lstCommimentDetail = new List <CommimentDetailBE>();

                    foreach (var item in mListaCommimentDetailOrigen)
                    {
                        CommimentDetailBE objE_CommimentDetail = new CommimentDetailBE();
                        objE_CommimentDetail.IdCompany         = Parametros.intEmpresaId;
                        objE_CommimentDetail.IdCommiment       = IdCommiment;
                        objE_CommimentDetail.IdCommimentDetail = item.IdCommimentDetail;
                        objE_CommimentDetail.IdStyle           = item.IdStyle;
                        objE_CommimentDetail.Quantity          = item.Quantity;
                        objE_CommimentDetail.Fob       = item.Fob;
                        objE_CommimentDetail.Total     = item.Total;
                        objE_CommimentDetail.FlagState = true;
                        objE_CommimentDetail.Login     = Parametros.strUsuarioLogin;
                        objE_CommimentDetail.Machine   = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_CommimentDetail.TipoOper  = item.TipoOper;
                        lstCommimentDetail.Add(objE_CommimentDetail);
                    }

                    if (pOperacion == Operacion.Nuevo)
                    {
                        int    intNumero = 0;
                        string strNumero = "";
                        intNumero      = objBL_Commiment.Inserta(objCommiment, lstCommimentDetail);
                        strNumero      = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 10);
                        txtNumero.Text = strNumero;

                        //ActualizaNumero
                        CommimentBL objBCommiment = new CommimentBL();
                        objBCommiment.ActualizaNumero(intNumero, txtNumero.Text);
                    }

                    else
                    {
                        objBL_Commiment.Actualiza(objCommiment, lstCommimentDetail);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }