Exemplo n.º 1
0
    protected void GridDefaultUserRights_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataSet     dsTasks3   = (DataSet)Session["MasterRoles"];
                LinkButton  lblRole    = (LinkButton)e.Row.FindControl("lblRoleNamre");
                HiddenField Paymst     = (HiddenField)e.Row.FindControl("hdnRoleId");
                Label       lblVehType = (Label)e.Row.FindControl("lblVehType");
                lblVehType.Text = "Default";
                try
                {
                    DataSet GetUserDefaultRight = new DataSet();
                    string  Paystats            = Paymst.Value;
                    GetUserDefaultRight = objHotLeadBL.GetUserDefaultRights(Convert.ToInt32(Paystats));

                    for (int i = 0; i <= 5; i++)
                    {
                        Label lblLeads     = (Label)e.Row.FindControl("lblLeads");
                        Label LblTransfers = (Label)e.Row.FindControl("LblTransfers");
                        Label lblabondons  = (Label)e.Row.FindControl("lblabondons");
                        Label lblfreepots  = (Label)e.Row.FindControl("lblfreepots");

                        Label lblintromail   = (Label)e.Row.FindControl("lblintromail");
                        Label lblNeEntry     = (Label)e.Row.FindControl("lblNeEntry");
                        Label lblTransferOut = (Label)e.Row.FindControl("lblTransferOut");
                        Label lblTicker      = (Label)e.Row.FindControl("lblTicker");

                        Label lblSelf   = (Label)e.Row.FindControl("lblSelf");
                        Label lblCenter = (Label)e.Row.FindControl("lblCenter");

                        Label lblAdmin = (Label)e.Row.FindControl("lblAdmin");

                        //1 Leads
                        if (GetUserDefaultRight.Tables[0].Rows[0]["IsActive"].ToString() == "False")
                        {
                            LblTransfers.Text = ""; lblabondons.Text = ""; lblLeads.Text = ""; lblfreepots.Text = "";
                        }
                        else
                        {
                            LblTransfers.Text = "Y"; lblabondons.Text = "Y"; lblLeads.Text = "Y"; lblfreepots.Text = "Y";
                        }
                        //Sales
                        if (GetUserDefaultRight.Tables[0].Rows[1]["IsActive"].ToString() == "False")
                        {
                            lblintromail.Text = ""; lblNeEntry.Text = ""; lblTransferOut.Text = ""; lblTicker.Text = "";
                        }
                        else
                        {
                            lblintromail.Text = "Y"; lblNeEntry.Text = "Y"; lblTransferOut.Text = "Y"; lblTicker.Text = "Y";
                        }
                        //3 Reports
                        //4 Process
                        if (GetUserDefaultRight.Tables[0].Rows[3]["IsActive"].ToString() == "False")
                        {
                            if (lblRole.Text == "Center Manager")
                            {
                                lblSelf.Text = ""; lblCenter.Text = "Y";
                            }
                            else
                            {
                                lblSelf.Text = ""; lblCenter.Text = "";
                            }
                        }
                        else
                        {
                            if (lblRole.Text == "Center Manager")
                            {
                                lblSelf.Text = "Y"; lblCenter.Text = "Y";
                            }
                            else
                            {
                                lblSelf.Text = "Y"; lblCenter.Text = "";
                            }
                        }
                        //Admin
                        if ((GetUserDefaultRight.Tables[0].Rows[4]["IsActive"].ToString() == "False"))
                        {
                            lblAdmin.Text = "";
                        }
                        else
                        {
                            lblAdmin.Text = "Y";
                        }
                        //2sales

                        //3 Process

                        //4 Reports

                        //5 admin
                    }
                }
                catch { }
            }
        }
        catch { }
    }