public ActionResult SecurityPersonnelDetails(String securitypersonnelid)
        {
            if (SecurityManagerIDSanctityCheck(securitypersonnelid))
            {
                securityPersonnel = new SecurityPersonnelsModel();
                securityPersonnel.CommunityID = myCommunityID;
                securityPersonnel.SecurityPersonnelID = Convert.ToInt64(securitypersonnelid);

                return PartialView("Partials/Users/SecurityPersonnels/SecurityPersonnelDetails", securityPersonnelsDAL.SecurityPersonnelDetails(securityPersonnel));
            }
            else
                return AjaxParamError("SecurityPersonnel");
        }
        public ActionResult NewSecurityPerson(SecurityPersonnelsModel securityPersonnel)
        {
            if (this.ModelState.IsValid)
            {
                securityPersonnel.SP_CreatedOn = Convert.ToDateTime(DateTime.Now.ToString());
                securityPersonnel.SP_CreatedUserID = Convert.ToInt64(useMyCookie["UserID"].ToString());
                securityPersonnel.SP_CreatedRoleID = Convert.ToByte(useMyCookie["RoleID"].ToString());

                return Json(securityPersonnelsDAL.AddSecurityPersonnel(securityPersonnel));
            }
            else
                return AjaxDataError("SecurityPersonnel");
        }
        public ActionResult RegistrationPartial(String roleid)
        {
            if (RoleIDSanctityCheck(roleid))
            {
                String partial = null;
                ViewBag.CommunityID = myCommunityID;
                Object loadModel = null;
                switch (roleid)
                {
                    case "2": partial = "Administrators/NewAdministrator";
                        administrator = new AdministratorsModel();
                        administrator.CommunityID = myCommunityID;
                        loadModel = administrator;
                        break;
                    case "3": partial = "SecurityManagers/NewSecurityManager";
                        securityManager = new SecurityManagersModel();
                        securityManager.CommunityID = myCommunityID;
                        loadModel = securityManager;
                        break;
                    case "4": partial = "SecurityPersonnels/NewSecurityPerson";
                        securityPersonnel = new SecurityPersonnelsModel();
                        securityPersonnel.CommunityID = myCommunityID;
                        loadModel = securityPersonnel;
                        break;
                    case "5": partial = "HomeOwners/NewHomeOwner";
                        homeOwner = new HomeOwnersModel();
                        homeOwner.CommunityID = myCommunityID;
                        loadModel = homeOwner;
                        break;
                    case "6": partial = "ServiceProviders/NewServiceProvider";
                        serviceProvider = new ServiceProvidersModel();
                        serviceProvider.CommunityID = myCommunityID;
                        loadModel = serviceProvider;
                        break;
                }

                return PartialView("Partials/Users/" + partial, loadModel);
            }
            else
                return AjaxParamError("Role");
        }
        public ActionResult DeleteSecurityPersonnel(String securitypersonnelid)
        {
            if (SecurityPersonIDSanctityCheck(securitypersonnelid))
            {
                securityPersonnel = new SecurityPersonnelsModel();
                securityPersonnel.CommunityID = myCommunityID;
                securityPersonnel.SecurityPersonnelID = Convert.ToInt64(securitypersonnelid);
                securityPersonnel.SP_ModifiedUserID = Convert.ToInt64(useMyCookie["UserID"].ToString());
                securityPersonnel.SP_ModifiedRoleID = Convert.ToByte(useMyCookie["RoleID"].ToString());
                securityPersonnel.SP_ModifiedOn = Convert.ToDateTime(DateTime.Now.ToShortDateString());

                return Json(securityPersonnelsDAL.DeleteSecurityPersonnel(securityPersonnel));
            }
            else
                return AjaxParamError("SecurityPersonnel");
        }
        public ActionResult EditSecurityPersonnel(String securitypersonnelid)
        {
            if (SecurityPersonIDSanctityCheck(securitypersonnelid))
            {
                securityPersonnel = new SecurityPersonnelsModel();
                securityPersonnel.CommunityID = myCommunityID;
                securityPersonnel.SecurityPersonnelID = outSecurityPersonID;

                return PartialView("Partials/Users/SecurityPersonnels/EditSecurityPersonnel", securityPersonnelsDAL.EditSecurityPersonnel(securityPersonnel));
            }
            else
                return AjaxParamError("SecurityPersonnel");
        }
 public ActionResult UpdateSecurityPersonnel(SecurityPersonnelsModel securityPersonnel)
 {
     if (this.ModelState.IsValid)
     {
         securityPersonnel.CommunityID = myCommunityID;
         securityPersonnel.SP_ModifiedUserID = Convert.ToInt64(useMyCookie["UserID"].ToString());
         securityPersonnel.SP_ModifiedOn = Convert.ToDateTime(DateTime.Now.ToShortDateString());
         return Json(securityPersonnelsDAL.UpdateSecurityPerson(securityPersonnel));
     }
     else
         return AjaxDataError("SecurityPersonnel");
 }
 private void SecurityPersonnelsList()
 {
     securityPersonnel = new SecurityPersonnelsModel();
     securityPersonnel.CommunityID = myCommunityID;
     ViewBag.SecurityPersonnelsList = securityPersonnelsDAL.SecurityPersonnelsList(securityPersonnel);
 }
 private void NewSecurityPersonnelCommunity(ref SecurityPersonnelsModel newsecuritypersonnel)
 {
     securityPersonnelsDAL.NewSecurityPersonnelCommunity(ref newsecuritypersonnel);
 }
 public ActionResult SecurityPersonnelsListTable()
 {
     securityPersonnel = new SecurityPersonnelsModel();
     securityPersonnel.CommunityID = myCommunityID;
     ViewBag.SecurityPersonnelsList = securityPersonnelsDAL.SecurityPersonnelsList(securityPersonnel);
     return PartialView("Partials/Users/SecurityPersonnels/SecurityPersonnelsListTable");
 }
        public ActionResult SecurityPersonnelsListTable(String communityid)
        {
            if (CommunityIDSanctityCheck(communityid))
            {
                securityPersonnel = new SecurityPersonnelsModel();
                securityPersonnel.CommunityID = outCommunityID;

                return PartialView("Partials/Users/SecurityPersonnels/SecurityPersonnelsListTable", securityPersonnelsDAL.SecurityPersonnelsList(securityPersonnel));
            }
            else
                return AjaxParamError("Community");
        }
        internal Object AddSecurityPersonnel(SecurityPersonnelsModel securitypersonnel)
        {
            AddParameter("@communityid", securitypersonnel.CommunityID);
            AddParameter("@username", securitypersonnel.EmailID);
            AddParameter("@password", securitypersonnel.Password);
            AddParameter("@hintquestionid", securitypersonnel.SP_HintQuestionID);
            AddParameter("@hint", securitypersonnel.SP_Hint);

            AddParameter("@firstname", securitypersonnel.SP_FirstName);
            AddParameter("@middlename", securitypersonnel.SP_MiddleName);
            AddParameter("@lastname", securitypersonnel.SP_LastName);
            AddParameter("@mobile", securitypersonnel.SP_Mobile);
            AddParameter("@homephone", securitypersonnel.SP_HomePhone);
            AddParameter("@workphone", securitypersonnel.SP_WorkPhone);
            AddParameter("@address1", securitypersonnel.SP_Address1);
            AddParameter("@address2", securitypersonnel.SP_Address2);

            AddParameter("@createdon", securitypersonnel.SP_CreatedOn);
            AddParameter("@createduserid", securitypersonnel.SP_CreatedUserID);
            AddParameter("@createdroleid", securitypersonnel.SP_CreatedRoleID);

            return this.ExecuteScalar("usp_AddSecurityPersonnel");
        }
        public List<SecurityPersonnelsModel> SecurityPersonnelsList(SecurityPersonnelsModel securitypersonnel)
        {
            AddParameter("@communityid", securitypersonnel.CommunityID);

            DataTable Dt_SecurityPersonnelsList = GetDataTable("usp_GetSecurityPersonnelsList");
            securityPersonnelsList = new List<SecurityPersonnelsModel>();
            if (Dt_SecurityPersonnelsList.Rows.Count > 0)
            {
                foreach (DataRow dr in Dt_SecurityPersonnelsList.Rows)
                {
                    securityPersonnelObj = new SecurityPersonnelsModel();

                    securityPersonnelObj.SecurityPersonnelID = Convert.ToInt64(dr["SecurityPersonnelID"].ToString());

                    securityPersonnelObj.CommunityID = Convert.ToInt16(dr["CommunityID"].ToString());
                    securityPersonnelObj.CommunityName = dr["CommunityName"].ToString();
                    securityPersonnelObj.CommunityAddress = dr["CommunityAddress"].ToString();
                    securityPersonnelObj.City = dr["City"].ToString();
                    securityPersonnelObj.Zip = dr["Zip"].ToString();
                    securityPersonnelObj.State = dr["State"].ToString();
                    securityPersonnelObj.Country = dr["Country"].ToString();
                    securityPersonnelObj.CommunityPhone1 = dr["CommunityPhone1"].ToString();
                    securityPersonnelObj.CommunityPhone2 = dr["CommunityPhone2"].ToString();
                    securityPersonnelObj.CommunityEmail = dr["CommunityEmail"].ToString();
                    securityPersonnelObj.TotalUnits = Convert.ToByte(dr["TotalUnits"].ToString());
                    securityPersonnelObj.MaxGates = Convert.ToByte(dr["MaxGates"].ToString());
                    securityPersonnelObj.MenuOptions = dr["MenuOptions"].ToString();

                    securityPersonnelObj.EmailID = dr["UserName"].ToString();
                    securityPersonnelObj.SP_HintQuestionID = Convert.ToByte(dr["HintQuestionID"].ToString());
                    securityPersonnelObj.SP_HintQuestion = dr["HintQuestion"].ToString();
                    securityPersonnelObj.SP_Hint = dr["Hint"].ToString();
                    securityPersonnelObj.VFCode = dr["VFCode"].ToString();
                    securityPersonnelObj.UserStatus = Convert.ToChar(dr["Status"]);
                    securityPersonnelObj.UserID = Convert.ToInt64(dr["UserID"].ToString());
                    securityPersonnelObj.Password = dr["Password"].ToString();
                    securityPersonnelObj.RoleID = Convert.ToByte(dr["RoleID"].ToString());
                    securityPersonnelObj.Role = dr["Role"].ToString();

                    securityPersonnelObj.SP_FirstName = dr["FirstName"].ToString();
                    securityPersonnelObj.SP_MiddleName = dr["MiddleName"].ToString();
                    securityPersonnelObj.SP_LastName = dr["LastName"].ToString();
                    securityPersonnelObj.SP_Mobile = dr["Mobile"].ToString();
                    securityPersonnelObj.SP_HomePhone = dr["HomePhone"].ToString();
                    securityPersonnelObj.SP_WorkPhone = dr["WorkPhone"].ToString();
                    securityPersonnelObj.SP_Address1 = dr["Address1"].ToString();
                    securityPersonnelObj.SP_Address2 = dr["Address2"].ToString();

                    securityPersonnelObj.SP_CreatedOn = Convert.ToDateTime(dr["CreatedOn"].ToString());
                    securityPersonnelObj.SP_CreatedUserID = Convert.ToInt64(dr["CreatedUserID"].ToString());
                    securityPersonnelObj.SP_CreatedRoleID = Convert.ToByte(dr["CreatedRoleID"].ToString());

                    if (!String.IsNullOrEmpty(dr["ModifiedOn"].ToString()))
                    {
                        securityPersonnelObj.SP_ModifiedOn = Convert.ToDateTime(dr["ModifiedOn"].ToString());
                        securityPersonnelObj.SP_ModifiedUserID = Convert.ToInt64(dr["ModifiedUserID"].ToString());
                        securityPersonnelObj.SP_ModifiedRoleID = Convert.ToByte(dr["ModifiedRoleID"].ToString());
                    }

                    securityPersonnelsList.Add(securityPersonnelObj);
                }
            }
            return securityPersonnelsList;
        }
        internal void NewSecurityPersonnelCommunity(ref SecurityPersonnelsModel securitypersonnel)
        {
            CommunitiesModel community = new CommunitiesModel();
            CommunitiesModel communityDetails = new CommunitiesModel();

            community.CommunityID = securitypersonnel.CommunityID;
            CommunitiesDAL communitiesDAL = new CommunitiesDAL();
            communityDetails = communitiesDAL.CommunityDetails(community);

            securitypersonnel.CommunityName = communityDetails.CommunityName;
            securitypersonnel.CommunityAddress = communityDetails.CommunityAddress;
            securitypersonnel.City = communityDetails.City;
            securitypersonnel.Zip = communityDetails.Zip;
            securitypersonnel.State = communityDetails.State;
            securitypersonnel.Country = communityDetails.Country;
        }
        internal Object DeleteSecurityPersonnel(SecurityPersonnelsModel securitypersonnel)
        {
            AddParameter("@securitypersonnelid", securitypersonnel.SecurityPersonnelID);
            AddParameter("@communityid", securitypersonnel.CommunityID);

            AddParameter("@modifiedon", securitypersonnel.SP_ModifiedOn);
            AddParameter("@modifieduserid", securitypersonnel.SP_ModifiedUserID);
            AddParameter("@modifiedroleid", securitypersonnel.SP_ModifiedRoleID);

            return ExecuteScalar("usp_DeleteSecurityPersonnel");
        }