Example #1
0
        public ActionResult DropdownBranch(int CustId)
        {
            List <DDBranch_get_Result> dDBranch_s = new List <DDBranch_get_Result>();

            if (Session["ProfileId"] != null)
            {
                if (Convert.ToString(Session["ProfileId"]) == "1" || Convert.ToString(Session["ProfileId"]) == "2")
                {
                    using (SecurityDBEntities entities = new SecurityDBEntities())
                    {
                        dDBranch_s = entities.DDBranch_get(CustId).ToList();
                    }
                }
                else
                {
                    string[]            BranchName        = Convert.ToString(Session["BranchMapping"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    string[]            BranchId          = Convert.ToString(Session["BranchId"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    DDBranch_get_Result branch_Get_Result = new DDBranch_get_Result();
                    for (int i = 0; i < BranchName.Length; i++)
                    {
                        branch_Get_Result.BranchName = BranchName[i].ToString();
                    }
                    for (int i = 0; i < BranchId.Length; i++)
                    {
                        branch_Get_Result.BranchId = Convert.ToInt32(BranchId[i]);
                    }
                    dDBranch_s.Add(branch_Get_Result);
                }
            }
            return(Json(dDBranch_s));
        }
Example #2
0
        public bool ValidateUser(string username, string password)
        {
            using (SecurityDBEntities db = new SecurityDBEntities())
            {
                var result = from u in db.Users where (u.LOGIN == username) select u;

                if (result.Count() != 0)
                {
                    var dbuser = result.First();

                    if (dbuser.PASSWORD == CreatePasswordHash(password, dbuser.PASSWORD_SALT))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }
Example #3
0
        public ActionResult DDCustomer(int ClientId)
        {
            List <DDCustomers_get_Result> dDCustomers = new List <DDCustomers_get_Result>();

            if (Session["ProfileId"] != null)
            {
                if (Convert.ToString(Session["ProfileId"]) == "1" || Convert.ToString(Session["ProfileId"]) == "2")
                {
                    using (SecurityDBEntities entities = new SecurityDBEntities())
                    {
                        dDCustomers = entities.DDCustomers_get(ClientId).ToList();
                    }
                }
                else
                {
                    string[] CustName = Convert.ToString(Session["CustMapping"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    string[] CustId   = Convert.ToString(Session["CustId"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    DDCustomers_get_Result dDCustomers_Get_ = new DDCustomers_get_Result();
                    for (int i = 0; i < CustName.Length; i++)
                    {
                        dDCustomers_Get_.CustName = CustName[i].ToString();
                    }
                    for (int i = 0; i < CustId.Length; i++)
                    {
                        dDCustomers_Get_.CustId = Convert.ToInt32(CustId[i]);
                    }
                    dDCustomers.Add(dDCustomers_Get_);
                }
            }
            return(Json(dDCustomers));
        }
Example #4
0
        public ActionResult DropdownSite(int ClusterId)
        {
            List <DDSites_get_Result> dDSites_Get_Results = new List <DDSites_get_Result>();

            if (Session["ProfileId"] != null)
            {
                if (Convert.ToString(Session["ProfileId"]) == "1" || Convert.ToString(Session["ProfileId"]) == "2")
                {
                    using (SecurityDBEntities entities = new SecurityDBEntities())
                    {
                        dDSites_Get_Results = entities.DDSites_get(ClusterId).ToList();
                    }
                }
                else
                {
                    string[]           SiteName = Convert.ToString(Session["SiteMapping"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    string[]           SiteId   = Convert.ToString(Session["SiteId"]).Split(new string[] { "||" }, StringSplitOptions.None);
                    DDSites_get_Result dDSites  = new DDSites_get_Result();
                    for (int i = 0; i < SiteName.Length; i++)
                    {
                        dDSites.SiteName = SiteName[i].ToString();
                    }
                    for (int i = 0; i < SiteId.Length; i++)
                    {
                        dDSites.SiteId = Convert.ToInt32(SiteId[i]);
                    }
                    dDSites_Get_Results.Add(dDSites);
                }
            }
            return(Json(dDSites_Get_Results));
        }
Example #5
0
        /// <summary>
        /// Проверка, доступна ли страница requested_page для пользователя user_login.
        /// Проверка выполняется по группам, в котрые входит пользователь.
        /// </summary>
        /// <param name="user_login"></param>
        /// <param name="requested_page"></param>
        /// <returns></returns>
        public bool CheckUserPageAccess(string user_login, string requested_page)
        {
            using (SecurityDBEntities db = new SecurityDBEntities())
            {
                // FirsrOrDefault() для типа bool при отсутствии результата вернет false
                bool _is_user_admin = (from ua in db.Users where (ua.LOGIN == user_login) select ua.IS_ADMIN).FirstOrDefault();
                // Если пользователь является тотальным администратором, то ему доступно все и всегда.
                if (_is_user_admin)
                {
                    return(true);
                }

                // В случае когда пользователь не тотальный администратор, то проверяем роли у этого пользователя
                // и доступна ли данная страница для групп, в которые входит данный пользователь.
                int _page = (from u in db.Users
                             join g in db.UsersInAccessGroups on u.USER_ID equals g.USER_ID
                             join gp in db.AccessPagesInAccessGroups on g.ACCESSGROUP_ID equals gp.ACCESSGROUP_ID
                             join p in db.AccessPages on gp.ACCESSPAGE_ID equals p.ACCESSPAGE_ID
                             where (u.LOGIN == user_login && p.NAME == requested_page)
                             select p.NAME).Count();

                // Если хотябы в одной роли страница доступна, то разрешаем показ страницы пользователю
                if (_page > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
 public ActionResult Insert_UpdateEmployee()
 {
     using (SecurityDBEntities entities = new SecurityDBEntities())
     {
     }
     return(Json(""));
 }
 public ActionResult DeleteEmploye(string Id)
 {
     using (SecurityDBEntities entities = new SecurityDBEntities())
     {
         entities.EmployeeMDelete_get(Convert.ToInt32(Id), Convert.ToInt32(Session["UserId"]));
     }
     return(Json("Deleted Successfully"));
 }
Example #8
0
 public ActionResult Insert_UpdateDesignation(int hdnvalue, int DesignationId, string Designationname)
 {
     List<string> Response = new List<string>();
     using (SecurityDBEntities entities = new SecurityDBEntities())
     {
         Response = entities.DesignationMInsert_update_get(hdnvalue, DesignationId, Designationname, Convert.ToInt32(Session["Userid"])).ToList();
     }
     return Json(Response);
 }
Example #9
0
 public ActionResult DeleteDesignation(int id)
 {
     List<string> Response = new List<string>();
     using (SecurityDBEntities entities = new SecurityDBEntities())
     {
         Response = entities.DesignationMDelete_get(id, Convert.ToInt32(Session["Userid"])).ToList();
     }
     return Json(Response);
 }
Example #10
0
        public ActionResult CityDDGet(int StateId)
        {
            List <DDCity_Get_Result> dDCity_s = new List <DDCity_Get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                dDCity_s = entities.DDCity_Get(StateId).ToList();
            }
            return(Json(dDCity_s));
        }
Example #11
0
        public ActionResult StateDDget(int CountryId)
        {
            List <DDState_Get_Result> dDState_Gets = new List <DDState_Get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                dDState_Gets = entities.DDState_Get(CountryId).ToList();
            }
            return(Json(dDState_Gets));
        }
Example #12
0
        public ActionResult CountryGet()
        {
            List <DDCountry_Get_Result> dDCountry_s = new List <DDCountry_Get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                dDCountry_s = entities.DDCountry_Get().ToList();
            }
            return(Json(dDCountry_s));
        }
        public ActionResult EditEmployee(string Id)
        {
            List <EmployeeMEdit_get_Result> employeeMEdit_Get_Results = new List <EmployeeMEdit_get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                employeeMEdit_Get_Results = entities.EmployeeMEdit_get(Id).ToList();
            }
            return(Json(employeeMEdit_Get_Results));
        }
        public ActionResult DeleteCustomer(string CustId)
        {
            List <string> response = new List <string>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                response = entity.CustomerMDelete_get(Convert.ToInt32(CustId), Convert.ToInt32(Session["Userid"])).ToList();
            }
            return(Json(response));
        }
Example #15
0
        public ActionResult Insert_UpdateSite(string Insert_Update, int hdnSiteId, int ClusterId, string SiteName, string SiteAddress, string SiteContactPerson, string SiteContactMobile, string SiteContactEmailId, string SiteDeactivate)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                Response = entity.SiteMInsert_Update_set(Convert.ToInt32(Insert_Update), hdnSiteId, ClusterId, SiteName, SiteAddress, SiteContactPerson, SiteContactMobile, SiteContactEmailId, Convert.ToInt32(Session["Userid"])).ToList();
            }
            return(Json(Response));
        }
Example #16
0
        public ActionResult EditDevice(string DeviceId)
        {
            List <DeviceMEdit_get_Result> DeviceResult = new List <DeviceMEdit_get_Result>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                DeviceResult = entity.DeviceMEdit_get(Convert.ToInt32(DeviceId)).ToList();
            }
            return(Json(DeviceResult));
        }
        public ActionResult Insert_UpdateCustomer(string Insert_Update, string hdnCustId, string ClientId, string CustomerName, string CustomerAddr, string CustMob, string CustMailid)
        {
            List <string> response = new List <string>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                response = entity.CustomerMInsert_Update_set(Convert.ToInt32(Insert_Update), Convert.ToInt32(hdnCustId), Convert.ToInt32(ClientId), CustomerName, CustMob, CustMailid, CustomerAddr, Convert.ToInt32(Session["Userid"])).ToList();
            }
            return(Json(response));
        }
Example #18
0
        public ActionResult InsertUpdateDevice(int Insert_Update, int hdnDeviceId, int ClusterId, int ClientId, string SiteName, string DeviceIMEI, string DevicePhone, string DeviceCarrier, string DeviceType, string DeviceState, string EmailId, string SuperVisorPassword, string Superuserpassword, string WarrantyStartDate, string WarrantyEndDate, string DeviceAlertSMS1, string DeviceAlertSMS2, string DeviceAlertEmail1, string DeviceAlertEmail2, string Location)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                Response = entity.DeviceMInsert_Update_set(Insert_Update, hdnDeviceId, ClientId, ClusterId, SiteName, DeviceIMEI, DevicePhone, DeviceCarrier, DeviceType, DeviceState, SuperVisorPassword, Superuserpassword, EmailId, WarrantyStartDate, WarrantyEndDate, DeviceAlertSMS1, DeviceAlertSMS2, DeviceAlertEmail1, DeviceAlertEmail2, Location, Convert.ToInt32(Session["UserId"])).ToList();
            }
            return(Json(Response));
        }
        public ActionResult DeleteCluster(int ClusterId)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entites = new SecurityDBEntities())
            {
                Response = entites.ClusterMDelete_get(ClusterId, Convert.ToInt32(Session["Userid"])).ToList();
            }
            return(Json(Response));
        }
Example #20
0
        public ActionResult DeleteSite(int SiteId)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                Response = entity.SiteMDelete_get(SiteId, Convert.ToInt32(Session["Userid"])).ToList();
            }
            return(Json(Response));
        }
