private void LoadContactsDropdowns()
        {
            Business.Sales.Contacts       Obj        = new Business.Sales.Contacts();
            Business.Sales.Account        AccountObj = new Business.Sales.Account();
            Entity.Sales.GetAccountsParam Param      = new Entity.Sales.GetAccountsParam
            {
                Name                 = null,
                OfficePhone          = null,
                SourceActivityTypeId = Convert.ToInt32(ActityType.Customer),
                ChildActivityTypeId  = Convert.ToInt32(ActityType.Account)
            };
            if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
            {
                Param.AssignEngineer = 0;
            }
            else
            {
                Param.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name);
            }
            ddlAccount.DataSource     = AccountObj.GetAllAccounts(Param);
            ddlAccount.DataTextField  = "Name";
            ddlAccount.DataValueField = "Id";
            ddlAccount.DataBind();
            ddlAccount.InsertSelect();

            ddlDesignation.DataSource     = Obj.GetDesignations();
            ddlDesignation.DataTextField  = "DesignationName";
            ddlDesignation.DataValueField = "DesignationMasterId";
            ddlDesignation.DataBind();
            ddlDesignation.InsertSelect();
        }
        protected void ddlLinkName_SelectedIndexChange(object sender, EventArgs e)
        {
            try
            {
                hdnOpenForm.Value = "true";
                if (ddlLinkName.SelectedIndex != 0)
                {
                    Business.Sales.Account Obj     = new Business.Sales.Account();
                    Entity.Sales.Accounts  Account = Obj.GetAccountById(Convert.ToInt32(ddlLinkName.SelectedValue), Convert.ToInt32(ActityType.Customer), Convert.ToInt32(ActityType.Account));
                    if (Account.Id != 0)
                    {
                        txtDescription.Text = Account.Description;
                        txtName.Text        = Account.Name;
                        txtOfficePhone.Text = Account.OfficePhone;
                        txtWebsite.Text     = Account.Website;
                    }
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
        private void LoadLeadSource()
        {
            Business.Sales.Account Obj = new Business.Sales.Account();

            ddlLeadSource.DataSource     = Obj.GetLeadSource();
            ddlLeadSource.DataTextField  = "Name";
            ddlLeadSource.DataValueField = "Id";
            ddlLeadSource.DataBind();
            ddlLeadSource.InsertSelect();
        }
        private void LoadCustomerType()
        {
            Business.Sales.Account Obj = new Business.Sales.Account();

            ddlCustomerType.DataSource     = Obj.GetCustomerType();
            ddlCustomerType.DataTextField  = "Name";
            ddlCustomerType.DataValueField = "Id";
            ddlCustomerType.DataBind();
            ddlCustomerType.InsertSelect();
        }
        protected void gvAccounts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Ed")
                {
                    AccountId = Convert.ToInt32(e.CommandArgument.ToString());
                    GetAccountById();
                    LoadSocialMediaList();
                    Message.Show = false;
                    btnSave.Text = "Update";
                    PopulateItems();
                    hdnOpenForm.Value = "true";
                }
                else if (e.CommandName == "View")
                {
                    AccountId = Convert.ToInt32(e.CommandArgument.ToString());
                    GetAccountById();
                    PopulateItems();
                    LoadSocialMediaList();
                    hdnOpenForm.Value = "true";
                }
                else if (e.CommandName == "Del")
                {
                    Business.Sales.Account Obj = new Business.Sales.Account();
                    int rows = Obj.DeleteAccounts(Convert.ToInt32(e.CommandArgument.ToString()));
                    if (rows > 0)
                    {
                        ClearControls();
                        LoadAccountList();
                        Message.IsSuccess = true;
                        Message.Text      = "Deleted Successfully";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Data Dependency Exists";
                    }
                    Message.Show = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
 private void Save()
 {
     if (AccountControlValidation())
     {
         Business.Sales.Account Obj   = new Business.Sales.Account();
         Entity.Sales.Accounts  Model = new Entity.Sales.Accounts
         {
             Id                   = AccountId,
             LeadSourceId         = ddlLeadSource.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlLeadSource.SelectedValue),
             CustomerTypeId       = ddlCustomerType.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlCustomerType.SelectedValue),
             CreatedBy            = Convert.ToInt32(HttpContext.Current.User.Identity.Name),
             Description          = txtDescription.Text,
             Name                 = txtName.Text,
             Industry             = txtIndustry.Text,
             SourceName           = txtSourceName.Text,
             AccountScore         = txtAccountScore.Text == "" ? (decimal?)null : Convert.ToDecimal(txtAccountScore.Text),
             AnualRevenue         = txtAnnualRevenue.Text == "" ? (decimal?)null : Convert.ToDecimal(txtAnnualRevenue.Text),
             EmployeeStrength     = Convert.ToInt32(txtEmployeeStrength.Text),
             OfficePhone          = txtOfficePhone.Text,
             Website              = txtWebsite.Text,
             IsActive             = true,
             ActivityLinkId       = ActivityLinkId,
             ChildActivityTypeId  = Convert.ToInt32(ActityType.Account),
             SourceActivityTypeId = Convert.ToInt32(ActityType.Customer),
             SourceActivityId     = txtCustomerName.Text == "" ? (int?)null : Convert.ToInt32(GetCustomerIdByName(txtCustomerName.Text))
         };
         int rows = Obj.SaveAccounts(Model);
         if (rows > 0)
         {
             ClearControls();
             LoadAccountList();
             AccountId         = 0;
             Message.IsSuccess = true;
             Message.Text      = "Saved Successfully";
         }
         else
         {
             Message.IsSuccess = false;
             Message.Text      = "Unable to save data.";
         }
         Message.Show = true;
     }
 }
        private void LoadAccountList()
        {
            Business.Sales.Account        Obj   = new Business.Sales.Account();
            Entity.Sales.GetAccountsParam Param = new Entity.Sales.GetAccountsParam {
                Name = null, OfficePhone = null, SourceActivityTypeId = Convert.ToInt32(ActityType.Customer), ChildActivityTypeId = Convert.ToInt32(ActityType.Account)
            };

            if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
            {
                Param.AssignEngineer = 0;
            }
            else
            {
                Param.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name);
            }

            gvAccounts.DataSource = Obj.GetAllAccounts(Param);
            gvAccounts.DataBind();
        }
示例#8
0
 private void LoadAccountList()
 {
     Business.Sales.Account        objAccount       = new Business.Sales.Account();
     Entity.Sales.GetAccountsParam getAccountsParam = new Entity.Sales.GetAccountsParam {
         Name = null, OfficePhone = null, SourceActivityTypeId = Convert.ToInt32(ActityType.Customer), ChildActivityTypeId = Convert.ToInt32(ActityType.Account)
     };
     if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
     {
         getAccountsParam.AssignEngineer = 0;
     }
     else
     {
         getAccountsParam.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name);
     }
     ddlAccounts.DataSource     = objAccount.GetAllAccounts(getAccountsParam);
     ddlAccounts.DataTextField  = "Name";
     ddlAccounts.DataValueField = "Id";
     ddlAccounts.DataBind();
 }
 private void GetAccountById()
 {
     Business.Sales.Account Obj     = new Business.Sales.Account();
     Entity.Sales.Accounts  Account = Obj.GetAccountById(AccountId, Convert.ToInt32(ActityType.Customer), Convert.ToInt32(ActityType.Account));
     if (Account.Id != 0)
     {
         ddlLeadSource.SelectedValue   = Account.LeadSourceId == null ? "0" : Account.LeadSourceId.ToString();
         ddlCustomerType.SelectedValue = Account.CustomerTypeId == null ? "0" : Account.CustomerTypeId.ToString();
         txtDescription.Text           = Account.Description;
         txtAccountScore.Text          = Account.AccountScore.ToString();
         txtAnnualRevenue.Text         = Account.AnualRevenue.ToString();
         txtEmployeeStrength.Text      = Account.EmployeeStrength.ToString();
         txtIndustry.Text     = Account.Industry;
         txtName.Text         = Account.Name;
         txtOfficePhone.Text  = Account.OfficePhone;
         txtSourceName.Text   = Account.SourceName;
         txtWebsite.Text      = Account.Website;
         txtCustomerName.Text = Account.CustomerName;
         ActivityLinkId       = Account.ActivityLinkId;
     }
 }