public ActionResult LeaveRequest(Leave model) { CSvc = new BALCommon(ConStr); try { EmployeeMaster EMself = CSvc.GetSingleEmployee(_UserTypeBaseID); EmployeeMaster EMParent = CSvc.GetSingleEmployee(EMself.ParentID); model.SenderID = _UserTypeBaseID; model.SenderName = EMself.FIRSTNAME; model.SenderType = Convert.ToString(_UserType); model.ApproverID = EMself.ParentID; model.ApproverName = EMParent.FIRSTNAME; model.ApproverType = Convert.ToString(_UserType); model.LeaveStatus = "Pending"; model.SchoolID = _OrgnisationID; model.FinancialYear = _Financialyearid; model.LeaveType = model.LeaveType.Split('_')[0]; model.Action = "INS"; bool res = CSvc.InsertUpdateLeaveRequest(model); if (res) { TempData[Constants.MessageInfo.SUCCESS] = "Request sent successfully."; } else { TempData[Constants.MessageInfo.ERROR] = "Request could not sent successfully."; } } catch (Exception ex) { } return(RedirectToAction("Leave")); }
public ActionResult ForgotPassword(ResetForgotPassword model) { BALCommon obj = new BALCommon(ConStr); try { string OTP = obj.getUserProfile(model.UserName).OTP; if (!string.IsNullOrEmpty(OTP) && model.OTP == OTP) { string sResetToken = WebSecurity.GeneratePasswordResetToken(model.UserName, 30000); if (WebSecurity.ResetPassword(sResetToken, model.NewPassword)) { TempData[Constants.MessageInfo.SUCCESS] = "Password has been updated successfully."; } else { TempData[Constants.MessageInfo.ERROR] = "Password could not updated."; } } else { TempData[Constants.MessageInfo.ERROR] = "Incorrect OTP."; return(View(model)); } } catch (Exception ex) { } return(RedirectToAction("Login")); }
public ActionResult Leave() { Leave model = new Leave(); List <Leave> _Lst = new List <Leave>(); CSvc = new BALCommon(ConStr); try { Leave obj = new Leave { FinancialYear = _Financialyearid, SchoolID = _OrgnisationID, SenderID = _UserTypeBaseID, ApproverID = _UserTypeBaseID, Action = "GETSENDER" }; _Lst = CSvc.GetLeaveReport(obj); obj.Action = "GETAPPROVER"; var ApproverLst = CSvc.GetLeaveReport(obj); foreach (var AppLst in ApproverLst) { _Lst.Add(AppLst); } model.LeaveList = _Lst; } catch (Exception ex) { } return(View(model)); }
public List <StateMaster> GetStateList(int?COUNTRY_ID) { //throw new NotImplementedException(); BALCommon bal = new BALCommon(ConStr); return(bal.GetStateList(COUNTRY_ID)); }
public override void OnActionExecuted(ActionExecutedContext filterContext) { str = new StringBuilder(); var model = (BaseModel)filterContext.Controller.ViewData.Model; if (model != null) { BALCommon CSvc = new BALCommon(ConStr); #region Get All Permitted Menu List SessionInfo _SessionInfo = CSvc.GetSessionDetails(WebSecurity.CurrentUserName, DateTime.Now); int _OrgnisationID = Convert.ToInt32(_SessionInfo.SchoolID); int _Financialyearid = Convert.ToInt32(_SessionInfo.FinancialYearID); var ALLMENUPERMISSION = CSvc.GetAllMenuListByUserId(WebSecurity.CurrentUserId, _OrgnisationID); var USERINFO = CSvc.GetUserInfoByuserId(WebSecurity.CurrentUserId, _OrgnisationID); #endregion Get All Permitted Menu List menulist = ALLMENUPERMISSION; string absolutePath = HttpContext.Current.Request.Url.AbsolutePath; MenuMaster reqMenu = (from s in menulist where s.URL.ToLower() == absolutePath.ToLower() select s).FirstOrDefault(); model.PermissionNameList = new List <string>(); model.PermissionNameList.Add("Default");// its only for null checking if (reqMenu != null && reqMenu.PermissionNameList != null) { model.PermissionNameList = reqMenu.PermissionNameList; } model.BaseSessionInfo = _SessionInfo; model.BaseUserInfo = USERINFO; model.usermenu = GetUserMenuList(menulist); } }
public ActionResult LeaveRequest() { Leave model = new Leave(); CSvc = new BALCommon(ConStr); List <selectList> SL = new List <selectList>(); try { EmployeeMaster EM = CSvc.GetSingleEmployee(_UserTypeBaseID); SL.Add(new selectList { Text = "CL", Value = "CL_" + EM.LEAVE_CL_ENTITLED }); SL.Add(new selectList { Text = "PL", Value = "PL_" + EM.LEAVE_PL_ENTITLED }); SL.Add(new selectList { Text = "SL", Value = "SL_" + EM.LEAVE_SL_ENTITLED }); model.LeaveTypeList = SL; } catch (Exception ex) { } return(View(model)); }
public JsonResult DashboardDetails() { DashboardDetails obj = new DashboardDetails(); CSvc = new BALCommon(ConStr); obj = CSvc.GetDashboardDetails(_OrgnisationID, _Financialyearid, DateTime.Now); return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult EmailExists(string LEmailId) { BALCommon CSvc = new BALCommon(ConStr); OragnisationMaster master = new OragnisationMaster(); master = CSvc.GetOragnisationAlready(LEmailId); return(Json(!String.Equals(LEmailId, master.LEmailId, StringComparison.OrdinalIgnoreCase))); }
//[ValidateAntiForgeryToken] //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] public ActionResult Login(LoginModel model, string returnUrl) { try { //WebSecurity.CurrentUserName // WebSecurity.CurrentUserId //ChannelFactory<IMembershipSrv> CF = new ChannelFactory<IMembershipSrv>("MEMBERSHIP"); //IMembershipSrv CSvc = (IMembershipSrv)CF.CreateChannel(); //SHARED.UserProfile userProfile = new SHARED.UserProfile(); //userProfile = CSvc.GetUserProfile(model.UserName); //CF.Close(); if (ModelState.IsValid && WebSecurity.Login(model.UserName, AESEncrytDecry.DecryptStringAES(model.Password), persistCookie: model.RememberMe)) { //ChannelFactory<ICommonSrv> CF = new ChannelFactory<ICommonSrv>("COMMON"); //ICommonSrv CSvc = (ICommonSrv)CF.CreateChannel(); BALCommon CSvc = new BALCommon(ConStr); try { UserMasters userMasters = CSvc.getUserProfile(model.UserName); //CF.Close(); if (!userMasters.ISACTIVE) { TempData["Msg"] = "Please Contact To Technical Team."; WebSecurity.Logout(); } else { if (model.FID > 0 && CSvc.InsertUpdateSession(model.UserName, model.FID) == 1) { return(RedirectToAction("Index", "Home")); } else { WebSecurity.Logout(); } } } catch (Exception ex) { WebSecurity.Logout(); ExecptionLogger.FileHandling("Account(UserLogin_getUserProfilePost)", "Error_014", ex, "Account"); } } else { TempData["Msg"] = "UserName and/or Password is incorrect."; } } catch (Exception ex) { WebSecurity.Logout(); ExecptionLogger.FileHandling("Account(UserLoginPost)", "Error_014", ex, "Account"); } //return View(model); return(RedirectToAction("Login")); }
public AutoCompleteController() { CSvc = new BALCommon(ConStr); SessionInfo _SessionInfo = CSvc.GetSessionDetails(WebSecurity.CurrentUserName, DateTime.Now); _OrgnisationID = Convert.ToInt32(_SessionInfo.SchoolID); _Financialyearid = Convert.ToInt32(_SessionInfo.FinancialYearID); _UserType = Convert.ToInt32(_SessionInfo.UserType); _UserTypeBaseID = Convert.ToInt32(_SessionInfo.UserTypeBaseID); }
public JsonResult GetStudentList(string ClassID, string SectionID, string AdmissionNo) { List <StudentMaster> obj = new List <StudentMaster>(); BALCommon CSvc = new BALCommon(ConStr); try { obj = CSvc.GetStudentList(_OrgnisationID, _Financialyearid, Convert.ToInt32(ClassID), Convert.ToInt32(SectionID), 0, AdmissionNo); } catch { } return(Json(obj, JsonRequestBehavior.AllowGet)); }
//public ActionResult StudentPromote() //{ // StudentPromote Obj = new StudentPromote(); // List<ClassMaster> _ClassList = new List<ClassMaster>(); // try // { // Obj.FinancialYearID = _Financialyearid; // Obj.SectionList = new List<SectionMaster>(); // Obj.ClassList = BALObj.GetClassList(_OrgnisationID); // } // catch { } // return View(Obj); //} //[HttpPost] //public ActionResult StudentPromote(StudnetRollNo Model) //{ // int res = 0; // try // { // foreach (var master in Model.StudentList) // { // master.FinancialYear = _Financialyearid; // master.SchoolID = _OrgnisationID; // master.Modifiedby = WebSecurity.CurrentUserName; // master.Modifieddate = DateTime.Now; // master.RollNo = string.IsNullOrEmpty(master.RollNo) ? "0" : master.RollNo; // res += CSvc.UpdateStudentDetails(master); // } // } // catch // { // } // TempData[Constants.MessageInfo.SUCCESS] = res + " record(s) updated successfully."; // return RedirectToAction("StudentPromote"); //} #region Promote Student public JsonResult GetStudentListToPromote(string ClassID, string SectionID, string FinancialYearID) { List <StudentMaster> obj = new List <StudentMaster>(); BALCommon CSvc = new BALCommon(ConStr); try { obj = CSvc.GetStudentList(_OrgnisationID, Convert.ToInt32(FinancialYearID), Convert.ToInt32(ClassID), Convert.ToInt32(SectionID), 0, ""); } catch { } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult GetClassList() { List <ClassMaster> obj = new List <ClassMaster>(); BALCommon CSvc = new BALCommon(ConStr); try { obj = CSvc.GetClassList(_OrgnisationID);// userMasters.SchoolID); } catch { } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSectionList(string ClassID) { List <SectionMaster> obj = new List <SectionMaster>(); BALCommon CSvc = new BALCommon(ConStr); try { obj = CSvc.GetSectionList(_OrgnisationID, Convert.ToInt32(ClassID));// userMasters.SchoolID); } catch { } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateLeaveRequest(Leave model) { CSvc = new BALCommon(ConStr); bool res = false; try { model.Action = "UPD"; res = CSvc.InsertUpdateLeaveRequest(model); } catch (Exception ex) { } return(Json(res, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmployeeList(string src) { List <EmployeeMaster> _lst = new List <EmployeeMaster>(); BALCommon CSvc = new BALCommon(ConStr); BALFee CSFee = new BALFee(ConStr); try { _lst = CSFee.SearchEmployeeList(src, _OrgnisationID); return(Json(_lst, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(_lst, JsonRequestBehavior.AllowGet)); } }
public ActionResult PromoteStudent() { PromoteStudent Obj = new PromoteStudent(); BALCommon CSvc = new BALCommon(ConStr); try { Obj.FinancialYearList = CSvc.GetFinancialYearList(); Obj.ClassList = BALObj.GetClassList(_OrgnisationID); } catch (Exception ex) { } return(View(Obj)); }
public ActionResult ResetPassword() { BALCommon CSvc = new BALCommon(ConStr); UserMasters _umaster = CSvc.GetByUserId(WebSecurity.CurrentUserId); ResetForgotPassword obj = new ResetForgotPassword { UserId = WebSecurity.CurrentUserId, UserName = WebSecurity.CurrentUserName, Name = _umaster.FISRTNAME, Lastname = _umaster.LASTNAME, IMAGE = _umaster.IMAGE, Mobile = _umaster.Mobile, EmailId = _umaster.EMAILID }; return(View(obj)); }
public HttpResponseMessage Datapacket([FromBody] List <PacketEntity> packetlist) { // Log.Debug("Post packet start at side"); //List<PacketEntity> packetlist = JsonConvert.DeserializeObject<List<PacketEntity>>(value); string ConStr = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; BALCommon CSvc = new BALCommon(ConStr); #region DataTable // DataTable for MCode table DataTable populateTable = new DataTable(); populateTable.Columns.Add("Id", typeof(int)); populateTable.Columns.Add("student_biometricid", typeof(string)); populateTable.Columns.Add("student_RFId", typeof(string)); populateTable.Columns.Add("Punchdatetime", typeof(DateTime)); populateTable.Columns.Add("student_cardnumber", typeof(string)); populateTable.Columns.Add("student_paycode", typeof(string)); populateTable.Columns.Add("Customercode", typeof(string)); populateTable.Columns.Add("Macaddress", typeof(string)); populateTable.Columns.Add("Ipaddress", typeof(string)); #endregion foreach (var downobjet in packetlist) { DataRow Row = populateTable.NewRow(); Row[0] = downobjet.Id; Row[1] = downobjet.student_biometricid; Row[2] = downobjet.student_RFId; Row[3] = downobjet.Punchdatetime; Row[4] = downobjet.student_cardnumber; Row[5] = downobjet.student_paycode; Row[6] = downobjet.Customercode; Row[7] = downobjet.Macaddress; Row[8] = downobjet.Ipaddress; populateTable.Rows.Add(Row); } // Log.Debug(string.Format("Insert records Cout{0}", populateTable.Rows.Count.ToString())); int serverid = CSvc.InsertInDataPacket(populateTable); // Log.Debug(string.Format("update record below to id={0}", serverid.ToString())); if (serverid != 0) { return(Request.CreateResponse(HttpStatusCode.OK, serverid)); } return(Request.CreateResponse(HttpStatusCode.NoContent, default(int))); }
public JsonResult GetGeoDetails(string PinCode) { GEO obj = new GEO(); BALCommon CScmn = new BALCommon(ConStr); try { obj = CScmn.GetGeoDetails(PinCode); } catch (Exception ex) { ExecptionLogger.FileHandling("Fee(GetGeoDetails)", "Error_014", ex, "Fee"); } finally { } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public PartialViewResult GenerateIDCard(string ClassID, string SectionID, string CardType) { List <StudentMaster> objStudent = new List <StudentMaster>(); IDCard IDCardDetails = new IDCard(); BALCommon CSvc = new BALCommon(ConStr); try { objStudent = CSvc.GetStudentList(_OrgnisationID, _Financialyearid, Convert.ToInt32(ClassID), Convert.ToInt32(SectionID), 0, ""); IDCardDetails.OragnisationDetails = CSvc.GetOragnisationDetails(_OrgnisationID); IDCardDetails.StudentDetailsList = objStudent; IDCardDetails.CardType = CardType; } catch { } return(PartialView("IDCard", IDCardDetails)); }
public JsonResult GetOTP(string UID) { BALCommon obj = new BALCommon(ConStr); bool res = false; string message = ""; try { string OTP = Utility.GetRendomString(6, "N"); res = obj.SetOTP(UID, OTP); #region SendMail if (res) { BALCommon CSvc = new BALCommon(ConStr); UserMasters userMasters = CSvc.getUserProfile(UID); MailDetails _MailDetails = new MailDetails(); _MailDetails.ToMailIDs = userMasters.EMAILID; _MailDetails.HTMLBody = true; _MailDetails.Subject = "Reset OTP"; _MailDetails.Body = BALMail.TemplateResetOTP(userMasters, AESEncrytDecry.EncryptStringAES(OTP)); if (BALMail.SendMail(_MailDetails)) { message = "OTP has been sent to your registered mail id."; } else { message = "Please contact technical team"; } } else { message = "Please contact technical team"; } #endregion SendMail } catch (Exception ex) { res = false; } return(Json(message, JsonRequestBehavior.AllowGet)); }
public JsonResult SearchAllocationRepost(string SearchBy, string ClassID, string SectionID, string AdmissionNo, string RouteID) { List <StudentMaster> objStudent = new List <StudentMaster>(); List <Route> objRoute = new List <Route>(); BALCommon CSvc = new BALCommon(ConStr); try { if (SearchBy == "Student") { objStudent = CSvc.GetStudentList(_OrgnisationID, _Financialyearid, Convert.ToInt32(ClassID), Convert.ToInt32(SectionID), 0, AdmissionNo).Where(x => x.TPCostID > 0).ToList(); } else if (SearchBy == "Route") { objStudent = CSvc.GetStudentList(_OrgnisationID, _Financialyearid, 0, 0, Convert.ToInt32(RouteID), "").Where(x => x.TPCostID > 0).OrderBy(x => x.RouteName).ToList(); } return(Json(objStudent, JsonRequestBehavior.AllowGet)); } catch { } return(Json("No Record Found", JsonRequestBehavior.AllowGet)); }
public ActionResult Login(string returnUrl) { BALCommon CSvc = new BALCommon(ConStr); try { if (WebSecurity.CurrentUserId != 0) { WebSecurity.Logout(); } List <FinancialYear> FYList = CSvc.GetFinancialYearList(); TempData["FinancialYearList"] = FYList; TempData["CurrentFinancialYear"] = FYList.Where(x => x.SelectedYear).Select(x => x.FID).FirstOrDefault(); ViewBag.ReturnUrl = returnUrl; } catch (Exception ex) { ExecptionLogger.FileHandling("Account(UserLogin)", "Error_007", ex, "Account"); } return(View()); }
public ActionResult ResetPassword(ResetForgotPassword model, FormCollection collection) { string sResetToken = WebSecurity.GeneratePasswordResetToken(model.UserName, 30000); HttpPostedFileBase _profilepic = Request.Files["employeephotoimge"]; string folderpath = Constants.USERPICK; BALCommon CSvc = new BALCommon(ConStr); UserMasters _um = CSvc.GetByUserId(WebSecurity.CurrentUserId); if (_profilepic.ContentLength > 0) { string guidstring = Guid.NewGuid().ToString(); string _FileName = Path.GetFileName(_profilepic.FileName); string filepath = Path.Combine(Server.MapPath(folderpath) + guidstring + "_" + _FileName); string dbpath = Path.Combine(folderpath + guidstring + "_" + _FileName); _profilepic.SaveAs(filepath); model.IMAGE = dbpath; } _um.UserId = model.UserId; _um.USERNAME = model.UserName; _um.FISRTNAME = model.Name; _um.LASTNAME = model.Lastname; _um.Mobile = model.Mobile; _um.EMAILID = model.EmailId; _um.MODIFIEDBY = model.UserName; _um.MODIFIEDDATE = DateTime.Now; if (model.UserId == WebSecurity.CurrentUserId && WebSecurity.ResetPassword(sResetToken, model.NewPassword)) { CSvc.AddUserprofile(_um, "UPD"); TempData[Constants.MessageInfo.SUCCESS] = "Password reset successfully."; } else { TempData[Constants.MessageInfo.ERROR] = "Password could not reset."; } return(RedirectToAction("Index", "Home")); }
/// <summary> /// Protected overriden method for authorizing user /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <param name="actionContext"></param> /// <returns></returns> /// protected override bool OnAuthorizeUser(string username, string password, HttpActionContext actionContext) { //var provider = actionContext.ControllerContext.Configuration // .DependencyResolver.GetService(typeof(IUserServices)) as IUserServices; string ConStr = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; BALCommon CSvc = new BALCommon(ConStr); var userid = CSvc.UserAvailablity(username, password); if (userid > 0) { var basicAuthenticationIdentity = Thread.CurrentPrincipal.Identity as BasicAuthenticationIdentity; if (basicAuthenticationIdentity != null) { basicAuthenticationIdentity.UserId = userid; } return(true); } return(false); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { BALCommon CSvc = new BALCommon(ConStr); // HttpSessionStateBase session = filterContext.HttpContext.Session; UserMasters user = CSvc.GetByUserId(WebSecurity.CurrentUserId); // _userRepository.GetByUserId(user.USER_ID); // UserMasters user = (UserMasters)session[Constants.Session.USER]; string text = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower(); string viewname = filterContext.ActionDescriptor.ActionName; string absolutePath = HttpContext.Current.Request.Url.AbsolutePath; string mailurl = HttpContext.Current.Request.Url.ToString(); bool urlreffrer = HttpContext.Current.Request.Url.IsAbsoluteUri; Uri urlreffref = HttpContext.Current.Request.UrlReferrer; UrlHelper urlHelper = new UrlHelper(filterContext.RequestContext); string url = string.Empty; url = urlHelper.Content(mailurl); HttpBrowserCapabilities httpBrowser = HttpContext.Current.Request.Browser; // if (!text.Contains("Account") && ((user == null && !session.IsNewSession) || session.IsNewSession)) if (!text.Contains("Account") && user == null) { if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { filterContext.HttpContext.Response.Redirect("~/Account/SessionLogin", true); } else { filterContext.HttpContext.Response.Redirect(url, true); } } Uri urlref = HttpContext.Current.Request.UrlReferrer; if (urlref == null) { filterContext.HttpContext.Response.Redirect("~/Account/Login"); } }
public UserMasters ValidateUser(string UserName, string Password) { BALCommon bal = new BALCommon(ConStr); return(bal.ValidateUser(UserName, Password)); }
public UserMasters GetByUserId(int userId) { BALCommon bal = new BALCommon(ConStr); return(bal.GetByUserId(userId)); }
public void Insert(UserMasters usermaster) { BALCommon bal = new BALCommon(ConStr); bal.Insert(usermaster); }