Example #21
0
        // GET: ManageDevice
        public ActionResult ManageDevice()
        {
            List <DeviceMList_get_Result> DeviceList = new List <DeviceMList_get_Result>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                DeviceList = entity.DeviceMList_get().ToList();
            }
            ViewBag.deviceviewall = DeviceList;
            return(View());
        }
Example #22
0
        public ActionResult Insert_UpdateBranch(string Insert_Update, int hdnBranchId, int CustomerId, string BranchName, string BranchAddress, string ContactPerson, string BranchContactMobile, string BranchContactEmailId)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entites = new SecurityDBEntities())
            {
                Response = entites.BranchMInsert_Update_set(Convert.ToInt32(Insert_Update), hdnBranchId, CustomerId, BranchName, BranchAddress, ContactPerson, BranchContactMobile, BranchContactEmailId, Convert.ToInt32(Session["Userid"])).ToList();
            }

            return(Json(Response));
        }
Example #23
0
        // GET: BranchMaster
        public ActionResult BranchMaster()
        {
            List <BranchMList_get_Result> BranchList = new List <BranchMList_get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                BranchList = entities.BranchMList_get(Convert.ToInt32(Session["ProfileId"]), Convert.ToInt32(Session["UserId"])).ToList();
            }
            ViewBag.load = BranchList;
            return(View());
        }
        public ActionResult ClusterUpdate(string Insert_Update, int BranchId, int ClusterId, string ClusterName, string ClusterAddress, string ContactPerson, string ContactMobile, string ContactEmailId)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entites = new SecurityDBEntities())
            {
                Response = entites.ClusterMInsert_Update_set(Convert.ToInt32(Insert_Update), BranchId, ClusterId, ClusterName, ClusterAddress, ContactPerson, ContactMobile, ContactEmailId, Convert.ToInt32(Session["Userid"])).ToList();
            }

            return(Json(Response));
        }
        public ActionResult ClusterMaster()
        {
            List <ClusterMList_get_Result> cm = new List <ClusterMList_get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                cm = entities.ClusterMList_get(Convert.ToInt32(Session["ProfileId"]), Convert.ToInt32(Session["UserId"])).ToList();
            }
            ViewBag.load = cm;
            return(View());
        }
        // GET: EmployeeAllocation
        public ActionResult EmployeeAllocation()
        {
            List <EmployeeList_get_Result> employeeList_Get_Results = new List <EmployeeList_get_Result>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                employeeList_Get_Results = entities.EmployeeList_get().ToList();
            }
            ViewBag.Employee = employeeList_Get_Results;
            return(View());
        }
        // GET: CustomerMaster
        public ActionResult CustomerMaster()
        {
            List <CustomerMList_get_Result> custResult = new List <CustomerMList_get_Result>();

            using (SecurityDBEntities entity = new SecurityDBEntities())
            {
                custResult = entity.CustomerMList_get(Convert.ToInt32(Session["ClientId"])).ToList();
            }

            ViewBag.cust = custResult;
            return(View());
        }
