//public PartialViewResult ListMyRequestsNew(string id) //Commented by basheer on 04-0 //{ // WaitingRequestingList model = new WaitingRequestingList(); // model.list = new List<WaitingRequests>(); // string[] splitData = id.Split('~'); // model.myId = splitData[1]; // model.typeid = splitData[0]; // var applicationCode = splitData[2]; // int count = 0; // var myName = _entity.tb_WF_Employee.Where(x => x.LocalEmplyee_ID == model.myId && x.IsActive == true).FirstOrDefault(); // var me = _entity.tb_Role.Where(x => x.Assigned_ID == model.myId).FirstOrDefault(); // //var data = _entity.tb_Request_Hdr.Where(x => x.Approver_ID == model.myId && x.IsActive == true && (x.Status_ID != "CLS" || x.Status_ID != "PYD" || x.Status_ID != "REJ" || x.Status_ID!="NEW")).ToList(); // var data = _entity.tb_Request_Hdr.Where(x => x.Employee_ID == model.myId && x.IsActive == true && x.tb_Application.Application_Code.ToUpper() == applicationCode.ToUpper()).ToList(); // foreach (var item in data) // { // #region // var emp = _entity.tb_WF_Employee.Where(x => x.LocalEmplyee_ID == item.Employee_ID).FirstOrDefault(); // var company = _entity.tb_Company.Where(x => x.Company_Id == emp.Company_Id && x.IsActive == true).FirstOrDefault(); // //var business = _entity.tb_Business.Where(x => x.Bus_Id == emp.Business_Id && x.IsActive == true).FirstOrDefault(); // //var bussiness_line = _entity.tb_BusinessLine.Where(x => x.BL_Id == emp.BusinessLine_Id && x.IsActive == true).FirstOrDefault(); // //var pro_group = _entity.tb_ProductGroup.Where(x => x.PG_Id == emp.PG_Id && x.IsActive == true).FirstOrDefault(); // //var application = _entity.tb_Application.Where(x => x.Application_Code == item.Application_ID && x.IsActive == true).FirstOrDefault(); // //var domain = _entity.tb_Domain.Where(x => x.Domain_ID == application.DomainId && x.IsActive == true).FirstOrDefault(); // WaitingRequests one = new WaitingRequests(); // one.req_id = item.Id; // one.request_id = item.Request_ID; // one.application_id = item.Application_ID ?? 0; // one.application = item.tb_Application.Application_Code; // one.employee_local_id = item.Employee_ID; // one.wf_type_id = item.tb_WFType.WF_ID; // one.count = count + 1; // one.employee_name = emp.Emp_Name; // //one.company = company == null ? "" : company.Company_Name; // //one.business = emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business.Business_Name; // //one.business_line = emp.tb_Department.tb_ProductGroup.tb_BusinessLine == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.Business_Line_Name; // one.pro_group = emp.tb_Department.tb_ProductGroup == null ? "" : emp.tb_Department.tb_ProductGroup.PG_Name; // one.date = Convert.ToDateTime(item.TimeStamp).ToShortDateString(); // one.process_table_id = 0; // //one.wf_domain = domain.Domain_Name; // //one.wf_domain = item.tb_Application.tb_Domain.Domain_Name; // if (item.Status_ID == "INT" || item.Status_ID == "HLD" || item.Status_ID == "BKI" || item.Status_ID == "QIM" || item.Status_ID == "PIM") // { // one.button_type = "Approve"; // } // else if (item.Status_ID == "APP") // { // if (item.tb_WFType.IsPaid_Request == true) // { // one.button_type = "Paid"; // } // else // { // one.button_type = "Close"; // } // } // else if (item.Status_ID == "CLR" || item.Status_ID == "PYD" && item.Process_Complete == 0) // { // //var checkPaid = _entity.tb_WFType.Where(x => x.WF_ID == item.WF_ID && x.IsActive == true).FirstOrDefault(); // one.button_type = item.tb_WFType.IsPaid_Request == true ? "Paid" : "Close"; // } // var current = _ApprovalLogRepository.Check_Request_Last_Stage_For_MyRequest(item.Request_ID); // one.final_status = current.Item1; // one.current_actor = current.Item2; // model.list.Add(one); // count = count + 1; // #endregion // } // return PartialView("~/Views/Employee/_pv_my_request.cshtml", model); //} // LISTING OF EMPLOYEE REQUEST public PartialViewResult ListMyRequestsNew(string id) { WaitingRequestingList model = new WaitingRequestingList(); model.list = new List <WaitingRequests>(); string[] splitData = id.Split('~'); model.myId = splitData[1]; model.typeid = splitData[0]; model.fromdate = Convert.ToDateTime(splitData[3]); model.todate = Convert.ToDateTime(splitData[4]); var status = string.Empty; var wftype = string.Empty; //Basheer on 13-02-2020 for WFtype in filter var applicationCode = splitData[2]; int count = 0; var myName = _entity.tb_WF_Employee.Where(x => x.LocalEmplyee_ID == model.myId && x.IsActive == true).FirstOrDefault(); var me = _entity.tb_Role.Where(x => x.Assigned_ID == model.myId).FirstOrDefault(); #region old code without SP //if (splitData[5] == "") //{ // var data = _entity.tb_Request_Hdr.Where(x => x.Employee_ID == model.myId && x.IsActive == true && x.tb_Application.Application_Code.ToUpper() == applicationCode.ToUpper() && EntityFunctions.TruncateTime(x.TimeStamp) >= model.fromdate.Date && EntityFunctions.TruncateTime(x.TimeStamp) <= model.todate.Date).ToList(); // //var data = _entity.tb_Request_Hdr.Where(x => x.Employee_ID == model.myId && x.IsActive == true && x.tb_Application.Application_Code.ToUpper() == applicationCode.ToUpper()).ToList(); // foreach (var item in data) // { // #region // var emp = _entity.tb_WF_Employee.Where(x => x.LocalEmplyee_ID == item.Employee_ID).FirstOrDefault(); // var company = _entity.tb_Company.Where(x => x.Company_Id == emp.Company_Id && x.IsActive == true).FirstOrDefault(); // //var business = _entity.tb_Business.Where(x => x.Bus_Id == emp.Business_Id && x.IsActive == true).FirstOrDefault(); // //var bussiness_line = _entity.tb_BusinessLine.Where(x => x.BL_Id == emp.BusinessLine_Id && x.IsActive == true).FirstOrDefault(); // //var pro_group = _entity.tb_ProductGroup.Where(x => x.PG_Id == emp.PG_Id && x.IsActive == true).FirstOrDefault(); // //var application = _entity.tb_Application.Where(x => x.Application_Code == item.Application_ID && x.IsActive == true).FirstOrDefault(); // //var domain = _entity.tb_Domain.Where(x => x.Domain_ID == application.DomainId && x.IsActive == true).FirstOrDefault(); // WaitingRequests one = new WaitingRequests(); // one.req_id = item.Id; // one.request_id = item.Request_ID; // one.application_id = item.Application_ID ?? 0; // one.application = item.tb_Application.Application_Code; // one.employee_local_id = item.Employee_ID; // one.wf_type_id = item.tb_WFType.WF_ID; // one.count = count + 1; // one.employee_name = emp.Emp_Name; // //one.company = company == null ? "" : company.Company_Name; // //one.business = emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business.Business_Name; // //one.business_line = emp.tb_Department.tb_ProductGroup.tb_BusinessLine == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.Business_Line_Name; // one.pro_group = emp.tb_Department.tb_ProductGroup == null ? "" : emp.tb_Department.tb_ProductGroup.PG_Name; // one.date = Convert.ToDateTime(item.TimeStamp).ToShortDateString(); // one.process_table_id = 0; // //one.wf_domain = domain.Domain_Name; // //one.wf_domain = item.tb_Application.tb_Domain.Domain_Name; // if (item.Status_ID == "INT" || item.Status_ID == "HLD" || item.Status_ID == "BK1" || item.Status_ID == "QIM" || item.Status_ID == "PIM") // { // one.button_type = "Approve"; // } // else if (item.Status_ID == "APP") // { // if (item.tb_WFType.IsPaid_Request == true) // { // one.button_type = "Paid"; // } // else // { // one.button_type = "Close"; // } // } // else if (item.Status_ID == "CLR" || item.Status_ID == "PYD" && item.Process_Complete == 0) // { // //var checkPaid = _entity.tb_WFType.Where(x => x.WF_ID == item.WF_ID && x.IsActive == true).FirstOrDefault(); // one.button_type = item.tb_WFType.IsPaid_Request == true ? "Paid" : "Close"; // } // var current = _ApprovalLogRepository.Check_Request_Last_Stage_For_MyRequest(item.Request_ID); // one.final_status = current.Item1; // one.current_actor = current.Item2; // model.list.Add(one); // count = count + 1; // #endregion // } //} //else //{ // var data = _entity.tb_Request_Hdr.Where(x => x.Employee_ID == model.myId && x.IsActive == true && x.tb_Application.Application_Code.ToUpper() == applicationCode.ToUpper() && EntityFunctions.TruncateTime(x.TimeStamp) >= model.fromdate.Date && EntityFunctions.TruncateTime(x.TimeStamp) <= model.todate.Date && x.Status_ID == model.status).ToList(); // foreach (var item in data) // { // #region // var emp = _entity.tb_WF_Employee.Where(x => x.LocalEmplyee_ID == item.Employee_ID).FirstOrDefault(); // var company = _entity.tb_Company.Where(x => x.Company_Id == emp.Company_Id && x.IsActive == true).FirstOrDefault(); // //var business = _entity.tb_Business.Where(x => x.Bus_Id == emp.Business_Id && x.IsActive == true).FirstOrDefault(); // //var bussiness_line = _entity.tb_BusinessLine.Where(x => x.BL_Id == emp.BusinessLine_Id && x.IsActive == true).FirstOrDefault(); // //var pro_group = _entity.tb_ProductGroup.Where(x => x.PG_Id == emp.PG_Id && x.IsActive == true).FirstOrDefault(); // //var application = _entity.tb_Application.Where(x => x.Application_Code == item.Application_ID && x.IsActive == true).FirstOrDefault(); // //var domain = _entity.tb_Domain.Where(x => x.Domain_ID == application.DomainId && x.IsActive == true).FirstOrDefault(); // WaitingRequests one = new WaitingRequests(); // one.req_id = item.Id; // one.request_id = item.Request_ID; // one.application_id = item.Application_ID ?? 0; // one.application = item.tb_Application.Application_Code; // one.employee_local_id = item.Employee_ID; // one.wf_type_id = item.tb_WFType.WF_ID; // one.count = count + 1; // one.employee_name = emp.Emp_Name; // //one.company = company == null ? "" : company.Company_Name; // //one.business = emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.tb_Business.Business_Name; // //one.business_line = emp.tb_Department.tb_ProductGroup.tb_BusinessLine == null ? "" : emp.tb_Department.tb_ProductGroup.tb_BusinessLine.Business_Line_Name; // one.pro_group = emp.tb_Department.tb_ProductGroup == null ? "" : emp.tb_Department.tb_ProductGroup.PG_Name; // one.date = Convert.ToDateTime(item.TimeStamp).ToShortDateString(); // one.process_table_id = 0; // //one.wf_domain = domain.Domain_Name; // //one.wf_domain = item.tb_Application.tb_Domain.Domain_Name; // if (item.Status_ID == "INT" || item.Status_ID == "HLD" || item.Status_ID == "BK1" || item.Status_ID == "QIM" || item.Status_ID == "PIM") // { // one.button_type = "Approve"; // } // else if (item.Status_ID == "APP") // { // if (item.tb_WFType.IsPaid_Request == true) // { // one.button_type = "Paid"; // } // else // { // one.button_type = "Close"; // } // } // else if (item.Status_ID == "CLR" || item.Status_ID == "PYD" && item.Process_Complete == 0) // { // //var checkPaid = _entity.tb_WFType.Where(x => x.WF_ID == item.WF_ID && x.IsActive == true).FirstOrDefault(); // one.button_type = item.tb_WFType.IsPaid_Request == true ? "Paid" : "Close"; // } // var current = _ApprovalLogRepository.Check_Request_Last_Stage_For_MyRequest(item.Request_ID); // one.final_status = current.Item1; // one.current_actor = current.Item2; // model.list.Add(one); // count = count + 1; // #endregion // } //} #endregion . try { status = splitData[5]; } catch { } //Basheer on 13-02-2020 for WFtype in filter try { wftype = splitData[6]; } catch { } //var maindata = _entity.sp_ListMyRequests(applicationCode, model.myId, model.fromdate, model.todate, status, wftype); //Basheer on 24-03-2020 to add creator in my request list var maindata = _entity.sp_ListMyRequests(applicationCode, model.myId, model.fromdate, model.todate, status, wftype); foreach (var item in maindata) { WaitingRequests one = new WaitingRequests(); one.req_id = item.Id; one.request_id = item.Request_ID; one.application_id = item.Application_ID ?? 0; one.application = item.Application_Code; one.employee_local_id = item.Employee_ID; one.wf_type_id = item.WF_ID; one.count = count + 1; one.employee_name = item.Emp_Name; one.date = Convert.ToDateTime(item.TimeStamp).ToShortDateString(); one.button_type = ""; one.process_table_id = item.Id; one.final_status = item.Status_Desc; one.current_actor = item.Role_Desc + " " + item.Approver ?? null; one.wf_type_name = item.WF_App_Name; //basheer on 08-05-2020 model.list.Add(one); count = count + 1; } return(PartialView("~/Views/Employee/_pv_my_request.cshtml", model)); } // LISTING OF EMPLOYEE REQUEST