コード例 #1
0
        private bool CheckRole(string strRole)
        {
            clsBALUsers objclsBALUsers = new clsBALUsers();
            bool        blnExists      = objclsBALUsers.CheckRole(strRole);

            return(blnExists);
        }
コード例 #2
0
        public void PopulateGrid()
        {
            clsBALCommon objclsBALComm  = new clsBALCommon();
            string       strCurQuarter  = objclsBALComm.GetLatestQuarter();
            string       strPrevQuarter = PreviousQuarter(strCurQuarter);
            clsBALUsers  objclsBALUsers = new clsBALUsers();
            //DataSet ds = objclsBALUsers.GetNewUsers(strCurQuarter,strPrevQuarter);
            DataSet ds = objclsBALUsers.GetNewUsers(ddlQuarter.SelectedItem.Text, strPrevQuarter);


            if (ds.Tables[0].Rows.Count > 0)
            {
                gvNewUsers.DataSource = ds;
                gvNewUsers.DataBind();
                Session[clsEALSession.ReportUsers] = ds;
                btnExport.Visible = true;
            }
            else
            {
                gvNewUsers.DataSource = null;
                gvNewUsers.DataBind();
                Session[clsEALSession.ReportUsers] = null;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('No records found');", true);
            }
        }
コード例 #3
0
        protected void gvSchedule_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                clsBALUsers objBI_User = new clsBALUsers();

                Label  lblGroupID = (Label)gvSchedule.Rows[e.RowIndex].FindControl("lblGroupID");
                string groupID    = lblGroupID.Text.ToString();


                objBI_User.DeleteScheduleMail(groupID, "Delete_Schedule");
                BindScheduleGrid();
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);

                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #4
0
        protected void GetCurrentUserRole()
        {
            try
            {
                objclsBALUsers = new clsBALUsers();

                role = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
                if (role != null)
                {
                    if (role.Contains <string>(clsEALRoles.GlobalApprover) && role.Contains <string>(clsEALRoles.ControlOwner))
                    {
                        pnlRole.Visible = true;
                        rdCO.Visible    = true;
                        rdGA.Visible    = true;
                        btnGo.Visible   = true;
                        lblRole.Visible = true;
                    }
                }

                Session[clsEALSession.UserRole] = role;
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                LogHelper.LogError(ex);
            }
        }
コード例 #5
0
        public void LockOut()
        {
            objclsBALUsers = new clsBALUsers();
            DataSet ds = objclsBALUsers.GetLockOut();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Session["lockout"] = ds.Tables[0].Rows[0][0].ToString();
            }
            if (role != null)
            {
                if (role.Contains <string>(clsEALRoles.ComplianceAdmin))
                {
                    //pnlLockOut.Visible = true;
                    lblLockout.Visible = true;
                    chkLock.Visible    = true;

                    if (Session["lockout"] != null)
                    {
                        //chkLock.Checked = bool.Parse(ds.Tables[0].Rows[0][0].ToString());
                        chkLock.Checked = bool.Parse(Session["lockout"].ToString());
                    }
                    // }
                }
                else
                {
                    //pnlLockOut.Visible = false;
                }
            }
        }
コード例 #6
0
 public void UpdateLockOut()
 {
     if (role != null)
     {
         if (role.Contains <string>(clsEALRoles.ComplianceAdmin))
         {
             objclsBALUsers = new clsBALUsers();
             string status = "";
             if (Session["lockout"] != null)
             {
                 string str = Session["lockout"].ToString();
                 if (str == "True")
                 {
                     status = "UnLock";
                 }
                 else if (str == "False")
                 {
                     status = "Lock";
                 }
                 objclsBALUsers.UpdateLockout(LoggedInUser, status);
                 LockOut();
             }
         }
     }
 }
コード例 #7
0
ファイル: Default.aspx.cs プロジェクト: LTIAvinashsSahu/CART
 protected void GetCurrentUserRole()
 {
     objclsBALUsers = new clsBALUsers();
     if (Session["RoleSelected"] == null)
     {
         role = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
         Session[clsEALSession.UserRole] = role;
         if (role != null)
         {
             if (role.Contains <string>(clsEALRoles.Approver))
             {
                 lblAnnounce.Text = "CART is an automated tool to assist in the compliance account access review process.";
             }
         }
     }
     else
     {
         role = objclsBALUsers.ApproverOrCO(objclsEALLoggedInUser);
         Session[clsEALSession.UserRole] = role;
         if (role != null)
         {
             Session["RoleSelected"] = role;
             Session["UserRole"]     = role;
         }
     }
 }
