コード例 #1
0
        //protected void btnUpdate_Click(object sender, EventArgs e)
        //{
        //    RoleBE role = new RoleBE();
        //    RoleBAL roleBAL = new RoleBAL();


        //    role.RoleId = Convert.ToInt32(hdnRoleUpdateId.Value);
        //    //role.RoleShortDesc = txtRoleShortDesc.Text;
        //    //role.RoleLongDesc = txtRolelongDesc.Text;
        //    role.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId;
        //    if (roleBAL.ModifyRole(role))
        //    {
        //        LvRoleItems.EditIndex = -1;
        //        bind();
        //        recalcNoOfPages();
        //        LoggedIn master = (LoggedIn)this.Master;
        //        master.ShowMessage("Role successfully Updated.", true);
        //    }
        //    else
        //    {
        //        LoggedIn master = (LoggedIn)this.Master;
        //        master.ShowMessage("Unsuccessful", true);
        //    }

        //}

        //protected void btnCancel_Click(object sender, EventArgs e)
        //{
        //    LvRoleItems.EditIndex = -1;
        //    bind();
        //    recalcNoOfPages();
        //}

        protected void btnDeleteYes_Click(object sender, EventArgs e)
        {
            RoleBE  role    = new RoleBE();
            RoleBAL roleBAL = new RoleBAL();
            int     RoleId  = Convert.ToInt32(hdnRoleId.Value);

            role.RoleId = Convert.ToInt32(RoleId);
            if (roleBAL.DeleteRole(role))
            {
                if (LvRoleItems.Items.Count == 1)
                {
                    RoleDataPager.SetPageProperties(RoleDataPager.TotalRowCount - RoleDataPager.PageSize - 1,
                                                    RoleDataPager.PageSize, true);
                    bind();
                    recalcNoOfPages();
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("Role successfully deleted.", true);
                }
                else
                {
                    LvRoleItems.EditIndex = -1;
                    bind();
                    recalcNoOfPages();
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("Role successfully deleted.", true);
                }
            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Sorry You cannot delete Role because it is already in use", false);
                recalcNoOfPages();
            }
        }
コード例 #2
0
        void UCRoleAddList_btnUpdateClick(object sender, EventArgs e)
        {
            RoleBE  role    = new RoleBE();
            RoleBAL roleBAL = new RoleBAL();


            role.RoleId        = Convert.ToInt32(hdnRoleUpdateId.Value);
            role.RoleShortDesc = UCRoleAddList.ShortDesc;
            role.RoleLongDesc  = UCRoleAddList.LongDesc;

            role.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId;
            if (roleBAL.ModifyRole(role))
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Role successfully Updated.", true);
                LvRoleItems.EditIndex = -1;
                bind();
                recalcNoOfPages();
            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Unsuccessful", true);
            }
        }
