コード例 #1
0
        public ActionResult Edit_AccessRights(UserWiseRights _objUserWiseRights)
        {
            try
            {
                DataSet dsList = _objWhitelabelAccessRights.Edit_AccessRights(_objUserWiseRights);

                UserMaster CV = new UserMaster();
                GridRights _grid = new GridRights();
                List<GridColumnScreen> GridColumnScreen = new List<GridColumnScreen>();
                List<GridRights> lstGrid = new List<GridRights>();
                ViewBag.OtherData = "";
                if (dsList != null)
                {
                    if (dsList.Tables[1] != null)
                    {
                        if (dsList.Tables[1].Rows.Count > 0)
                        {
                            ViewBag.GridColumnScreen = dsList.Tables[1];
                            foreach (System.Data.DataRow dr in ViewBag.GridColumnScreen.Rows)
                            {
                                GridColumnScreen.Add(new GridColumnScreen
                                {
                                    SrNo = @dr["Srno"].ToString(),
                                    SCR = @dr["Screencode"].ToString(),
                                    Module = @dr["Modulecode"].ToString(),
                                    view = @dr["Viewrights"].ToString(),
                                    update = @dr["Updaterights"].ToString(),
                                    deletee = @dr["Deleterights"].ToString(),
                                    create = @dr["Addrights"].ToString(),
                                    screen = @dr["Screencode"].ToString(),
                                });
                            }
                        }
                    } if (dsList.Tables[0] != null)
                    {
                        if (dsList.Tables[0].Rows.Count > 0)
                        {
                            _objUserWiseRights.IsActive = dsList.Tables[0].Rows[0]["IsActive"].ToString();
                            _objUserWiseRights.EffectiveDate = dsList.Tables[0].Rows[0]["EffectiveDate"].ToString();
                            _objUserWiseRights.Status = dsList.Tables[0].Rows[0]["Isdefault"].ToString();
                            _objUserWiseRights.srno = dsList.Tables[0].Rows[0]["SrNo"].ToString();
                            //  ViewBag.OtherData = dsList.Tables[0];
                        }
                    }
                }
                // ViewBag.Columns = GridColumnScreen.ToList();

                return Json(new { IsActive = _objUserWiseRights.IsActive, EffectiveDate = _objUserWiseRights.EffectiveDate, Status = _objUserWiseRights.Status, Grid = GridColumnScreen.ToList(), Srno = _objUserWiseRights.srno }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public ActionResult Edit_AccessRights(UserWiseRights _objUserWiseRights)
        {
            try
            {
                DataSet dsList = _objRoleRightsDb.Edit_AccessRights(_objUserWiseRights);

                UserMaster CV = new UserMaster();
                GridRights _grid = new GridRights();
                List<GridColumnScreen> GridColumnScreen = new List<GridColumnScreen>();
                List<GridRights> lstGrid = new List<GridRights>();
                List<UserWiseRights> UserWiseRights = new List<UserWiseRights>();
                ViewBag.OtherData = "";
                if (dsList != null)
                {
                    if (dsList.Tables[1] != null)
                    {
                        if (dsList.Tables[1].Rows.Count > 0)
                        {
                            ViewBag.GridColumnScreen = dsList.Tables[1];
                            foreach (System.Data.DataRow dr in ViewBag.GridColumnScreen.Rows)
                            {
                                GridColumnScreen.Add(new GridColumnScreen
                                {
                                    SrNo = @dr["Srno"].ToString(),
                                    SCR = @dr["Screencode"].ToString(),
                                    Module = @dr["Modulecode"].ToString(),
                                    view = @dr["Viewrights"].ToString(),
                                    update = @dr["Updaterights"].ToString(),
                                    deletee = @dr["Deleterights"].ToString(),
                                    create = @dr["Addrights"].ToString(),
                                    screen = @dr["Screencode"].ToString(),
                                });
                            }
                        }
                    }
                    if (dsList.Tables[0].Rows.Count > 0)
                    {
                        ViewBag.UserWiseRights = dsList.Tables[0];
                        foreach (System.Data.DataRow dr in ViewBag.UserWiseRights.Rows)
                        {
                            UserWiseRights.Add(new UserWiseRights
                            {
                                srno = @dr["srno"].ToString(),
                                Corporate = @dr["Corporate"].ToString(),
                                Unit = @dr["Unit"].ToString(),
                                Branch = @dr["Branch"].ToString(),
                                Location = @dr["Location"].ToString(),
                                Role = @dr["Role"].ToString(),
                                // UserId = @dr["UserId"].ToString(),
                            });
                        }
                    }
                    // if (dsList.Tables[0] != null)
                    //{
                    //    if (dsList.Tables[0].Rows.Count > 0)
                    //    {
                    //        _objUserWiseRights.Corporate = dsList.Tables[0].Rows[0]["Corporate"].ToString();
                    //        _objUserWiseRights.Unit = dsList.Tables[0].Rows[0]["Unit"].ToString();
                    //        _objUserWiseRights.Location = dsList.Tables[0].Rows[0]["Location"].ToString();
                    //        _objUserWiseRights.srno = dsList.Tables[0].Rows[0]["SrNo"].ToString();
                    //        //  ViewBag.OtherData = dsList.Tables[0];
                    //    }
                    //}
                }
                var result = GridColumnScreen.ToList();
                var result2 = UserWiseRights;
                // ViewBag.Columns = GridColumnScreen.ToList();
                return Json(new { Grid = result, UserWiseRights = UserWiseRights }, JsonRequestBehavior.AllowGet);
                // return Json(new { Corporate = _objUserWiseRights.Corporate, Unit = _objUserWiseRights.Unit, Location = _objUserWiseRights.Location, Grid = GridColumnScreen.ToList(), Srno = _objUserWiseRights.srno }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception)
            {
                throw;
            }
        }