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);
            }
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
            }
        }