コード例 #8
0
 protected void GetCurrentUserRole()
 {
     objclsBALUsers = new clsBALUsers();
     role           = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
     if (!role.Contains <string>(clsEALRoles.ComplianceAdmin))
     {
         Response.Redirect("Home.aspx");
     }
 }
コード例 #9
0
 public void PopulateRoleDropDown(DropDownList ddlGridRole)
 {
     objclsBALUsers = new clsBALUsers();
     ddlGridRole.Items.Add("Compliance Administrator");
     ddlGridRole.Items.Add("Compliance Auditor");
     ddlGridRole.Items.Add("Compliance Tester");
     ddlGridRole.Items.Add("Global Approver");
     ddlGridRole.DataBind();
     ddlGridRole.Items.Insert(0, new ListItem("-- Select --", "0"));
 }
コード例 #10
0
        public void PopulateGrid()
        {
            objclsBALUsers = new clsBALUsers();
            DataSet ds = objclsBALUsers.GetUserDetails();

            gvRole.DataSource = ds;
            gvRole.DataBind();
            Session[clsEALSession.UserDetails] = ds;
            if (ViewState["SortExpression"] != null && ViewState["sortDirection"] != null)
            {
                SortGridView(ViewState["SortExpression"].ToString(), ViewState["sortDirection"].ToString());
            }
        }