コード例 #3
0
        public JsonResult GetRoles(DataTableSearchParameters <Nullable <bool> > dataTableSearchParameters)
        {
            GenericListModel <RoleModel> baseListModel = new GenericListModel <RoleModel>();

            using (RoleBAL roleBAL = new RoleBAL(ContextInfo))
            {
                baseListModel = roleBAL.GetSearchRolesList(dataTableSearchParameters);
            }

            return(Json(new
            {
                baseModel = baseListModel
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public ActionResult Create(BaseModel baseModel)
        {
            RoleModel roleModel = new RoleModel();

            roleModel.CopyBaseModel(baseModel);

            using (RoleBAL roleBAL = new RoleBAL(ContextInfo))
            {
                roleBAL.PrepareRoleModel(roleModel);
            }

            SiteMapHelper.PrepareSiteMapModel(roleModel.SiteMapModel);

            return(View("Create", roleModel));
        }
コード例 #5
0
        public ActionResult Delete(string id)
        {
            RoleModel roleModel = new RoleModel();

            roleModel.Id = id;

            using (RoleBAL roleBAL = new RoleBAL(ContextInfo))
            {
                roleBAL.GetRoleModel(roleModel);
            }

            SiteMapHelper.PrepareSiteMapModel(roleModel.SiteMapModel, roleModel.Id);

            return(View(roleModel));
        }
コード例 #6
0
ファイル: LogInController.cs プロジェクト: Anand8399/digiSMS
        //
        // GET: /LogIn/
        public ActionResult Index()
        {
            LoginUserVM entity = new LoginUserVM();
            //without db
            //entity.UserId = "admin";
            //entity.Password = "******";
            //entity.Roles = new List<SelectListItem> {  new SelectListItem() { Text = "Admin", Value = "Admin" }};
            RoleBAL balObject = new RoleBAL();

            entity.Roles = from obj in balObject.GetAll().Where(r => r.Status == true) select new SelectListItem()
            {
                Text = obj.RoleName, Value = obj.Id.ToString()
            };
            ViewBag.AdminRoleId = entity.Roles.Where(r => r.Text == "Admin").FirstOrDefault().Value;
            return(View(entity));
        }
コード例 #7
0
        private void bind()
        {
            RoleBAL   roleBAL = new RoleBAL();
            DataTable dt      = new DataTable();

            if (roleBAL.GetAllRoleDetails(ref dt))
            {
                this.LvRoleItems.DataSource = dt;
                LvRoleItems.DataBind();
            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Unsuccessful", false);
            }
        }
コード例 #8
0
        public ActionResult Delete(RoleModel roleModel)
        {
            using (RoleBAL roleBAL = new RoleBAL(ContextInfo))
            {
                roleBAL.Delete(roleModel);
                if (roleModel.HasErrorByType())
                {
                    roleBAL.GetRoleModel(roleModel);
                }
            }

            if (roleModel.HasErrorByType())
            {
                SiteMapHelper.PrepareSiteMapModel(roleModel.SiteMapModel, roleModel.Id);
            }

            return(View(roleModel));
        }
コード例 #9
0
    /// <summary>
    /// To load active role details from database
    /// </summary>
    /// <returns></returns>
    private DataTable ActiveGridDataSource()
    {
        RoleBAL   RoleBAL  = new RoleBAL();
        DataTable DtActGrd = new DataTable();

        try
        {
            DtActGrd = RoleBAL.LoadActiveRole(true, LoginUser, Ret);
        }
        catch
        {
        }
        finally
        {
            RoleBAL = null;
        }
        return(DtActGrd);
    }
コード例 #10
0
    /// <summary>
    /// To load Role details from database
    /// </summary>
    /// <returns></returns>
    private DataTable GridDataSource()
    {
        RoleBAL   RoleBAL = new RoleBAL();
        DataTable DtRole  = new DataTable();

        try
        {
            DtRole = RoleBAL.LoadAllRole(LoginUser, Ret);
        }
        catch
        {
        }
        finally
        {
            RoleBAL = null;
        }
        return(DtRole);
    }
コード例 #11
0
    /// <summary>
    ///  To get details of particular Role ID
    /// </summary>
    /// <param name="RoleId"></param>
    /// <returns></returns>
    private DataTable GetRoleDetails(int RoleId)
    {
        RoleBAL   RoleBAL  = new RoleBAL();
        DataTable DtRoleDe = new DataTable();

        try
        {
            DtRoleDe = RoleBAL.SelectRoleID(RoleId, LoginUser, Ret);
        }
        catch
        {
            throw;
        }
        finally
        {
            RoleBAL = null;
        }
        return(DtRoleDe);
    }
コード例 #12
0
        public ActionResult Create(RoleModel roleModel)
        {
            using (RoleBAL roleBAL = new RoleBAL(ContextInfo))
            {
                if (ModelState.IsValid)
                {
                    roleBAL.Create(roleModel);
                }

                if (roleModel.HasErrorByType(LMYFrameWorkMVC.Common.LookUps.ErrorType.Critical) || roleModel.HasSuccess(LMYFrameWorkMVC.Common.LookUps.SuccessType.Full))
                {
                    return(base.RedirectToActionWithData(new Dictionary <string, object> {
                        { "baseModel", roleModel }
                    }));
                }

                roleBAL.GetRoleModel(roleModel);
            }

            return(View("Create", roleModel));
        }
コード例 #13
0
        protected void btnAddRole_Click(object sender, EventArgs e)
        {
            if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add"))
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false);
                //   Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage
                //  string cat = Request.QueryString["Message"];
                //  Response.Redirect("UM_BlankPage.aspx?Message=You are not authorised to Perform any operation on this page. Please contact system administrator.");
                return;
            }
            if (ValidData())
            {
            }
            else
            {
                UserBE  user       = (UserBE)Session["LoggedInUser"];
                RoleBE  addRoleBE  = new RoleBE();
                RoleDAL addRoleDal = new RoleDAL();
                RoleBAL addRoleBal = new RoleBAL();

                addRoleBE.RoleShortDesc  = txtRoleShortDesc.Text;
                addRoleBE.RoleLongDesc   = txtRoleLongDesc.Text;
                addRoleBE.LastModifiedBy = user.UserId;

                if (addRoleBal.AddRole(addRoleBE))
                {
                    txtRoleShortDesc.Text = "";
                    txtRoleLongDesc.Text  = "";
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("Record Inserted Successfully.", true);
                }
                else
                {
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("Unsuccessful.", false);
                }
            }
        }
コード例 #14
0
 /// <summary>
 /// To save and update Role details
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string Status = ddlRoleStatus.SelectedItem.Text;
         bool RoleStatus;
         if (Status == "Active")
             {
                 RoleStatus = true;
             }
             else
             {
                 RoleStatus = false;
             }
             if (btnSave.Text == "Save")
             {
                 int IntResult = 0;
                 RoleBAL RoleBAL = new RoleBAL();
                 string RoleName = txtRoleName.Text;
                 string RoleDesc = txtRoleDesc.Text;
                 try
                 {
                     // 'InsertRole' is Role business Access Layer function called
                     // to insert Role details
                     IntResult = RoleBAL.InsertRole(RoleName, RoleDesc, RoleStatus, LoginUser, Ret);
                     ClearRole();
                     msgRole.Msg = "Role details submited successfully";
                     msgRole.showmsg();
                 }
                 catch (Exception ee)
                 {
                     // Duplicate Entry is catched when inserting Role
                     if (ee.Message == "Duplicate Entry")
                     {
                         msgRole.Msg = "Role already exists";
                         msgRole.showmsg();
                     }
                 }
                 finally
                 {
                     RoleBAL = null;
                 }
             }
             else if (btnSave.Text == "Update")
             {
                 int IntResult = 0;
                 RoleBAL RoleBAL = new RoleBAL();
                 string RoleName = txtRoleName.Text;
                 string RoleDesc = txtRoleDesc.Text;
                 try
                 {
                     // 'UpdateRole' is Role business Access Layer function called
                     // to update Role details
                     IntResult = RoleBAL.UpdateRole(RoleId, RoleName, RoleDesc, RoleStatus, LoginUser, Ret);
                     ClearRole();
                     Session["RoleId"] = null;
                     btnSave.Text = "Save";
                     Response.Redirect("RoleList.aspx", false);
                     //msgRole.Msg = "Role updated succesfully";
                     //msgRole.showmsg();
                 }
                 catch (Exception ee)
                 {
                     // Duplicate Entry is catched when updating Role
                     if (ee.Message == "Duplicate Entry")
                     {
                         msgRole.Msg = "Role already exists";
                         msgRole.showmsg();
                     }
                 }
                 finally
                 {
                     RoleBAL = null;
                 }
             }
 }
コード例 #15
0
    /// <summary>
    /// To load Role details from database 
    /// </summary>
    /// <returns></returns>
    private DataTable GridDataSource()
    {
        RoleBAL RoleBAL = new RoleBAL();
        DataTable DtRole = new DataTable();
        try
        {
            DtRole = RoleBAL.LoadAllRole(LoginUser, Ret);
        }
        catch
        {

        }
        finally
        {
            RoleBAL = null;
        }
        return DtRole;
    }
コード例 #16
0
    /// <summary>
    /// To load active role details from database
    /// </summary>
    /// <returns></returns>
    private DataTable ActiveGridDataSource()
    {
        RoleBAL RoleBAL = new RoleBAL();
        DataTable DtActGrd = new DataTable();
        try
        {
            DtActGrd = RoleBAL.LoadActiveRole(true, LoginUser, Ret);
        }
        catch
        {

        }
        finally
        {
            RoleBAL = null;
        }
        return DtActGrd;
    }
コード例 #17
0
 /// <summary>
 ///  To get details of particular Role ID
 /// </summary>
 /// <param name="RoleId"></param>
 /// <returns></returns>
 private DataTable GetRoleDetails(int RoleId)
 {
     RoleBAL RoleBAL = new RoleBAL();
         DataTable DtRoleDe = new DataTable();
         try
         {
             DtRoleDe = RoleBAL.SelectRoleID(RoleId, LoginUser, Ret);
         }
         catch
         {
             throw;
         }
         finally
         {
             RoleBAL = null;
         }
         return DtRoleDe;
 }
コード例 #18
0
ファイル: LogInController.cs プロジェクト: Anand8399/digiSMS
        public ActionResult Index(LoginUserVM entity)
        {
            int iRet = 0;

            // iRet = ApplicationCore.VerifyLic(@"C:\inetpub\license.lic");

            if (iRet != 0)
            {
                if (iRet == -1)
                {
                    ViewBag.Error = myRes.Licensedatehaspassed;
                }
                else if (iRet == -4)
                {
                    ViewBag.Error = myRes.Licensecopynotfound;
                }
                else
                {
                    ViewBag.Error = myRes.Thelicensecopyisnotvalid;
                }
            }

            if (ModelState.IsValid && iRet == 0)
            {
                UserBAL balObject = new UserBAL();
                int     schoolId  = 0;
                //var roles = from obj in roleObject.GetAll().Where(r => r.Status == true) select new SelectListItem() { Text = obj.RoleName, Value = obj.Id.ToString() };
                //var roleEntities = roles.Where(r => r.Value == entity.RoleId.ToString());
                //if (roleEntities != null && roleEntities.Count() > 0)
                //{
                //}
                //balObject.OledbConnectionString = ConfigurationManager.ConnectionStrings["OLEDbConnection"].ToString();
                var entites = balObject.GetAll().Where(u => u.RoleId == entity.RoleId && u.UserId.Trim() == entity.UserId.Trim() && u.Password.Trim() == entity.Password.Trim());

                if (entites != null)
                {
                    if (entites.Count() > 0)
                    {
                        Entities.User userEntity = entites.FirstOrDefault();
                        SessionHelper.UserId          = entity.UserId;
                        SessionHelper.Username        = userEntity.UserName;
                        SessionHelper.Title           = userEntity.UserRole.RoleName;
                        SessionHelper.IsAuthenticated = true;

                        // get School Information
                        schoolId = userEntity.SchoolId;
                        SchoolDetailsBAL balObj = new SchoolDetailsBAL();
                        var entity1             = balObj.GetAll().Where(u => u.SchoolId == schoolId);
                        if (entity1 != null)
                        {
                            if (entity1.Count() > 0)
                            {
                                Entities.SchoolDetails userEntity1 = entity1.FirstOrDefault();

                                SessionHelper.SchoolName = userEntity1.SchoolName.Trim();
                                SessionHelper.SchoolId   = userEntity1.SchoolId;
                                SessionHelper.LogoPath   = userEntity1.LogoPath.Trim();
                            }
                        }

                        return(RedirectToAction("Index", "Home"));
                    }
                }


                ViewBag.Error = myRes.TheUserDoesNotExistOrTheProvidedUsernameOrPasswordIsIncorrect;
            }

            RoleBAL roleObject = new RoleBAL();

            entity.Roles = from obj in roleObject.GetAll().Where(r => r.Status == true) select new SelectListItem()
            {
                Text = obj.RoleName, Value = obj.Id.ToString()
            };
            ViewBag.AdminRoleId = entity.Roles.Where(r => r.Text == "Admin").FirstOrDefault().Value;

            return(View(entity));
        }
コード例 #19
0
    /// <summary>
    /// To save and update Role details
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string Status = ddlRoleStatus.SelectedItem.Text;
        bool   RoleStatus;

        if (Status == "Active")
        {
            RoleStatus = true;
        }
        else
        {
            RoleStatus = false;
        }
        if (btnSave.Text == "Save")
        {
            int     IntResult = 0;
            RoleBAL RoleBAL   = new RoleBAL();
            string  RoleName  = txtRoleName.Text;
            string  RoleDesc  = txtRoleDesc.Text;
            try
            {
                // 'InsertRole' is Role business Access Layer function called
                // to insert Role details
                IntResult = RoleBAL.InsertRole(RoleName, RoleDesc, RoleStatus, LoginUser, Ret);
                ClearRole();
                msgRole.Msg = "Role details submited successfully";
                msgRole.showmsg();
            }
            catch (Exception ee)
            {
                // Duplicate Entry is catched when inserting Role
                if (ee.Message == "Duplicate Entry")
                {
                    msgRole.Msg = "Role already exists";
                    msgRole.showmsg();
                }
            }
            finally
            {
                RoleBAL = null;
            }
        }
        else if (btnSave.Text == "Update")
        {
            int     IntResult = 0;
            RoleBAL RoleBAL   = new RoleBAL();
            string  RoleName  = txtRoleName.Text;
            string  RoleDesc  = txtRoleDesc.Text;
            try
            {
                // 'UpdateRole' is Role business Access Layer function called
                // to update Role details
                IntResult = RoleBAL.UpdateRole(RoleId, RoleName, RoleDesc, RoleStatus, LoginUser, Ret);
                ClearRole();
                Session["RoleId"] = null;
                btnSave.Text      = "Save";
                Response.Redirect("RoleList.aspx", false);
                //msgRole.Msg = "Role updated succesfully";
                //msgRole.showmsg();
            }
            catch (Exception ee)
            {
                // Duplicate Entry is catched when updating Role
                if (ee.Message == "Duplicate Entry")
                {
                    msgRole.Msg = "Role already exists";
                    msgRole.showmsg();
                }
            }
            finally
            {
                RoleBAL = null;
            }
        }
    }