Example #28
0
        public ActionResult Insert_UpdateClient(int hdnvalue, int ClientId, string ClientName, string ClientPhNo, string ClientAddr, string AuthPersonName, string AuthPersonNo, string AuthPersonMailid)
        {
            List <string> Response = new List <string>();

            using (SecurityDBEntities entities = new SecurityDBEntities())
            {
                Response = entities.ClientMInsert_update_get(hdnvalue, ClientId, ClientName, ClientPhNo, ClientAddr, AuthPersonName, AuthPersonNo, AuthPersonMailid, Convert.ToInt32(Session["Userid"])).ToList();
            }


            return(Json(Response));
        }
Example #29
0
        /// <summary>
        /// Добавление пользователю группы по USER_ID пользователя
        /// и по ACCESSGROUP_ID группы
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="accessgroup_id"></param>
        /// <returns></returns>
        public void AddUserInAccessGroup(Int64 user_id, Int64 accessgroup_id)
        {
            using (SecurityDBEntities db = new SecurityDBEntities())
            {
                UsersInAccessGroups userinaccessgroup = new UsersInAccessGroups();
                userinaccessgroup.USER_ID        = user_id;
                userinaccessgroup.ACCESSGROUP_ID = accessgroup_id;

                db.AddToUsersInAccessGroups(userinaccessgroup);
                db.SaveChanges();
            }
        }
Example #30
0
        public ActionResult DesignationMaster()
        {
            List<DesignationMList_get_Result> designationMList_Get_Results = new List<DesignationMList_get_Result>();
            using (SecurityDBEntities context = new SecurityDBEntities())
            {
                designationMList_Get_Results = context.DesignationMList_get().ToList();
            }

            ViewBag.Details = designationMList_Get_Results;
            return View();

        }