Exemplo n.º 1
0
        public void BindDropdowns()
        {
            DataTable dtJobType = compassBAL.GetJobTypeBAL();

            BindDropdown(ddlJobType, "jobName", "Id", dtJobType, "Select JobType");

            DataTable dtPriorityType = compassBAL.GetPriorityBAL();

            BindDropdown(ddlPriority, "PriorityType", "Id", dtPriorityType, "Select Priority");

            DataTable dtBranch = compassBAL.GetBranchBAL();

            BindDropdown(ddlBranch, "BranchName", "Id", dtBranch, "Select Branch");

            //Set Branch Id (for client user login)
            int branchId = 0;

            if (int.TryParse(Session["BranchId"].ToString(), out branchId))
            {
                if (ddlBranch.Items.FindByValue(branchId.ToString()) != null)
                {
                    ddlBranch.SelectedValue = branchId.ToString();
                }
            }

            var clientid = Convert.ToInt32(Session["ClientId"]);

            DataTable dtUsers = compassBAL.GetUserBAL(clientid, branchId);

            BindDropdown(ddlUsers, "UserName", "Id", dtUsers, "Select User");
        }
Exemplo n.º 2
0
        public void BindDropdowns()
        {
            DataTable dtJobType = compassBAL.GetJobTypeBAL();

            BindDropdown(ddlJobType, "jobName", "Id", dtJobType, "All JobTypes");

            DataTable dtPriorityType = compassBAL.GetPriorityBAL();

            BindDropdown(ddlPriority, "PriorityType", "Id", dtPriorityType, "All Priorities");

            DataTable dtBranch = compassBAL.GetBranchBAL();

            BindDropdown(ddlBranch, "BranchName", "Id", dtBranch, "All Branches");


            bool IsServiceCompanyUser = Convert.ToBoolean(Session["IsServiceCompanyUser"]);

            if (IsServiceCompanyUser)
            {
                DataTable dtUsers = compassBAL.GetUserForServiceCompanyBAL(0);
                ddlUser.Enabled = true;
                BindDropdown(ddlUser, "UserName", "Id", dtUsers, "All Users");
            }
            else
            {
                BindDropdown(ddlUser, "UserName", "Id", null, "All Users");
                ddlUser.Enabled = false;
                ddlUser.Items.Insert(0, new ListItem("All Users", "0"));
            }

            DataTable dtStatus = compassBAL.GetStatusBAL();

            lstStatus.DataSource     = dtStatus;
            lstStatus.DataTextField  = "Status";
            lstStatus.DataValueField = "Id";
            lstStatus.DataBind();

            DataTable dtTeam = compassBAL.GetTeamBAL();

            BindDropdown(ddlTeam, "Name", "Id", dtTeam, "All Teams");

            int branchId = 0;

            if (Session["BranchId"] != null)
            {
                if (int.TryParse(Session["BranchId"].ToString(), out branchId))
                {
                    if (ddlBranch.Items.FindByValue(branchId.ToString()) != null)
                    {
                        ddlBranch.SelectedValue = branchId.ToString();
                    }
                }
            }
            var clientid = Convert.ToInt32(Session["ClientId"]);

            DataTable dtUserSubmittedBy = compassBAL.GetUserBAL(clientid, branchId: 0);

            BindDropdown(ddlUserSubmittedBy, "UserName", "Id", dtUserSubmittedBy, "Select User");


            int UserTypeId = 0;

            if (Session["UserTypeId"] != null)
            {
                if (int.TryParse(Session["UserTypeId"].ToString(), out UserTypeId))
                {
                    if (UserTypeId == 2) // User if of Branch Type
                    {
                        ddlBranch.Enabled = false;
                        //ddlUserSubmittedBy.SelectedItem.Text =  Convert.ToString(Session["UserName"]);
                        //ddlUserSubmittedBy.Enabled = false;
                    }
                }
            }
        }