Exemplo n.º 1
0
        private void GridDataBind()
        {
            try
            {
                ApplicationResult objResult = new ApplicationResult();
                VendorBL          objUOMBL  = new VendorBL();

                objResult = objUOMBL.Vendor_SelectAll();
                if (objResult != null)
                {
                    gvVendor.DataSource = objResult.resultDT;
                    gvVendor.DataBind();

                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        PanelGrid_VisibilityMode(1);
                    }
                    else
                    {
                        PanelGrid_VisibilityMode(2);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        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())
                    {
                        VendorBE objE_Vendor = new VendorBE();
                        objE_Vendor.IdVendor  = int.Parse(gvVendor.GetFocusedRowCellValue("IdVendor").ToString());
                        objE_Vendor.Login     = Parametros.strUsuarioLogin;
                        objE_Vendor.Machine   = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Vendor.IdCompany = Parametros.intEmpresaId;

                        VendorBL objBL_Vendor = new VendorBL();
                        objBL_Vendor.Elimina(objE_Vendor);
                        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);
            }
        }
Exemplo n.º 3
0
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            bool      m_bAManualCode = false;
            DataTable dtAssICode     = new DataTable();

            dtAssICode = m_oCheckList.GetVendorCodeTypeSetup();
            if (dtAssICode.Rows.Count > 0)
            {
                m_bAManualCode = Convert.ToBoolean(dtAssICode.Rows[0]["CodeType"].ToString());
            }
            if (m_bAManualCode == true)
            {
                m_oVendor.MaxVendorMasterUpdate();
                DataTable dtComp = new DataTable();
                dtComp = VendorBL.GetVendorCodeRegen();
                if (dtComp.Rows.Count > 0)
                {
                    for (int i = 0; i < dtComp.Rows.Count; i++)
                    {
                        int    iVendId = Convert.ToInt32(clsStatic.IsNullCheck(dtComp.Rows[i]["VendorId"], clsStatic.datatypes.vartypenumeric));
                        string s_Code  = "";
                        s_Code = VendorBL.GetCodeCheckVendor();
                        VendorBL.MaxIncVendorMasterUpdate(iVendId, s_Code);
                    }
                }
                MessageBox.Show("Code Regeneration Successfully");
            }
        }
        private void frmRegVendorEdit_Load(object sender, EventArgs e)
        {
            BSUtils.LoaderLook(cboEvaluation, new EvaluationBL().ListaTodosActivo(Parametros.intEmpresaId), "NameEvaluation", "IdEvaluation", true);
            cboEvaluation.EditValue = 0;
            BSUtils.LoaderLook(cboStatus, new StatusBL().ListaTodosActivo(Parametros.intEmpresaId), "NameStatus", "IdStatus", true);
            cboEvaluation.EditValue = 0;
            deRevenueDate.DateTime  = DateTime.Now;

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

                VendorBE objE_Vendor = null;
                objE_Vendor = new VendorBL().Selecciona(IdVendor);
                if (objE_Vendor != null)
                {
                    IdVendor                = objE_Vendor.IdVendor;
                    txtNameVendor.Text      = objE_Vendor.NameVendor;
                    txtRuc.Text             = objE_Vendor.Ruc;
                    cboStatus.EditValue     = objE_Vendor.IdStatus;
                    cboEvaluation.EditValue = objE_Vendor.IdEvaluation;
                    deRevenueDate.EditValue = objE_Vendor.RevenueDate;
                    if (objE_Vendor.FlagNational)
                    {
                        chkNational.Checked = true;
                    }
                    else
                    {
                        chkNational.Checked = false;
                    }
                    if (objE_Vendor.FlagForeigner)
                    {
                        chkForeigner.Checked = true;
                    }
                    else
                    {
                        chkForeigner.Checked = false;
                    }
                    txtVendorCode.Text           = objE_Vendor.Code;
                    txtCorporation.EditValue     = objE_Vendor.Corporation;
                    txtRepresentative.EditValue  = objE_Vendor.Representative;
                    txtCapacity.EditValue        = objE_Vendor.Capacity;
                    txtNumberEmployees.EditValue = objE_Vendor.NumberEmployees;
                    txtSituation.Text            = objE_Vendor.Situation;

                    CargaVendorClassificationModificar();
                }
            }

            CargaVendorAddress();
            CargaVendorContact();

            txtNameVendor.Focus();
        }
