Пример #1
0
        public ActionResult New(string title, string Id = "")
        {
            if (Id == "")
            {
                return(RedirectToAction("All"));
            }
            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            Sec_UserBL ud = new Sec_UserBL();

            ViewBag.tit      = title;
            ViewBag.Id       = 0;
            ViewBag.Reports  = sl.User("All");
            ViewBag.ReportTo = ud.ToList("All");

            if (Id != "")
            {
                ViewBag.Id = Convert.ToInt64(Id);
            }

            ClientsBL ub = new ClientsBL();

            ViewBag.Clients2 = sl.Clients("AllRecords");
            NewData();


            return(View());
        }
Пример #2
0
        public JsonResult ToList(string filter, string value)
        {
            Sec_UserBL      ud  = new Sec_UserBL();
            List <Sec_User> rec = ud.ToList(filter, value);

            rec = rec.Select(c => { c.Password = ""; return(c); }).ToList();
            return(Json(rec, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult All()
        {
            string     Id = null;
            Sec_UserBL ub = new Sec_UserBL();
            ClientsBL  cl = new ClientsBL();

            TempData["CompanyId"] = Id;
            ViewBag.Id            = Id;
            var User = Session["user"] as LoginInformation;

            TempData["UserId"] = User.UserId.ToString();
            if (User.IsAdmin == true)
            {
                ViewBag.Client = null;
                if (Id == null)
                {
                    TempData["CompanyId"] = Convert.ToString(ViewBag.CompId);
                    ViewBag.Id            = Convert.ToString(ViewBag.CompId);
                    // var Client = cl.Single("ById", Id).ClientName;
                    //ViewBag.Client =Client;
                }
                var Data = ub.ToList("All", Convert.ToString(ViewBag.UserId));
                return(View(Data));
            }
            else
            {
                ViewBag.Client = null;
                if (Id == null)
                {
                    TempData["CompanyId"] = Convert.ToString(ViewBag.CompId);
                    ViewBag.Id            = Convert.ToString(ViewBag.CompId);
                    // var Client = cl.Single("ById", Id).ClientName;
                    //ViewBag.Client =Client;
                }

                return(View(ub.ToList("UserByUserId", Convert.ToString(User.UserId))));
            }
        }
Пример #4
0
        public List <SelectListItem> UsersByRoleId(int Id)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            Sec_UserBL            ub    = new Sec_UserBL();
            List <Sec_User>       lst   = ub.ToList("byRoleId", Id.ToString());

            foreach (var item in lst)
            {
                items.Add(new SelectListItem {
                    Text = item.FirstName + " " + item.LastName, Value = item.UserId.ToString()
                });
            }
            return(items);
        }
Пример #5
0
 public List <Sec_User> UsersList()
 {
     try
     {
         Sec_UserBL ub = new Sec_UserBL();
         return(ub.ToList("byRoleName", "Tester").Select(m => new Sec_User {
             UserName = m.FirstName + " " + m.LastName, Id = Convert.ToInt32(m.UserId)
         }).ToList());
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
        public List <SelectListItem> User(string filter, string value = null)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            Sec_UserBL            cb    = new Sec_UserBL();
            var lst = cb.ToList(filter, value);

            items.Add(new SelectListItem {
                Text = "--Select User--", Value = "0"
            });
            foreach (var item in lst)
            {
                items.Add(new SelectListItem {
                    Text = item.FirstName + "" + item.LastName, Value = item.UserId.ToString()
                });
            }
            return(items);
        }
Пример #7
0
        public JsonResult Details(Int64 Id, string Key)
        {
            PM_ProjectBL pd      = new PM_ProjectBL();
            var          Project = pd.ToSingle("ByProjectId", Id.ToString());

            AD_DefinationBL db            = new AD_DefinationBL();
            var             ProjectStatus = db.ToList("byDefinationType", "Project Status");
            Int64           UserId        = ViewBag.UserId;
            var             UserScopes    = db.ToList("UserScopes", UserId.ToString());
            var             Priorities    = db.ToList("byDefinationType", "Priority");
            var             FormTypes     = db.ToList("byDefinationType", "FormType");
            var             TaskTypes     = db.ToList("byDefinationType", "Task Types");
            Sec_UserBL      ud            = new Sec_UserBL();
            List <Sec_User> Users         = ud.ToList("ByProjectId", Id.ToString());

            Users = Users.Select(c => { c.Password = ""; return(c); }).ToList();

            return(Json(new { Project = Project, ProjectStatus = ProjectStatus, UserScopes = UserScopes
                              , Priorities = Priorities, FormTypes = FormTypes, Users = Users, TaskTypes = TaskTypes }, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public ActionResult Edit(string Id = "")
        {
            ClientsBL       cb   = new ClientsBL();
            UserClientsBL   uchb = new UserClientsBL();
            UserCityBL      ucb  = new UserCityBL();
            AD_DefinationBL db   = new AD_DefinationBL();
            Sec_User        user = new Sec_User();

            Sec_UserBL               ubl = new Sec_UserBL();
            Sec_UserSettingsDL       udl = new Sec_UserSettingsDL();
            Sec_PermissionBL         pl  = new Sec_PermissionBL();
            Sec_UserDefinationTypeBL udt = new Sec_UserDefinationTypeBL();

            ViewBag.Titles = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Mr.", Value = "1"
                },
                new SelectListItem {
                    Text = "Mrs.", Value = "2"
                },
                new SelectListItem {
                    Text = "Miss.", Value = "3"
                },
                new SelectListItem {
                    Text = "Ms.", Value = "4"
                },
                new SelectListItem {
                    Text = "Sir.", Value = "5"
                },
                new SelectListItem {
                    Text = "DR", Value = "6"
                }
            };
            ViewBag.Hide = false;
            ViewBag.Team = false;
            if (Id == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide = true;
                List <OrgChart> rec   = ubl.hierarchy("ByCompanyId", Convert.ToString(ViewBag.CompId));
                List <Chart>    Data2 = FlatToHierarchy(rec, ViewBag.UserId);
                if (Data2.Count > 0)
                {
                    ViewBag.Team = true;
                }
                else
                {
                    ViewBag.Team = false;
                }
            }
            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            Sec_UserBL ud   = new Sec_UserBL();
            Sec_User   User = ud.Single("ById", Id.ToString());

            ViewBag.UserTitle = User.Title;
            ViewBag.Hide2     = true;
            if (User.ReportToId.ToString() == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide2 = false;
            }
            if (Id == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide2 = false;
            }
            ViewBag.User = User;
            if (User == null)
            {
            }
            if (User.IsAdmin == true)
            {
                ViewBag.Hide  = false;
                ViewBag.Hide2 = false;
                ViewBag.Team  = true;
            }
            NewData();
            ViewBag.Id       = User.CompanyId;
            ViewBag.RoleId   = User.RoleId;
            ViewBag.Reports  = sl.User("All");
            ViewBag.ReportTo = ud.ToList("All");
            ViewBag.Clients2 = sl.Clients("AllRecords");
            /////permissions
            user = ubl.Single("ById", Id.ToString());
            ///Project
            DataTable Table = udl.GetDataTable("All_Projects", User.ReportToId.ToString(), null, null);

            ViewBag.Projects = Table.ToList <PM_Projects>();
            DataTable Table1 = udl.GetDataTable("UserProjects", Id.ToString(), null, null);

            ViewBag.UserProjects = Table1.ToList <PM_Projects>();
            var    r          = pl.ToList("byUserId", Id.ToString());
            var    d          = udt.ToList("GetByUserId", Id.ToString());
            string UDSelected = null;

            foreach (var item in d)
            {
                UDSelected += item.DefinationTypeId + ",";
            }
            ViewBag.DIds = UDSelected;
            string Selected = null;

            foreach (var item in r)
            {
                Selected += item.Id + ",";
            }
            ViewBag.PIds = Selected;
            ViewBag.UId  = Id;

            #region user Permissions on tab
            //Clients
            //ViewBag.Clients = cb.ToList("byStatus", User.ReportToId.ToString());
            ViewBag.Clients     = cb.ToList("byStatus", "True", User.ReportToId.ToString());
            ViewBag.UserClients = uchb.ToList("byUserId", Id.ToString());
            //Cities

            ViewBag.Cities = db.ToList("AllCities");
            //db.ToList("UserCities",User.ReportToId.ToString());
            ViewBag.UserCities = ucb.ToList("byUserId", Id.ToString());

            ViewBag.Region = db.RegionsToList(User.ReportToId.ToString());
            //scope
            ViewBag.Scopes = db.ToList("Scopes", User.ReportToId.ToString());
            //ViewBag.Scopes = db.ToList("Scopes");
            ViewBag.UserScopes = db.ToList("UserScopes", Id.ToString());

            ViewBag.Permissions = pl.ToList("byRoleId", user.RoleId.ToString(), User.ReportToId.ToString());

            #endregion
            AD_DefinationTypesBL dtd = new AD_DefinationTypesBL();
            ViewBag.DefinationTypes = dtd.ToList("All", User.ReportToId.ToString());

            //User.RoleName = ViewBag.RoleName;
            return(View("edit", User));
        }