public string DeleteLeaveType(int LeaveTypeID) { string strResponse = string.Empty; try { if (ModelState.IsValid) { var Org = new LeaveTypeComponent(); int r = Org.DeleteLeaveTypeDetail(LeaveTypeID); if (r > 0) { strResponse = "Leavetype deleted successfully"; } else if (r == 0) { strResponse = "Leavetype does not exists"; } else if (r < 0) { strResponse = "Error occured in DeleteLeaveType"; } } } catch (Exception ex) { return(strResponse); } return(strResponse); }
public string CreateLeaveType(LeaveTypeEntity LeaveTypeDtl) { string strResponse = string.Empty; try { var LeaveTypeComponent = new LeaveTypeComponent(); UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo; int _userID = _objSessioninfo.UserId; LeaveTypeDtl.LTyp_CreatedBy = _userID; var Org = new LeaveTypeComponent(); int r = Org.AddLeaveType(LeaveTypeDtl); if (r > 0) { strResponse = "Leave created successfully"; } else if (r == 0) { strResponse = "Leave already exists"; } else if (r < 0) { strResponse = "Error occured in CreateLeaveType"; } } catch (Exception ex) { return(strResponse); } return(strResponse); }
public string ChangeStatus(string id, string status) { string strResponse = string.Empty; var objDtl = new LeaveTypeComponent(); strResponse = objDtl.ChangeStatus(id, status); return(strResponse); }
public string UpdateLeaveType(LeaveTypeEntity LeaveTypeDtl) { string strResponse = string.Empty; short UsTCurrentVersion = 0; try { var LeaveTypeComponent = new LeaveTypeComponent(); var currentLeaveTypeDetails = LeaveTypeComponent.GetLeaveTypeDetailByID(LeaveTypeDtl.LTyp_LeaveTypeID); int LeaveTypeID = currentLeaveTypeDetails.LTyp_LeaveTypeID; UsTCurrentVersion = Convert.ToInt16(currentLeaveTypeDetails.LTyp_Version); bool _currentStatus = false; //check for version and active status if (ModelState["LTyp_ActiveStatus"].Value != null) { _currentStatus = LeaveTypeDtl.LTyp_ActiveStatus == true; } if (ModelState.IsValid) { UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo; int _userID = _objSessioninfo.UserId; LeaveTypeDtl.LTyp_ModifiedBy = _userID; //while udating increment version by1 LeaveTypeDtl.LTyp_Version = ++UsTCurrentVersion; LeaveTypeDtl.LTyp_ActiveStatus = _currentStatus; var Org = new LeaveTypeComponent(); int r = Org.UpdateLeaveTypeDetail(LeaveTypeDtl); if (r > 0) { strResponse = "Leave updated successfully"; } else if (r == 0) { strResponse = "Leave does not exists"; } else if (r < 0) { strResponse = "Error occured in UpdateLeaveType"; } } } catch (Exception ex) { return(strResponse); } return(strResponse); }
public JsonResult GetLeaveTypeByID(int catID) { LeaveTypeEntity LeaveTypeDetails = null; try { var objDtl = new LeaveTypeComponent(); LeaveTypeDetails = objDtl.GetLeaveTypeDetailByID(catID); } catch (Exception ex) { return(null); } return(Json(LeaveTypeDetails, JsonRequestBehavior.AllowGet)); }
public JsonResult GetLeaveTypeHistoryByID(int ID) { List <History_LeaveTypeEntity> HisLeaveTypeDetails = null; try { var objDtl = new LeaveTypeComponent(); HisLeaveTypeDetails = objDtl.GetHistoryLeaveTypeDetailsByID(ID); ViewBag.LeaveTypeDetails = HisLeaveTypeDetails; } catch (Exception ex) { return(null); } return(Json(HisLeaveTypeDetails, JsonRequestBehavior.AllowGet)); }
public JsonResult GetLeaveTypeCollection() { List <LeaveTypeEntity> LeaveTypeDetails = null; try { var objDtl = new LeaveTypeComponent(); LeaveTypeDetails = objDtl.GetLeaveTypeDetail(); ViewBag.LeaveTypeDetails = LeaveTypeDetails[0].LTyp_Version; } catch (Exception ex) { return(null); } return(Json(LeaveTypeDetails, JsonRequestBehavior.AllowGet)); }
//UserSessionInfo objSessioninfo = new UserSessionInfo(); public ActionResult Index(bool?pdf) { if (!pdf.HasValue) { #region to return LeaveTypeList //objSessioninfo.UserId = 501; //Session["UserSessionInfo"] = objSessioninfo; UserSessionInfo info = new UserSessionInfo(); int accountid = info.AccountId; List <LookupStatusDetail> objStatusList = new List <LookupStatusDetail>(); objStatusList.Add(new LookupStatusDetail { StatusID = 1, Status = "Active" }); objStatusList.Add(new LookupStatusDetail { StatusID = 0, Status = "InActive" }); var objStList = from cl in objStatusList orderby cl.StatusID select new { value = cl.StatusID, text = cl.Status }; ViewBag.Status = objStList; LeaveSchemeComponent compobj = new LeaveSchemeComponent(); var Accountname = compobj.GetallAccountnames(accountid).Select(a => new SelectListItem() { Value = a.Acc_AccountID.ToString(), Text = a.Acc_AccountName, }); ViewBag.Accountname = Accountname; HomeController hm = new HomeController(); var obj = hm.GetAdminMenu(); foreach (var item in obj) { //if (item.ModuleAccessType.ToLower() == "read/write") //{ // var mk = item.ModuleAccessType; // ViewBag.a = mk; //} //else //{ // var mk = item.ModuleAccessType; // ViewBag.a = mk; //} if (item.ModuleName == "Add Leave Type") { var mk = item.ModuleAccessType; ViewBag.a = mk; } } return(View()); #endregion } else { string filename = "LeaveType.pdf"; string filePath = Server.MapPath("~/Content/PDFs/" + filename); var objDtl = new LeaveTypeComponent(); IList <LeaveTypeEntity> LeaveTypeList = objDtl.GetLeaveTypeDetail(); ExportPDF(LeaveTypeList, new string[] { "LTyp_LeaveTypeID", "AccountName", "LTyp_LeaveType", "LTyp_LeaveTypeDescription" }, filePath); return(File(filePath, "application/pdf")); } }
public ActionResult DashBoard1() { UserSessionInfo info = new UserSessionInfo(); string rolename = info.RoleName; int accid = info.AccountId; int Mid = info.UserId; ViewBag.userid = Convert.ToInt32(Session["UserId"]); LeaveTypeComponent LeaveTypeComponent = new LeaveTypeComponent(); var projectslist = LeaveTypeComponent.GetAllProjects().Select(a => new SelectListItem() { Value = a.Proj_ProjectID.ToString(), Text = a.Proj_ProjectName, }); var newsboardcomp = new NewBoardComponent(); var news = newsboardcomp.GetNewsCollection(); ViewBag.news = news; ViewBag.projectslist = projectslist; EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities(); int accountcount = (from a in db.Accounts where a.Acc_AccountID != 502 && a.Acc_isDeleted == false select new DashboardMails { accountid = a.Acc_AccountID }).Count(); int userscount = (from a in db.Users where a.Usr_UserID != 501 && a.Usr_isDeleted == false && a.Usr_AccountID == accid select new DashboardMails { users = a.Usr_UserID }).Count(); int allusers = (from a in db.Users where a.Usr_UserID != 501 && a.Usr_isDeleted == false select new DashboardMails { users = a.Usr_UserID }).Count(); int projects = (from a in db.Projects where a.Proj_isDeleted == false && a.Proj_AccountID == accid select new DashboardMails { Proj_ProjectID = a.Proj_ProjectID }).Count(); int skillslist = (from a in db.Skills where a.Acc_AccountID == accid && a.Sk_isDeleted == false select new DashboardMails { SkillId = a.SkillId }).Count(); int timesheetscnt = (from t in db.TIMESHEETs join u in db.Users on t.UserID equals u.Usr_UserID join a in db.Accounts on u.Usr_AccountID equals a.Acc_AccountID where a.Acc_AccountID == accid select new DashboardMails { TimesheetID = t.TimesheetID }).Count(); //var getempsformangrs = (from up in db.UserProjects // where up.UProj_L1_ManagerId == Mid || up.UProj_L2_ManagerId == Mid // select new DashboardMails // { // UProj_UserID = up.UProj_UserID // }).ToList(); //var getempsformangrs = () var gettimesheetid = db.UserProjects.Where(a => a.UProj_UserID == info.UserId).Select(a => a.TimesheetMode).FirstOrDefault(); //foreach(var item in gettimesheetid) //{ //} TempData["gettimesheetid"] = gettimesheetid; ViewBag.timesheetscnt = timesheetscnt; ViewBag.skillslist = skillslist; ViewBag.projects = projects; ViewBag.users = userscount; ViewBag.allusers = allusers; ViewBag.acountcount = accountcount; ViewBag.username = rolename; int?userid = info.UserId; var userstatus = (from u in db.Users where u.Usr_UserID == userid select new UserEntity { Usr_ActiveStatus = u.Usr_ActiveStatus }).ToList(); bool?status = userstatus[0].Usr_ActiveStatus; if (status == false) { return(RedirectToAction("ChangePassword")); } else { return(View()); } }