Exemplo n.º 5
0
        protected void gvVendor_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                Controls          objControls = new Controls();
                ApplicationResult objResults  = new ApplicationResult();
                VendorBL          objVendorBL = new VendorBL();

                ViewState["VendorID"] = Convert.ToInt32(e.CommandArgument.ToString());
                if (e.CommandName.ToString() == "Edit1")
                {
                    objResults = objVendorBL.Vendor_Select(Convert.ToInt32(ViewState["VendorID"].ToString()));

                    if (objResults != null)
                    {
                        if (objResults.resultDT.Rows.Count > 0)
                        {
                            txtVendorName.Text  = objResults.resultDT.Rows[0][VendorBO.VENDOR_VENDORNAME].ToString();
                            txtAddress.Text     = objResults.resultDT.Rows[0][VendorBO.VENDOR_ADDRESS].ToString();
                            txtTelephoneNo.Text = objResults.resultDT.Rows[0][VendorBO.VENDOR_TELEPHONENO].ToString();
                            txtMobileNo.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_MOBILENO].ToString();
                            txtFax.Text         = objResults.resultDT.Rows[0][VendorBO.VENDOR_FAX].ToString();
                            txtEmail.Text       = objResults.resultDT.Rows[0][VendorBO.VENDOR_EMAILID].ToString();
                            txtTinGst.Text      = objResults.resultDT.Rows[0][VendorBO.VENDOR_TINGST].ToString();
                            txtTinCst.Text      = objResults.resultDT.Rows[0][VendorBO.VENDOR_TINCST].ToString();
                            txtBankName.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_BANKNAME].ToString();
                            txtAccountNo.Text   = objResults.resultDT.Rows[0][VendorBO.VENDOR_ACCOUNTNO].ToString();
                            txtAccountName.Text = objResults.resultDT.Rows[0][VendorBO.VENDOR_ACCOUNTNAME].ToString();
                            txtIFSCCode.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_IFSCCODE].ToString();
                            txtPanNo.Text       = objResults.resultDT.Rows[0][VendorBO.VENDOR_PANNO].ToString();
                            txtTaxRegNo.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_TAXREGNO].ToString();
                            ViewState["Mode"]   = "Edit";
                            PanelGrid_VisibilityMode(2);
                        }
                    }
                }
                else if ((e.CommandName.ToString() == "Delete1"))
                {
                    objResults = objVendorBL.Vendor_Delete(Convert.ToInt32(ViewState["VendorID"].ToString()));
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        ClearAll();
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor deleted successfully.');</script>");
                        GridDataBind();
                        PanelGrid_VisibilityMode(1);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor is not deleted because it is in use.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        void ExportarExcel(string filename)
        {
            Excel._Application xlApp;
            Excel._Workbook    xlLibro;
            Excel._Worksheet   xlHoja;
            Excel.Sheets       xlHojas;
            xlApp    = new Excel.Application();
            filename = Path.Combine(Directory.GetCurrentDirectory(), "Excel\\Vendor.xlsx");
            xlLibro  = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
            xlHojas  = xlLibro.Sheets;
            xlHoja   = (Excel._Worksheet)xlHojas[1];

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                int Row       = 6;
                int Secuencia = 1;

                List <VendorBE> lstVendor = null;
                lstVendor = new VendorBL().ListaTodosActivo(Parametros.intEmpresaId);
                if (lstVendor.Count > 0)
                {
                    xlHoja.Shapes.AddPicture(Path.Combine(Directory.GetCurrentDirectory(), "Logo.jpg"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 1, 1, 100, 60);

                    foreach (var item in lstVendor)
                    {
                        xlHoja.Cells[Row, 1] = item.IdVendor;
                        xlHoja.Cells[Row, 2] = item.Ruc;
                        xlHoja.Cells[Row, 3] = item.NameVendor;
                        xlHoja.Cells[Row, 4] = BSUtils.GetDateFormat(item.RevenueDate);
                        xlHoja.Cells[Row, 5] = item.Representative;
                        xlHoja.Cells[Row, 6] = item.Situation;
                        Row       = Row + 1;
                        Secuencia = Secuencia + 1;
                    }
                }

                xlLibro.SaveAs("C:\\Excel\\Vendor.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

                xlLibro.Close(true, Missing.Value, Missing.Value);
                xlApp.Quit();

                Cursor.Current = Cursors.Default;
                XtraMessageBox.Show("It was imported correctly \n The file was generated C:\\Excel\\Vendor.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                xlLibro.Close(false, Missing.Value, Missing.Value);
                xlApp.Quit();
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 7
0
        private void PopulateSType()
        {
            DataTable dtSType = new DataTable();

            dtSType = VendorBL.PopulateSType();
            cboSType.Properties.DataSource = dtSType;
            cboSType.Properties.ForceInitialize();
            cboSType.Properties.PopulateColumns();
            cboSType.Properties.ValueMember   = "ServiceTypeId";
            cboSType.Properties.DisplayMember = "ServiceType";
            cboSType.Properties.Columns["ServiceTypeId"].Visible = false;
            cboSType.Properties.ShowHeader = false;
            cboSType.Properties.ShowFooter = false;
            cboSType.EditValue             = 0;
        }
Exemplo n.º 8
0
        private void btnOk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (dtExcelData == null)
            {
                return;
            }
            if (CheckColumns() == false)
            {
                return;
            }
            string sVendorName = "";
            string sVAddress   = "";
            string sContactNo  = "";
            string sEmail      = "";
            string sCSTNo      = "";
            string sTNGSTNo    = "";
            string sTIN        = "";
            string sPAN        = "";
            int    iSupply     = 0;
            int    iContract   = 0;
            int    iService    = 0;

            for (int i = 0; i < dtExcelData.Rows.Count; i++)
            {
                sVendorName = dtExcelData.Rows[i]["VendorName"].ToString();
                if (VendorBL.IsValidName(sVendorName) == true && sVendorName != "")
                {
                    sVAddress  = dtExcelData.Rows[i]["Address"].ToString();
                    sContactNo = dtExcelData.Rows[i]["ContactNo"].ToString();
                    sEmail     = dtExcelData.Rows[i]["EmailId"].ToString();
                    sCSTNo     = dtExcelData.Rows[i]["CSTNo"].ToString();
                    sTNGSTNo   = dtExcelData.Rows[i]["TNGST"].ToString();
                    sTIN       = dtExcelData.Rows[i]["TIN"].ToString();
                    sPAN       = dtExcelData.Rows[i]["PAN"].ToString();
                    iSupply    = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Supply"].ToString(), clsStatic.datatypes.vartypenumeric));
                    iContract  = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Contract"].ToString(), clsStatic.datatypes.vartypenumeric));
                    iService   = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Service"].ToString(), clsStatic.datatypes.vartypenumeric));
                    VendorBL.ImportTransaction(sVendorName, sVAddress, sContactNo, sEmail, sCSTNo, sTNGSTNo, sTIN, sPAN, iSupply, iContract, iService);
                }
            }

            if (BsfGlobal.g_bFADB == true)
            {
                BsfGlobal.RefreshSubLedger(1);
            }
            MessageBox.Show("Imported Successfully!", "Vendor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Clear();
        }
Exemplo n.º 9
0
        public void getVendorName()
        {
            ApplicationResult objResult   = new ApplicationResult();
            Controls          objControls = new Controls();
            VendorBL          objVendorBL = new VendorBL();

            objResult = objVendorBL.Vendor_SelectAll();
            if (objResult != null)
            {
                objControls.BindDropDown_ListBox(objResult.resultDT, ddlVendor, "VendorName", "VendorID");
                if (objResult.resultDT.Rows.Count > 0)
                {
                }
                ddlVendor.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "-1"));
            }
        }
Exemplo n.º 10
0
        void PoupulateVendorGrid()
        {
            VendorBL      vendorBl  = new VendorBL();
            List <Vendor> lstVendor = vendorBl.GetVendor();

            BindingSource vendorListBS = new BindingSource();

            if (lstVendor != null && lstVendor.Count > 0)
            {
                vendorListBS.DataSource = lstVendor;
            }
            else
            {
                vendorListBS.DataSource = new List <Vendor>();
            }
            dgvVendor.DataSource = vendorListBS;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Lấy ra dữ liệu của class ObjectDetails
        /// </summary>
        /// <returns>
        /// Create by Nhthai(4/05/2019)
        /// </returns>
        // GET: api/ObjectDetail
        public Result Get()
        {
            var result = new Result();

            try
            {
                VendorBL vendorBL = new VendorBL();
                result.Data    = vendorBL.GetDataVendor();
                result.Success = true;
            }
            catch (Exception)
            {
                result.Success = false;
                throw;
            }
            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Gets all vendors.
        /// </summary>
        /// <returns>
        /// Get All Vendors
        /// </returns>
        public IEnumerable <VendorEntity> GetAllVendors()
        {
            IList <VendorEntity> result     = new List <VendorEntity>();
            IVendorBL            vendorBL   = new VendorBL();
            List <Vendor>        vendorList = vendorBL.GetAllVendor();

            foreach (Vendor source in vendorList)
            {
                VendorEntity target = new VendorEntity();
                target.VendorID = source.VendorID;
                target.Vendor   = source.Vendor1;
                target.Address  = source.AddressLine1;
                target.City     = source.City;
                target.State    = source.State;
                target.Country  = source.Country;
                result.Add(target);
            }
            return(result);
        }
Exemplo n.º 13
0
 private void PopulateGrid()
 {
     try
     {
         DataTable dt = new DataTable();
         dt = VendorBL.PopulateVendorDetList(m_iVenId, m_sSuppType, m_sItemId);
         grdAsset.DataSource = dt;
         //VendorId,VendorName
         grdViewAsset.Columns["VendorId"].Visible = false;
         grdViewAsset.Columns["Sel"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
         grdViewAsset.Columns["VendorName"].OptionsColumn.AllowEdit          = false;
         grdViewAsset.Columns["VendorName"].Width = 240;
         grdViewAsset.Columns["Sel"].Width        = 50;
         grdViewAsset.OptionsView.ColumnAutoWidth = true;
         grdViewAsset.Appearance.HeaderPanel.Font = new Font(grdViewAsset.Appearance.HeaderPanel.Font, FontStyle.Bold);
     }
     catch (Exception ex)
     {
         BsfGlobal.CustomException(ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 14
0
        public void BindVendorMaterialList()
        {
            ApplicationResult objResult   = new ApplicationResult();
            VendorBL          objVendorBL = new VendorBL();

            objResult = objVendorBL.Vendor_MaterialListReport();
            if (objResult.resultDT.Rows.Count > 0)
            {
                gvReport.DataSource = objResult.resultDT;
                gvReport.DataBind();

                divReport.Visible = true;
                //btnPrintDetail.Visible = true;
                lblTrust.Text = Session[ApplicationSession.TRUSTNAME].ToString();
            }
            else
            {
                divReport.Visible = false;
                ClearAll();
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('No Records Found.');", true);
            }
        }
Exemplo n.º 15
0
 private void btnDelVen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     VendorBL.DeleteVendorDetailsWithoutMaster();
 }
Exemplo n.º 16
0
 public VendorController()
 {
     VendorBL = new VendorBL();
 }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    VendorBE objVendor    = new VendorBE();
                    VendorBL objBL_Vendor = new VendorBL();

                    objVendor.IdVendor        = IdVendor;
                    objVendor.NameVendor      = txtNameVendor.Text;
                    objVendor.FlagNational    = (chkNational.Checked) ? true : false;
                    objVendor.FlagForeigner   = (chkForeigner.Checked) ? true : false;
                    objVendor.RevenueDate     = Convert.ToDateTime(deRevenueDate.DateTime.ToShortDateString());
                    objVendor.IdStatus        = (int)cboStatus.EditValue;
                    objVendor.Ruc             = txtRuc.Text;
                    objVendor.NameVendor      = txtNameVendor.Text;
                    objVendor.IdEvaluation    = (int)cboEvaluation.EditValue;
                    objVendor.Code            = txtVendorCode.Text;
                    objVendor.Corporation     = txtCorporation.Text;
                    objVendor.Capacity        = Convert.ToDecimal(txtCapacity.EditValue);
                    objVendor.Representative  = txtRepresentative.Text;
                    objVendor.NumberEmployees = Convert.ToInt32(txtNumberEmployees.EditValue);
                    objVendor.FlagState       = true;
                    objVendor.Login           = Parametros.strUsuarioLogin;
                    objVendor.Machine         = WindowsIdentity.GetCurrent().Name.ToString();
                    objVendor.IdCompany       = Parametros.intEmpresaId;

                    //Vendor ADDRESS
                    List <VendorAddressBE> lstVendorAddress = new List <VendorAddressBE>();

                    foreach (var item in mListaVendorAddressOrigen)
                    {
                        VendorAddressBE objE_VendorAddress = new VendorAddressBE();
                        objE_VendorAddress.IdCompany       = Parametros.intEmpresaId;
                        objE_VendorAddress.IdVendor        = IdVendor;
                        objE_VendorAddress.IdVendorAddress = item.IdVendorAddress;
                        objE_VendorAddress.IdType          = item.IdType;
                        objE_VendorAddress.Email           = item.Email;
                        objE_VendorAddress.WebPage         = item.WebPage;
                        objE_VendorAddress.Address         = item.Address;
                        objE_VendorAddress.IdUbigeo        = item.IdUbigeo;
                        objE_VendorAddress.City            = item.City;
                        objE_VendorAddress.State           = item.State;
                        objE_VendorAddress.IdCountry       = item.IdCountry;
                        objE_VendorAddress.Phone1          = item.Phone1;
                        objE_VendorAddress.Phone2          = item.Phone2;
                        objE_VendorAddress.Fax             = item.Fax;
                        objE_VendorAddress.Reference       = item.Reference;
                        objE_VendorAddress.FlagState       = true;
                        objE_VendorAddress.Login           = Parametros.strUsuarioLogin;
                        objE_VendorAddress.Machine         = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_VendorAddress.TipoOper        = item.TipoOper;
                        lstVendorAddress.Add(objE_VendorAddress);
                    }

                    //Vendor CONTACT
                    List <VendorContactBE> lstVendorContact = new List <VendorContactBE>();

                    foreach (var item in mListaVendorContactOrigen)
                    {
                        VendorContactBE objE_VendorContact = new VendorContactBE();
                        objE_VendorContact.IdCompany             = Parametros.intEmpresaId;
                        objE_VendorContact.IdVendor              = IdVendor;
                        objE_VendorContact.IdVendorContact       = item.IdVendorContact;
                        objE_VendorContact.Name                  = item.Name;
                        objE_VendorContact.FirstName             = item.FirtsName;
                        objE_VendorContact.Company               = item.Company;
                        objE_VendorContact.Occupation            = item.Occupation;
                        objE_VendorContact.IdDestination         = item.IdDestination;
                        objE_VendorContact.Phone1                = item.Phone1;
                        objE_VendorContact.Phone2                = item.Phone2;
                        objE_VendorContact.CelPhone              = item.CelPhone;
                        objE_VendorContact.Fax                   = item.Fax;
                        objE_VendorContact.Email                 = item.Email;
                        objE_VendorContact.InformationAdditional = item.InformationAdditional;
                        objE_VendorContact.FlagState             = true;
                        objE_VendorContact.Login                 = Parametros.strUsuarioLogin;
                        objE_VendorContact.Machine               = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_VendorContact.TipoOper              = item.TipoOper;
                        lstVendorContact.Add(objE_VendorContact);
                    }

                    //Vendor Classification
                    List <VendorClassificationBE> lstVendorClassification = new List <VendorClassificationBE>();

                    foreach (var item in mListaVendorClassificationOrigen)
                    {
                        VendorClassificationBE objE_VendorClassification = new VendorClassificationBE();
                        objE_VendorClassification.IdCompany = Parametros.intEmpresaId;
                        objE_VendorClassification.IdVendor  = IdVendor;
                        objE_VendorClassification.IdVendorClassification = item.IdVendorClassification;
                        objE_VendorClassification.IdClassification       = item.IdClassification;
                        objE_VendorClassification.NameClassification     = item.NameClassification;
                        objE_VendorClassification.FlagActive             = item.FlagActive;
                        objE_VendorClassification.FlagState = true;
                        objE_VendorClassification.Login     = Parametros.strUsuarioLogin;
                        objE_VendorClassification.Machine   = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_VendorClassification.TipoOper  = item.TipoOper;
                        lstVendorClassification.Add(objE_VendorClassification);
                    }


                    if (pOperacion == Operacion.Nuevo)
                    {
                        objBL_Vendor.Inserta(objVendor, lstVendorAddress, lstVendorContact, lstVendorClassification);
                        XtraMessageBox.Show("the vendor record was created.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        objBL_Vendor.Actualiza(objVendor, lstVendorAddress, lstVendorContact, lstVendorClassification);
                        XtraMessageBox.Show("the vendor record was updated.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ApplicationResult objResults  = new ApplicationResult();
                VendorBO          objVendorBO = new VendorBO();
                VendorBL          objVendorBL = new VendorBL();

                objVendorBO.VendorName         = txtVendorName.Text;
                objVendorBO.Address            = txtAddress.Text;
                objVendorBO.TelephoneNo        = txtTelephoneNo.Text;
                objVendorBO.MobileNo           = txtMobileNo.Text;
                objVendorBO.Fax                = txtFax.Text;
                objVendorBO.EmailID            = txtEmail.Text;
                objVendorBO.TINGST             = txtTinGst.Text;
                objVendorBO.TINCST             = txtTinCst.Text;
                objVendorBO.BankName           = txtBankName.Text;
                objVendorBO.AccountNo          = txtAccountNo.Text;
                objVendorBO.AccountName        = txtAccountName.Text;
                objVendorBO.IFSCCode           = txtIFSCCode.Text;
                objVendorBO.PANNO              = txtPanNo.Text;
                objVendorBO.TaxRegNo           = txtTaxRegNo.Text;
                objVendorBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                objVendorBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                int intClear = 1;

                if (ViewState["Mode"].ToString() == "Save")
                {
                    objVendorBO.CreatedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                    objVendorBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                    objResults = objVendorBL.Vendor_Insert(objVendorBO);
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        intClear = 1;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor Created Successfully.');</script>");
                    }
                    else
                    {
                        intClear = 0;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Vendor is already exist.');</script>");
                    }
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    objVendorBO.VendorID = Convert.ToInt32(ViewState["VendorID"].ToString());
                    objResults           = objVendorBL.Vendor_Update(objVendorBO);
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        intClear = 1;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Vendor updated successfully.');</script>");
                    }
                    else
                    {
                        intClear = 0;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Unit Name is already exist.');</script>");
                    }
                }
                if (intClear == 1)
                {
                    ClearAll();
                    GridDataBind();
                }
                else
                {
                    txtVendorName.Text = "";
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }