Ejemplo n.º 1
0
        protected void cbxCompany_SaveClick(object sender, EventArgs e)
        {
            try
            {
                int result = 0;
                objCompanyMasterDal = new CompanyMasterDal();

                switch (mvCompany.GetActiveView().ID)
                {
                    case "vwCompany":

                        switch (acbCompany.SaveButton.CommandName)
                        {
                            case "Save":
                                Save();

                                break;
                            case "Update":
                                Update();

                                break;
                        }


                        break;
                    case "vwContact":
                        switch (cbxCompany.SaveButton.CommandName)
                        {
                            case "Save":
                                SaveContact();
                                break;
                            case "Update":
                                UpdateContact();

                                acbCompany.EditableMode = false;
                                break;
                        }

                        rtsCompanyDetails.Tabs[0].Enabled = true;

                        break;
                }


                objCompanyMasterDal = new CompanyMasterDal();

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Ejemplo n.º 2
0
        protected void acbCompany_DeleteClick(object sender, EventArgs e)
        {

            int result = 0;
            try
            {
                switch (mvCompany.GetActiveView().ID)
                {
                    case "vwCompany":

                        StringBuilder CompanyId = new StringBuilder();

                        if (ViewState[PageConstants.vsItemIndexes] != null)
                            htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];

                        if (htItemIndex != null)
                        {
                            foreach (int i in htItemIndex.Values)
                            {
                                Label lblCompanyId = (Label)radgrdCompany.Items[i].FindControl("lblCompIdItem");

                                if (lblCompanyId != null)
                                {
                                    CompanyId.Append(lblCompanyId.Text + ",");
                                }
                            }
                        }

                        objCompanyMasterDal = new CompanyMasterDal();
                        String CmpId = CompanyId.ToString().TrimEnd(',');
                        result = objCompanyMasterDal.DeleteCompany(CmpId);
                        BindGrid();

                        break;
                    case "vwContact":

                        StringBuilder ContactSrNoId = new StringBuilder();

                        if (ViewState[vsItemIndexesCt] != null)
                            htItemIndexCt = (Hashtable)ViewState[vsItemIndexesCt];

                        if (htItemIndexCt != null)
                        {
                            foreach (int i in htItemIndexCt.Values)
                            {
                                Label lblContactSrnoId = (Label)radgrdContact.Items[i].FindControl("lblGrdCustIdItem");

                                if (lblContactSrnoId != null)
                                {
                                    ContactSrNoId.Append(lblContactSrnoId.Text + ",");
                                }
                            }
                        }
                        objCompanyMasterDal = new CompanyMasterDal();
                        String ContactSrNos = ContactSrNoId.ToString().TrimEnd(',');
                        result = objCompanyMasterDal.DeleteContact(ContactSrNos);
                        BindContactGrid(Convert.ToInt32(Session["COMPANY_ID"]), "");
                        break;
                }









                if (result == 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
                    Master.MessageCssClass = "successMessage";
                    ViewState[PageConstants.vsItemIndexes] = null;
                    BindGrid();
                }
                else if (result == 547)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }


            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Ejemplo n.º 3
0
        protected void acbCompany_SearchClick(object sender, EventArgs e)
        {
            try
            {

                switch (mvCompany.GetActiveView().ID)
                {
                    case "vwCompany":


                        objCompanyMasterDal = new CompanyMasterDal();
                        DataSet dsCompany = objCompanyMasterDal.GetCompany(acbCompany.SearchTextBox.Text);
                        radgrdCompany.DataSource = dsCompany;
                        radgrdCompany.DataBind();
                        ViewState[vsCompany] = dsCompany;
                        break;

                    case "vwContact":

                        BindContactGrid(Convert.ToInt32(Session["COMPANY_ID"]), acbCompany.SearchTextBox.Text);
                        break;
                }



            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }
Ejemplo n.º 4
0
        private void DeleteContact()
        {
            try
            {
                int result = 0;
                objCompanyMasterDal = new CompanyMasterDal();

                String xmlData = GenerateDeleteXmlString(radgrdContact);

                result = objCompanyMasterDal.DeleteContact(xmlData);

                if (result == 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                    Master.MessageCssClass = "successMessage";
                    ViewState[vsItemIndexesCt] = null;
                    BindContactGrid(Convert.ToInt32(Session["COMPANY_ID"]), "");

                }
                else
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }
Ejemplo n.º 5
0
        private void SaveDepartmentCompanyMap(int CompanyId)
        {
            try
            {
                int result = 0;
                String DepartmentIdList = String.Empty;

                for (int i = 0; i < lstAssignDeptName.Items.Count; i++)
                {
                    if (DepartmentIdList == string.Empty)
                    {
                        DepartmentIdList = lstAssignDeptName.Items[i].Value;
                    }
                    else
                    {
                        DepartmentIdList = DepartmentIdList + "," + lstAssignDeptName.Items[i].Value;
                    }

                }


                objCompanyMasterDal = new CompanyMasterDal();
                result = objCompanyMasterDal.InsertDepartmentCompanyMap(CompanyId, DepartmentIdList);
                

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Ejemplo n.º 6
0
        private void UpdateContact()
        {
            try
            {
                int result = 0;
                objCompanyMasterDal = new CompanyMasterDal();

                String xmlData = GenerateXmlString(radgrdContact);

                result = objCompanyMasterDal.UpdateContact(xmlData);

                if (result == 1)
                {


                    Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                    Master.MessageCssClass = "successMessage";
                    bisEdit = false;
                    acbCompany.Visible = true;
                    cbxCompany.Visible = false;
                    acbCompany.DefaultMode = true;


                    if (ViewState[vsItemIndexesCt] != null)
                    {
                        htItemIndexCt = (Hashtable)ViewState[vsItemIndexesCt];

                        for (int i = 0; i < htItemIndexCt.Count; i++)
                            radgrdContact.Items[Convert.ToInt32(htItemIndexCt[i].ToString())].Edit = false;
                        bisEdit = false;
                        ViewState[vsItemIndexesCt] = null;
                        radgrdContact.Rebind();

                    }

                    BindContactGrid(Convert.ToInt32(Session["COMPANY_ID"]), "");

                }
                else
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }
Ejemplo n.º 7
0
        private void SaveContact()
        {
            try
            {
                int result = 0;

                CompanyContactBDto objCompanyContactBdto = new CompanyContactBDto();
                objCompanyMasterDal = new CompanyMasterDal();
                objCompanyContactBdto.Name = txtName.Text.Trim();
                objCompanyContactBdto.Mobile = txtPersonMobile.Text.Trim();
                objCompanyContactBdto.Phone = txtPersonPhone.Text.Trim();
                objCompanyContactBdto.TitleId = Convert.ToInt32(radCmbTitle.SelectedValue);
                objCompanyContactBdto.Email = txtPersonEmail.Text.Trim();
                objCompanyContactBdto.CompanyId = Convert.ToInt32(Session["COMPANY_ID"]);
                result = objCompanyMasterDal.InsertCompanyContact(objCompanyContactBdto);

                if (result >= 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
                    Master.MessageCssClass = "successMessage";
                    bisEdit = false;
                    ResetContact();
                    pnlContactAdd.Visible = false;
                    acbCompany.DefaultMode = true;
                    acbCompany.Visible = true;
                    cbxCompany.Visible = false;
                    pnlContactGrid.Visible = true; ;

                }
                else
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
                BindContactGrid(Convert.ToInt32(Session["COMPANY_ID"]), "");
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Ejemplo n.º 8
0
        private void Update()
        {
            try
            {
                int result = 0;
                objCompanyMasterDal = new CompanyMasterDal();
                CompanyBDto objCompanyBdto = new CompanyBDto();
                objCompanyBdto.CompanyType = radCmbType.SelectedValue;
                objCompanyBdto.CompanyName = txtCompanyName.Text.Trim();
                objCompanyBdto.AddressLine1 = txtAddressline1.Text.Trim();
                objCompanyBdto.AddressLine2 = txtAddressline2.Text.Trim();
                objCompanyBdto.CityId = Convert.ToInt32(radCmbCity.SelectedValue);
                objCompanyBdto.StateId = Convert.ToInt32(radCmbState.SelectedValue);
                objCompanyBdto.CountryId = Convert.ToInt32(radCmbCountry.SelectedValue);
                objCompanyBdto.Mobile = txtMobile.Text;
                objCompanyBdto.Pincode = txtPinCode.Text.ToString().Trim();
                objCompanyBdto.Phone = txtPhone.Text.ToString().Trim();
                objCompanyBdto.Fax = txtFax.Text.ToString().Trim();
                objCompanyBdto.Email = txtEmailId.Text.Trim();

                if (radCmbRegion.SelectedValue != "0")
                {
                    objCompanyBdto.RegionId = Convert.ToInt32(radCmbRegion.SelectedValue);
                }
                else
                {
                    objCompanyBdto.RegionId = 0;
                }

                objCompanyBdto.UserId = objAuthorizationBDto.UserProfile.UserId;
                objCompanyBdto.CompanyId = Convert.ToInt32(Session["COMPANY_ID"]);
                objCompanyBdto.ParentCompanyId = Convert.ToInt32(radCmbUnderWhome.SelectedValue);

                #region Update Saving Images

                byte[] image;
                string phototype = "";
                try
                {
                    string DefaultImage = imgCompany.ImageUrl;
                    if (Session["ImageData"] == null)
                    {
                        image = (byte[])ViewState["ImageData"];

                        lblFilePath.Text = "";
                    }
                    else
                    {
                        image = (byte[])Session["ImageData"];// FileUpload_Photo.FileBytes;
                        phototype = Session["ImageType"].ToString();

                    }
                }
                catch (Exception ex)
                {
                    image = null;
                    phototype = "";
                }


                objCompanyBdto.Photo = image;
                objCompanyBdto.Phototype = phototype;


                #endregion 

                result = objCompanyMasterDal.UpdateCompany(objCompanyBdto);

                if (result == 1)
                {

                    SaveDepartmentCompanyMap(Convert.ToInt32(Session["COMPANY_ID"]));
                    acbCompany.DefaultMode = true;
                    Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                    Master.MessageCssClass = "successMessage";
                    bisEdit = false;
                    ViewState[PageConstants.vsItemIndexes] = null;
                    BindGrid();

                    cbxCompany.SaveButton.Enabled = false;
                    acbCompany.SaveButton.CommandName = "Save";



                }
                else if (result == -1)
                {
                    Master.DisplayMessage("Head office Already Exist");
                    Master.MessageCssClass = "errorMessage";

                }
                else
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Ejemplo n.º 9
0
        public void BindContactGrid(int CompanyId, String SearchParam)
        {
            objCompanyMasterDal = new CompanyMasterDal();
            DataSet dsContact = objCompanyMasterDal.GetContactDetails(CompanyId, SearchParam);

            radgrdContact.DataSource = dsContact;
            radgrdContact.DataBind();
            ViewState[vsContact] = dsContact;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Bind Company grid
        /// </summary>

        private void BindGrid()
        {

            objCompanyMasterDal = new CompanyMasterDal();
            DataSet dsCompany = objCompanyMasterDal.GetCompany("");
            radgrdCompany.DataSource = dsCompany;
            radgrdCompany.DataBind();
            ViewState[vsCompany] = dsCompany;

        }