コード例 #11
0
 protected void gvRole_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     lblError.Text   = "";
     lblSuccess.Text = "";
     try
     {
         Label        lblUserADID   = (Label)gvRole.Rows[e.RowIndex].FindControl("lblUserADID");
         string       strUsersADID  = lblUserADID.Text.ToString();
         DropDownList ddlGridRole   = (DropDownList)gvRole.Rows[e.RowIndex].FindControl("ddlGridRole");
         clsEALUser   objclsEALuser = new clsEALUser();
         objclsBALCommon = new clsBALCommon();
         objclsEALuser   = objclsBALCommon.FetchUserDetailsFromAD(strUsersADID);
         string strUserRole = ddlGridRole.SelectedItem.Value;
         if (objclsEALuser != null)
         {
             if (ddlGridRole.SelectedIndex != 0)
             {
                 objclsBALUsers = new clsBALUsers();
                 objclsBALUsers.UpdateUser(objclsEALuser, strUserRole, objclsEALLoggedInUser.StrUserADID);
                 lblSuccess.Text  = "User's role updated successfully.";
                 gvRole.EditIndex = -1;
                 PopulateGrid();
                 if (ViewState["SortExpression"] != null && ViewState["sortDirection"] != null)
                 {
                     SortGridView(ViewState["SortExpression"].ToString(), ViewState["sortDirection"].ToString());
                 }
             }
             else
             {
                 lblError.Text = "select role for user.";
             }
         }
         else
         {
             lblError.Text = "User Not Found.";
         }
     }
     catch (NullReferenceException)
     {
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
     catch (Exception ex)
     {
         HttpContext  context            = HttpContext.Current;
         LogException objclsLogException = new LogException();
         objclsLogException.LogErrorInDataBase(ex, context);
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
 }
コード例 #12
0
 protected void GetCurrentUserRole()
 {
     objclsBALUsers = new clsBALUsers();
     if (Session["RoleSelected"] != null)
     {
         role = (string[])Session["RoleSelected"];
     }
     else
     {
         role = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
     }
     if (!role.Contains <string>(clsEALRoles.ComplianceAdmin))
     {
         Response.Redirect("Home.aspx");
     }
 }
コード例 #13
0
        protected void btnAddComment_click(object sender, EventArgs e)
        {
            try
            {
                clsBALUsers objBI_User = new clsBALUsers();

                objBI_User.UpdateEmailBody(ViewState["lblGroupID"].ToString().Trim(), CommentEditor.Content.ToString());
                BindScheduleGrid();
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #14
0
        private bool CheckUserRoles(clsEALUser objclsEALUser)
        {
            objclsBALUsers = new clsBALUsers();
            string[] userRole = null;
            userRole = objclsBALUsers.GetCurrentUserRole(objclsEALUser);
            //Session[clsEALSession.UserRole] = userRole;
            bool flag = true;

            //string strRole = "";
            //for(int i=0;i<userRole.Length ;i++)
            //{
            //    strRole = userRole[i];
            //}
            if (userRole != null)
            {
                if (!userRole.Contains <string>(clsEALRoles.ComplianceAdmin) && !userRole.Contains <string>(clsEALRoles.ComplianceAuditor) && !userRole.Contains <string>(clsEALRoles.ComplianceTester) && !userRole.Contains <string>(clsEALRoles.GlobalApprover))
                {
                    if (!userRole.Contains <string>(clsEALRoles.ControlOwner) && !userRole.Contains <string>(clsEALRoles.Approver))
                    {
                        flag = false;//can assign role
                    }
                    else
                    {
                        flag          = true;//cant assign role
                        lblError.Text = "User is either Approver or Control Owner for some applications.";
                    }
                }
                else
                {
                    flag          = true;//cant assign role
                    lblError.Text = "User has already been assigned a role.";
                }
            }
            else
            {
                flag = false;//can assign role
            }

            return(flag);
        }
コード例 #15
0
 public void BindScheduleGrid()
 {
     try
     {
         objBI_Users = new clsBALUsers();
         DataTable dt = objBI_Users.GroupSchedule();
         Session["dtSchedule"] = dt;
         gvSchedule.DataSource = dt;
         gvSchedule.DataBind();
     }
     catch (NullReferenceException)
     {
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
     catch (Exception ex)
     {
         HttpContext  Context         = HttpContext.Current;
         LogException objLogException = new LogException();
         objLogException.LogErrorInDataBase(ex, Context);
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
 }
コード例 #16
0
        protected void btnDeleteAll_Click(object sender, EventArgs e)
        {
            try
            {
                //string UserAll = hdnUsersAll.Value;
                //  string EmailAll = hdnEmailsAll.Value;

                string selectedUser = hdnName.Value;
                //selectedUser
                //string selectedEmail = hdnEmailid.Value;
                string groupId = hdnGroupId.Value;


                string[] selectedUserarr = selectedUser.Split(";".ToCharArray());
                for (int i = 0; i < selectedUserarr.Length; i++)
                {
                    string struser = selectedUserarr[i];
                    if (struser != "")
                    {
                        clsBALUsers objBI_User = new clsBALUsers();
                        objBI_User.UpdateUserScheduleMail(struser.Trim(), "UpdateUserName_Mail", groupId);
                    }
                }

                BindScheduleGrid();
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #17
0
        public void deleteUserNotExisting()
        {
            objclsBALUsers = new clsBALUsers();
            DataSet ds = objclsBALUsers.GetUserDetails();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        string       strUSERADID     = ds.Tables[0].Rows[i][4].ToString();
                        clsEALUser   objclsEALUser   = new clsEALUser();
                        clsBALCommon objclsBALCommon = new clsBALCommon();
                        objclsEALUser = objclsBALCommon.FetchUserDetailsFromAD(strUSERADID);
                        if (objclsEALUser == null)
                        {
                            objclsBALUsers.DeleteUserFromDb(strUSERADID);
                        }
                    }
                }
            }
        }
コード例 #18
0
        protected void GetCurrentUserRole()
        {
            try
            {
                objclsBALUsers = new clsBALUsers();
                if (Session["RoleSelected"] != null)
                {
                    role = (string[])Session["RoleSelected"];
                }
                else
                {
                    role = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
                }
                for (int i = 0; i < role.Length; i++)
                {
                    strRole = strRole + role[i];
                }
                Session[clsEALSession.UserRole] = strRole;
                if (role.Contains <string>(clsEALRoles.ComplianceAuditor) || role.Contains <string>(clsEALRoles.ControlOwner) || role.Contains <string>(clsEALRoles.GlobalApprover) || role.Contains <string>(clsEALRoles.Approver))
                {
                    gvApplications.Columns[4].Visible = false;
                }
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                // LogHelper.LogError(ex);
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);

                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #19
0
        public void BindAppGrid()
        {
            objclsBALUsers = new clsBALUsers();
            //role = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
            Session[clsEALSession.UserRole] = role;
            clsEALUser objclsEALUser = new clsEALUser();


            DataSet ds = FetchApplication(strUserSID, role, strQuarterSelected);

            if (ds != null)
            {
                if (ds.Tables.Count >= 1)
                {
                    gvApplications.DataSource = ds.Tables[0];
                    gvApplications.DataBind();
                    Session[clsEALSession.Applications] = ds;
                }
            }
            else
            {
                lblError.Text = "No application found.";
            }
        }
コード例 #20
0
        private void GetReport()
        {
            try
            {
                BtnExport.Visible = false;

                if (ddlQuarter.SelectedValue == "0")
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Please select quarter');", true);
                }
                else if (ddlReportType.SelectedValue == "3")
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Please select Report Type');", true);
                }

                else
                {
                    strQuarter = ddlQuarter.SelectedItem.Value.ToString();
                    PreviousQuartertoSelected = PreviousQuarter(strQuarter);

                    clsBALUsers objclsBALUsers = new clsBALUsers();
                    ds = objclsBALUsers.FetchReportData(ddlReportType.SelectedValue, PreviousQuartertoSelected, strQuarter);
                    if (ds != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (MultiView1.ActiveViewIndex == 0)
                            {
                                gvShare.DataSource = ds;
                                gvShare.DataBind();
                                HdfReportType.Value = "0";
                            }
                            else if (MultiView1.ActiveViewIndex == 1)
                            {
                                gvSQl.DataSource = ds;
                                gvSQl.DataBind();
                                HdfReportType.Value = "1";
                            }
                            else if (MultiView1.ActiveViewIndex == 2)
                            {
                                gvOracle.DataSource = ds;
                                gvOracle.DataBind();
                                HdfReportType.Value = "2";
                            }
                            else if (MultiView1.ActiveViewIndex == 4)
                            {
                                gvOnline.DataSource = ds;
                                gvOnline.DataBind();
                                HdfReportType.Value = "3";
                            }
                            else if (MultiView1.ActiveViewIndex == 5)
                            {
                                gvLinux.DataSource = ds;
                                gvLinux.DataBind();
                                HdfReportType.Value = "4";
                            }
                            else if (MultiView1.ActiveViewIndex == 6)
                            {
                                gvSecGrp.DataSource = ds;
                                gvSecGrp.DataBind();
                                HdfReportType.Value = "5";
                            }

                            Session[clsEALSession.LastRemoved] = ds;
                            BtnExport.Visible = true;
                        }
                        else
                        {
                            gvShare.DataSource = null;
                            gvShare.DataBind();
                            gvSQl.DataSource = null;
                            gvSQl.DataBind();
                            gvOracle.DataSource = null;
                            gvOracle.DataBind();
                            gvOnline.DataSource = null;
                            gvOnline.DataBind();
                            gvLinux.DataSource = null;
                            gvLinux.DataBind();
                            gvSecGrp.DataSource = null;
                            gvSecGrp.DataBind();
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('No Reports found');", true);
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);

                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session.Abandon();
            Session[clsEALSession.ValuePath] = "Home";
            GetLoggedInUserName();
            clsBALCommon objclsBALCommon = new clsBALCommon();

            objclsEALLoggedInUser = objclsBALCommon.FetchUserDetailsFromAD(LoggedInUser);
            strUserName           = objclsEALLoggedInUser.StrUserName;
            strUserSID            = objclsEALLoggedInUser.StrUserSID;
            Session[clsEALSession.CurrentUser] = strUserName;
            btnSave.Visible = false;
            //GetCurrentUserRole();
            if (Session["RoleSelected"] != null)
            {
                role = (string[])Session["RoleSelected"];
            }
            else
            {
                GetCurrentUserRole();
            }
            if (role != null)
            {
                if (role.Contains <string>(clsEALRoles.GlobalApprover))
                {
                    objclsBALUsers = new clsBALUsers();
                    bool IsCo = objclsBALUsers.CheckIfCo(objclsEALLoggedInUser.StrUserSID);
                    if (IsCo)
                    {
                        pnlRole.Visible = true;
                    }
                }
            }
            LockOut();
            if (!IsPostBack)
            {
                try
                {
                    AdminHomeFun();
                    GetHomePageText();
                }
                catch (NullReferenceException)
                {
                    Response.Redirect("wfrmErrorPage.aspx", true);
                }
                catch (Exception ex)
                {
                    HttpContext  Context         = HttpContext.Current;
                    LogException objLogException = new LogException();
                    objLogException.LogErrorInDataBase(ex, Context);

                    Response.Redirect("wfrmErrorPage.aspx", true);
                }
            }
            if (role != null)
            {
                if (role.Contains <string>(clsEALRoles.GlobalApprover) && role.Contains <string>(clsEALRoles.ControlOwner))
                {
                    if (Session["lockout"] != null)
                    {
                        //Session["lockout"] = ds.Tables[0].Rows[0][0].ToString();
                        string str = Session["lockout"].ToString();
                        if (str == "True")
                        {
                            pnlRole.Visible = false;
                        }
                        else
                        {
                            pnlRole.Visible = true;
                        }
                    }
                }
            }
        }
コード例 #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblError.Text   = "";
            lblSuccess.Text = "";
            try
            {
                TextBox     txtbxDispName = (TextBox)ADU.FindControl("txtbxDispName");
                HiddenField hdnfldADID    = (HiddenField)ADU.FindControl("hdnfldADID");
                if (txtbxDispName.Text != "")
                {
                    if (ddlRole.SelectedIndex != 0)
                    {
                        if (hdnfldADID.Value != "")
                        {
                            clsBALCommon objclsBALCommon = new clsBALCommon();
                            clsEALUser   objclsEALUser   = new clsEALUser();
                            objclsEALUser = objclsBALCommon.FetchUserDetailsFromAD(hdnfldADID.Value);
                            if (objclsEALUser != null)
                            {
                                bool flag = CheckUserRoles(objclsEALUser);

                                if (!flag)
                                {
                                    string userRole = ddlRole.SelectedItem.Value;
                                    //bool blnRoleExists = CheckRole(userRole);
                                    //if (!blnRoleExists)
                                    //{
                                    objclsBALUsers = new clsBALUsers();

                                    bool blnSave = objclsBALUsers.SaveUserRole(objclsEALUser, userRole, objclsEALLoggedInUser.StrUserADID);
                                    lblSuccess.Text       = "User has been assigned with the role successfully.";
                                    hdnfldADID.Value      = "";
                                    txtbxDispName.Text    = "";
                                    ddlRole.SelectedIndex = 0;
                                    PopulateGrid();
                                    //}
                                    //else
                                    //{
                                    //    lblError.Text = "RoleGroup has already been assigned to other user.";
                                    //}
                                }
                            }
                        }
                    }
                    else
                    {
                        lblError.Text = "Select role to assign.";
                    }
                }
                else
                {
                    lblError.Text = "Please select a user.";
                }
                txtbxDispName.Text    = "";
                hdnfldADID.Value      = "";
                ddlRole.SelectedIndex = 0;
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  context            = HttpContext.Current;
                LogException objclsLogException = new LogException();
                objclsLogException.LogErrorInDataBase(ex, context);
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #23
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                clsBALUsers objBI_User = new clsBALUsers();

                TextBox txtbxDispName = (TextBox)ADU.FindControl("txtbxDispName");
                //HiddenField hdn = (HiddenField)adu.FindControl("hdnfldADID");

                string[] strApprovers = null;


                if (txtbxDispName.Text.ToString() != "")
                {
                    DataTable dtrolewiseusertemp = (DataTable)Session["dtrolewiseuser"];
                    strApprovers = (txtbxDispName.Text.ToString().ToLower()).Split(";".ToCharArray());


                    for (int i = 0; i < strApprovers.Length; i++)
                    {
                        string strApp = strApprovers[i];
                        if (strApp != "")
                        {
                            clsEALUser   objclsEALApp    = new clsEALUser();
                            clsBALCommon objclsBALCommon = new clsBALCommon();
                            objclsEALApp = objclsBALCommon.FetchUserDetailsFromAD(strApp);
                            if (lstBoxApproverDelete.Items.Count > 0)
                            {
                                foreach (ListItem thisItem in lstBoxApproverDelete.Items)
                                {
                                    string strtemp = thisItem.Text.Trim();


                                    if (thisItem.Text.Trim() == objclsEALApp.StrUserName)
                                    {
                                        lblError.Text = "User " + objclsEALApp.StrUserName + " already exists";
                                        // strtest = strtest + strtemp;
                                        goto Outer;
                                    }
                                }
                            }
                            string mailid = objclsEALApp.StrUserEmailID;
                            string adID   = objclsEALApp.StrUserADID;


                            DataRow dr;
                            dr                  = dtrolewiseusertemp.NewRow();
                            dr["UserName"]      = objclsEALApp.StrUserName;
                            dr["RoleMappingId"] = objclsEALApp.StrUserSID;
                            dr["UserADID"]      = objclsEALApp.StrUserADID;
                            dr["UserEmail"]     = objclsEALApp.StrUserEmailID;
                            dtrolewiseusertemp.Rows.Add(dr);
                            // objBI_User.InsertDelete_RoleWiseUser(Int32.Parse(ddlRole.SelectedItem.Value.ToString()), objclsEALApp.StrUserName, objclsEALApp.StrUserADID, objclsEALApp.StrUserEmailID, "Insert");


                            lblSuccess.Text = "User added successfully";


Outer:
                            continue;
                        }
                    }
                    txtbxDispName.Text = "";
                    //BindListbox();
                    Session["dtrolewiseuser"]       = dtrolewiseusertemp;
                    lstBoxApproverDelete.DataSource = (DataTable)Session["dtrolewiseuser"];
                    lstBoxApproverDelete.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Please select user to Add');", true);
                }
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);

                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #24
0
 public void DeleteUserRole(clsEALUser objclsEALUser)
 {
     objclsBALUsers = new clsBALUsers();
     objclsBALUsers.DeleteUser(objclsEALUser, objclsEALLoggedInUser.StrUserADID);
 }
コード例 #25
0
        protected void btnScheduleMail_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToDateTime(txtDate.Text.ToString()) <= DateTime.Today)
                {
                    DateTime Date = System.DateTime.Now.Date;
                    if (Convert.ToDateTime(txtDate.Text.ToString()).Date == Date)
                    {
                        int intTime = System.DateTime.Now.TimeOfDay.Hours;
                        if (intTime >= 9)
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Mail cannot be scheduled today after 9 AM.');", true);
                        }
                        else
                        {
                            clsBALUsers objBI_User = new clsBALUsers();
                            DataTable   dt         = (DataTable)Session["dtrolewiseuser"];
                            if (dt.Rows.Count > 0)
                            {
                                string groupID = Guid.NewGuid().ToString();
                                foreach (DataRow da in dt.Rows)
                                {
                                    string       username        = da["UserName"].ToString();
                                    string       UserADID        = da["UserADID"].ToString();
                                    string       UserEmail       = da["UserEmail"].ToString();
                                    clsBALCommon objclsBALCommon = new clsBALCommon();
                                    objBI_User.InsertDeleteScheduleMail(Int32.Parse(ddlRole.SelectedItem.Value.ToString()), groupID, username, UserADID, UserEmail, "Insert", DateTime.Parse(txtDate.Text.ToString()), txtSubject.Text.ToString(), Editor1.Content.ToString());
                                }
                                BindScheduleGrid();

                                BindListbox();
                                TextBox txtbxDispName = (TextBox)ADU.FindControl("txtbxDispName");
                                txtbxDispName.Text = "";
                                txtSubject.Text    = "";
                                txtDate.Text       = "";
                                Editor1.Content    = "";
                                panelMail.Visible  = false;
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('New mail schedule saved.');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('There is no user to schedule mail.');", true);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Past date not allowed.');", true);
                    }
                }
                else
                {
                    clsBALUsers objBI_User = new clsBALUsers();
                    DataTable   dt         = (DataTable)Session["dtrolewiseuser"];
                    if (dt.Rows.Count > 0)
                    {
                        string groupID = Guid.NewGuid().ToString();
                        foreach (DataRow da in dt.Rows)
                        {
                            string       username        = da["UserName"].ToString();
                            string       UserADID        = da["UserADID"].ToString();
                            string       UserEmail       = da["UserEmail"].ToString();
                            clsBALCommon objclsBALCommon = new clsBALCommon();
                            objBI_User.InsertDeleteScheduleMail(Int32.Parse(ddlRole.SelectedItem.Value.ToString()), groupID, username, UserADID, UserEmail, "Insert", DateTime.Parse(txtDate.Text.ToString()), txtSubject.Text.ToString(), Editor1.Content.ToString());
                        }
                        BindScheduleGrid();

                        BindListbox();
                        TextBox txtbxDispName = (TextBox)ADU.FindControl("txtbxDispName");
                        txtbxDispName.Text = "";
                        txtSubject.Text    = "";
                        txtDate.Text       = "";
                        Editor1.Content    = "";
                        panelMail.Visible  = false;
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('New mail schedule saved.');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('There is no user to schedule mail.');", true);
                    }
                }
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);

                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #26
0
        protected void gvSchedule_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                clsBALUsers             objBI_User = new clsBALUsers();
                PPLPicker.ADUserControl adu        = (PPLPicker.ADUserControl)gvSchedule.Rows[e.RowIndex].FindControl("ADUSerControl1");
                TextBox txtbxDispName  = (TextBox)adu.FindControl("txtbxDispName");
                TextBox txtDateGrid    = (TextBox)gvSchedule.Rows[e.RowIndex].FindControl("txtDateGrid");
                TextBox txtSubjectGrid = (TextBox)gvSchedule.Rows[e.RowIndex].FindControl("txtSubjectGrid");
                Label   lblBody        = (Label)gvSchedule.Rows[e.RowIndex].FindControl("lblBody");
                Label   lblRoleID      = (Label)gvSchedule.Rows[e.RowIndex].FindControl("lblRoleID");
                Label   lblGroupID     = (Label)gvSchedule.Rows[e.RowIndex].FindControl("lblGroupID");
                Label   lblUsers1      = (Label)gvSchedule.Rows[e.RowIndex].FindControl("lblUsers1");
                string  groupID        = lblGroupID.Text.ToString();

                string[] strApprovers = null;

                if (Convert.ToDateTime(txtDateGrid.Text.ToString()) <= DateTime.Today)
                {
                    //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Please select date greater than today.');", true);
                    DateTime Date = System.DateTime.Now.Date;
                    if (Convert.ToDateTime(txtDateGrid.Text.ToString()).Date == Date)
                    {
                        int intTime = System.DateTime.Now.TimeOfDay.Hours;
                        if (intTime >= 9)
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Mail cannot be scheduled today after 9 AM.');", true);
                        }
                        else
                        {
                            objBI_User.UpdateScheduleMail(groupID, DateTime.Parse(txtDateGrid.Text.ToString()).Date, txtSubjectGrid.Text.ToString(), lblBody.Text.ToString(), "UpdateSchedule_Mail");

                            if (txtbxDispName.Text.ToString() != "")
                            {
                                strApprovers = (txtbxDispName.Text.ToString().ToLower()).Split(";".ToCharArray());


                                for (int i = 0; i < strApprovers.Length; i++)
                                {
                                    string strApp = strApprovers[i];
                                    if (strApp != "")
                                    {
                                        //if (!strFetchedApprovers.Contains<string>(strApp))
                                        //{
                                        clsEALUser   objclsEALApp    = new clsEALUser();
                                        clsBALCommon objclsBALCommon = new clsBALCommon();
                                        objclsEALApp = objclsBALCommon.FetchUserDetailsFromAD(strApp);
                                        string mailid = objclsEALApp.StrUserEmailID;
                                        string adID   = objclsEALApp.StrUserADID;


                                        string selectedUser = lblUsers1.Text;
                                        //string[] selectedUserarr = selectedUser.Split(";".ToCharArray());
                                        if (!selectedUser.Contains(objclsEALApp.StrUserName))
                                        {
                                            objBI_User.InsertDeleteScheduleMail(Int32.Parse(lblRoleID.Text.ToString()), groupID, objclsEALApp.StrUserName, objclsEALApp.StrUserADID, objclsEALApp.StrUserEmailID, "Insert", DateTime.Parse(txtDateGrid.Text.ToString()).Date, txtSubjectGrid.Text.ToString(), lblBody.Text.ToString());
                                        }


                                        //}
                                    }
                                }
                            }
                            gvSchedule.EditIndex = -1;
                            BindScheduleGrid();
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "aa", "javascript:alert('Past date not allowed.');", true);
                    }
                }
                else
                {
                    objBI_User.UpdateScheduleMail(groupID, DateTime.Parse(txtDateGrid.Text.ToString()).Date, txtSubjectGrid.Text.ToString(), lblBody.Text.ToString(), "UpdateSchedule_Mail");

                    if (txtbxDispName.Text.ToString() != "")
                    {
                        strApprovers = (txtbxDispName.Text.ToString().ToLower()).Split(";".ToCharArray());


                        for (int i = 0; i < strApprovers.Length; i++)
                        {
                            string strApp = strApprovers[i];
                            if (strApp != "")
                            {
                                //if (!strFetchedApprovers.Contains<string>(strApp))
                                //{
                                clsEALUser   objclsEALApp    = new clsEALUser();
                                clsBALCommon objclsBALCommon = new clsBALCommon();
                                objclsEALApp = objclsBALCommon.FetchUserDetailsFromAD(strApp);
                                string mailid = objclsEALApp.StrUserEmailID;
                                string adID   = objclsEALApp.StrUserADID;


                                string selectedUser = lblUsers1.Text;
                                //string[] selectedUserarr = selectedUser.Split(";".ToCharArray());
                                if (!selectedUser.Contains(objclsEALApp.StrUserName))
                                {
                                    objBI_User.InsertDeleteScheduleMail(Int32.Parse(lblRoleID.Text.ToString()), groupID, objclsEALApp.StrUserName, objclsEALApp.StrUserADID, objclsEALApp.StrUserEmailID, "Insert", DateTime.Parse(txtDateGrid.Text.ToString()).Date, txtSubjectGrid.Text.ToString(), lblBody.Text.ToString());
                                }


                                //}
                            }
                        }
                    }
                    gvSchedule.EditIndex = -1;
                    BindScheduleGrid();
                }
            }
            catch (NullReferenceException)
            {
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
            catch (Exception ex)
            {
                HttpContext  Context         = HttpContext.Current;
                LogException objLogException = new LogException();
                objLogException.LogErrorInDataBase(ex, Context);
                Response.Redirect("wfrmErrorPage.aspx", true);
            }
        }
コード例 #27
0
 protected void GetCurrentUserRole()
 {
     objclsBALUsers = new clsBALUsers();
     role           = objclsBALUsers.GetCurrentUserRole(objclsEALLoggedInUser);
     Session[clsEALSession.UserRole] = role;
 }
コード例 #28
0
ファイル: Default.aspx.cs プロジェクト: LTIAvinashsSahu/CART
        public void LockOut()
        {
            objclsBALUsers = new clsBALUsers();
            DataSet ds = objclsBALUsers.GetLockOut();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Session["lockout"] = ds.Tables[0].Rows[0][0].ToString();
            }
            if (role != null)
            {
                #region Admin
                if (role.Contains <string>(clsEALRoles.ComplianceAdmin))
                {
                    //pnlLockOut.Visible = true;
                    lblLockout.Visible = true;
                    chkLock.Visible    = true;

                    if (Session["lockout"] != null)
                    {
                        //chkLock.Checked = bool.Parse(ds.Tables[0].Rows[0][0].ToString());
                        chkLock.Checked = bool.Parse(Session["lockout"].ToString());
                    }
                    // }
                }
                #endregion

                #region approver
                if (role.Contains <string>(clsEALRoles.Approver))
                {
                    string str = Session["lockout"].ToString();
                    if (str == "True")
                    {
                        string LoggedInUserID = "";
                        if (Session["LoggedInUserID"] != null)
                        {
                            LoggedInUserID = Session["LoggedInUserID"].ToString();
                        }
                        clsBALApplication objclsBALApplication = new clsBALApplication();

                        DataTable dt             = objclsBALApplication.GetUnlockApprover(LoggedInUserID);
                        bool      approverUnlock = false;
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                if (dt.Rows[i]["UnlockApp"].ToString().ToLower() == "true")
                                {
                                    approverUnlock = true;
                                    break;
                                }
                            }
                        }
                        if (approverUnlock)
                        {
                            Session["lockout"] = "False";
                        }
                    }
                }
                #endregion

                #region Control Owner
                if (role.Contains <string>(clsEALRoles.ControlOwner))
                {
                    string str = Session["lockout"].ToString();
                    if (str == "True")
                    {
                        string LoggedInUserID = "";
                        if (Session["LoggedInUserID"] != null)
                        {
                            LoggedInUserID = Session["LoggedInUserID"].ToString();
                        }
                        clsBALApplication objclsBALApplication = new clsBALApplication();

                        DataTable dtCO     = objclsBALApplication.GetUnlockCO(LoggedInUserID);
                        bool      coUnlock = false;
                        if (dtCO.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtCO.Rows.Count; i++)
                            {
                                if (dtCO.Rows[i]["UnlockApp"].ToString().ToLower() == "true")
                                {
                                    coUnlock = true;
                                    break;
                                }
                            }
                        }
                        if (coUnlock)
                        {
                            Session["lockout"] = "False";
                        }
                        if (role.Contains <string>(clsEALRoles.GlobalApprover) && role.Contains <string>(clsEALRoles.ControlOwner))
                        {
                            rdGA.Enabled = false;
                        }
                    }
                }
                #endregion
            }
        }