public static System.Data.DataTable EmployeeTMSWeeeklyFilter(EMPWeelFilter WebPara) { System.Data.DataTable items = new System.Data.DataTable(); using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.PostAsJsonAsync(string.Format(Resource + "?method=search&action=weekly"), WebPara).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <System.Data.DataTable>().GetAwaiter().GetResult(); } } return(items); }
public ActionResult Info(string searchprm) { EmpFilter ObjPara = new EmpFilter(); EMPWeelFilter filEmp = new EMPWeelFilter(); if (!string.IsNullOrEmpty(searchprm)) { ObjPara = JsonConvert.DeserializeObject <EmpFilter>(searchprm, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DateFormatString = "dd/MM/yyyy" }); } if (ObjPara != null) { ls_PayrollDOWS_RBVH objDown = ls_PayrollDOWS_RBVHManager.GetById(ObjPara.Dow_ID); if (objDown != null) { //if() if (filEmp.Number == 0) { filEmp.Number = filEmp.Number + 1; } int dow = (int)objDown.Beg_Day.DayOfWeek; filEmp.StartWeek = objDown.Beg_Day; filEmp.EndDateWeek = objDown.End_Day; if (dow != 0) { filEmp.StartWeek = objDown.Beg_Day.AddDays(-dow + 1); } dow = (int)objDown.End_Day.DayOfWeek; if (objDown.End_Day.DayOfWeek != DayOfWeek.Sunday) { filEmp.EndDateWeek = objDown.End_Day.AddDays(7 - dow - 1); } filEmp.EndWeek = filEmp.StartWeek.AddDays(6); filEmp.FromDate = objDown.Beg_Day; filEmp.ToDate = objDown.End_Day; filEmp.EmployeeCode = ObjPara.EmployeeCode; } } return(View(ViewFolder + "Info.cshtml", filEmp)); }
public ActionResult NextWeek(string searchprm) { EMPWeelFilter filEmp = new EMPWeelFilter(); if (!string.IsNullOrEmpty(searchprm)) { filEmp = JsonConvert.DeserializeObject <EMPWeelFilter>(searchprm, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DateFormatString = "dd/MM/yyyy" }); if (filEmp != null) { filEmp.StartWeek = filEmp.EndWeek.AddDays(1); filEmp.EndWeek = filEmp.StartWeek.AddDays(6); filEmp.Number = filEmp.Number + 1; } } return(View(ViewFolder + "Info.cshtml", filEmp)); }
public ContentResult GetEmpWeeklyData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)//, int EntityID = 10002, DateTime? fromdate = null, DateTime? todate = null) { EMPWeelFilter ObjPara = new EMPWeelFilter() { EmployeeCode = CurrentUser.EmployeeCode, FromDate = new DateTime(2017, 08, 15), ToDate = new DateTime(2017, 09, 15) }; if (!string.IsNullOrEmpty(searchprm)) { ObjPara = JsonConvert.DeserializeObject <EMPWeelFilter>(searchprm, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DateFormatString = "dd/MM/yyyy" }); } // ObjPara.EmployeeCode = 1863; //EMPTMSPara SearchKey = new EMPTMSPara() //{ // EntityID = 10002, // DeptID = 0, // @FromDate = fromdate , // @ToDate = todate, // OrderBy = "EmployeeNo", // OrderDirection = "DESC", // Page = (requestModel.Start / requestModel.Length) + 1, // PageSize = requestModel.Length, //}; //fromdate = fromdate == null ? SystemConfig.CurrentDate : fromdate; //todate = todate == null ? SystemConfig.CurrentDate : todate; //ObjPara.OrderBy = "DeptName"; //ObjPara.OrderDirection = "ASC"; //ObjPara.Page = (requestModel.Start / requestModel.Length) + 1; //ObjPara.PageSize = requestModel.Length; DataTable collection = new DataTable(); collection = T_TMS_EmployeeTimesheetWeeklyDetailsManager.EmployeeTMSWeeeklyFilter(ObjPara); System.Data.DataColumn newColumn = new System.Data.DataColumn("Accumulate", typeof(System.String)); //newColumn.DefaultValue = "Summary"; collection.Columns.Add(newColumn); int TotalRecord = 0; EmpWeekSummary myWeek = new EmpWeekSummary(); if (collection.Rows.Count > 0) { for (int i = 0; i < collection.Rows.Count; i++) { //collection.Rows[i]["Accumulate"] = data(collection.Rows[i],i,out myWeek); data(collection.Rows[i], i, ref myWeek); } myWeek.TotalWorkHour = 42; collection.Rows[1]["Accumulate"] = myWeek.IntoWeek; collection.Rows[2]["Accumulate"] = myWeek.WorkHourString; collection.Rows[3]["Accumulate"] = myWeek.OTSummary == 0? "":myWeek.OTString.ToString(); collection.Rows[4]["Accumulate"] = myWeek.LeaveSummary == 0 ? "" : myWeek.LeaveString.ToString(); collection.Rows[5]["Accumulate"] = myWeek.UnNoregSummary == 0 ? "" : myWeek.UnoRegString.ToString(); collection.Rows[6]["Accumulate"] = myWeek.LackingHour == 0 ? "" : myWeek.LackingHourString; TotalRecord = Convert.ToInt32(collection.Rows.Count); } IEnumerable <DataRow> rows = collection.AsEnumerable().ToList(); object temp = new object(); foreach (var item in rows) { temp = item.Table; } //DataTablesResponseExtend results = new DataTablesResponseExtend(requestModel.Draw, temp, TotalRecord, TotalRecord); return(Content(JsonConvert.SerializeObject(new DataTablesResponseExtend(requestModel.Draw, temp, TotalRecord, TotalRecord)), "application/json")); }
//public IEnumerable<T_TMS_EmployeeTimesheetWeeklyDetails> Post(string method, [FromBody] EMPWeelFilter value) //{ // return T_TMS_EmployeeTimesheetWeeklyDetailsManager.Search(value); //} public System.Data.DataTable Post(string method, [FromBody] EMPWeelFilter value, string action) { return(T_TMS_EmployeeTimesheetWeeklyDetailsManager.EmployeeWeeklyReport(value)); }