public ActionResult TimeLogEvt(int[] TimeLogId, string Action) { // You have your books IDs on the deleteInputs array switch (Action.ToLower()) { case "delete": if (TimeLogId != null && TimeLogId.Length > 0) { int length = TimeLogId.Length; TimeLog objItem; for (int i = 0; i <= length - 1; i++) { objItem = TimeLogManager.GetById(TimeLogId[i]); if (objItem != null) { TimeLogManager.Delete(objItem); } } return(View(ViewFolder + "list.cshtml", TimeLogManager.GetAll())); } break; } return(View("PostFrm")); }
/// <summary> /// use for setting up default value /// </summary> /// <returns></returns> public ActionResult Update(int TimeLogId, string TargetID = "TimeLoglist") { TimeLog objItem = TimeLogManager.GetById(TimeLogId); objItem.TargetDisplayID = TargetID; return(View(ViewFolder + "Create.cshtml", objItem)); }
public ActionResult Create(TimeLog model) { try { if (ModelState.IsValid) { //model.CreatedUser = CurrentUser.UserName; if (model.TimeLogId != 0) { //get default value // TimeLog b = TimeLogManager.GetById(model.TimeLogId); TimeLogManager.Update(model); } else { // TODO: Add insert logic here // model.CreatedDate = SystemConfig.CurrentDate; TimeLogManager.Add(model); } return(View(ViewFolder + "list.cshtml", TimeLogManager.GetAll())); } } catch { return(View(model)); } return(View(model)); }
public ContentResult Save(string objdata, string value) { JsonObject js = new JsonObject(); js.StatusCode = 200; js.Message = "Upload Success"; try { TimeLog obj = JsonConvert.DeserializeObject <TimeLog>(objdata); obj = TimeLogManager.Update(obj); if (obj.TimeLogId == 0) { js.StatusCode = 400; js.Message = "Has Errors. Please contact Admin for more information"; } else { js.Data = obj; } } catch (Exception objEx) { js.StatusCode = 400; js.Message = objEx.Message; } return(Content(JsonConvert.SerializeObject(js), "application/json")); }
public ContentResult Search(SearchFilter SearchKey) { SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "TimeLogId" : SearchKey.OrderBy; TimeLogCollection collection = TimeLogManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(collection), "application/json")); }
/// <summary> /// use for scrolling page /// </summary> /// <returns></returns> public ContentResult GetPg(int page, int pagesize) { string condition = ""; SearchFilter SearchKey = SearchFilter.SearchPG(1, page, pagesize, "TimeLogId", "TimeLogId", "Desc", condition); TimeLogCollection objItem = TimeLogManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
internal void RefreshDuration() { TodayDuration = _clock.GetDuration(DurationModes.Today); TotalDuration = _clock.GetDuration(DurationModes.All); clockLBL.Text = TimeLogManager.formatDuration(TodayDuration); totalLBL.Text = string.Format("Total {0}", TimeLogManager.formatDuration(TotalDuration)); }
public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "TimeLogId", "TimeLogId"); TimeLogCollection collection = TimeLogManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
private void timer1_Tick(object sender, EventArgs e) { TotalDuration = new TimeSpan(0); TodayDuration = new TimeSpan(0); foreach (ClockUCtrl clock in _clocks.Values) { clock.RefreshDuration(); TotalDuration += clock.TotalDuration; TodayDuration += clock.TodayDuration; totalLBL.Text = string.Format("Total {0} | Today {1}", TimeLogManager.formatDuration(TotalDuration), TimeLogManager.formatDuration(TodayDuration)); } }
public ActionResult Update(TimeLog model) { try { if (ModelState.IsValid) { // TODO: Add insert logic here TimeLogManager.Update(model); //return RedirectToAction("Index"); } return(View(model)); } catch { return(View(model)); } }
/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> public string ExportExcel() { TimeLogCollection collection = TimeLogManager.GetAll(); DataTable dt = collection.ToDataTable <TimeLog>(); string fileName = "TimeLog_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy"); string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" }; for (int i = 0; i < RemoveColumn.Length; i++) { if (dt.Columns.Contains(RemoveColumn[i])) { dt.Columns.Remove(RemoveColumn[i]); } } FileInputHelper.ExportExcel(dt, fileName, "TimeLog List", false); return(fileName); }
public ContentResult SaveExcel(string item) { //string b = Request["item"]; IEnumerable <TimeLog> objItemList = JsonConvert.DeserializeObject <IEnumerable <TimeLog> >(item); JsonObject obj = new JsonObject(); obj.StatusCode = 200; obj.Message = "The process is sucessed"; foreach (TimeLog objitem in objItemList) { //default value //objitem.CreatedUser = CurrentUser.UserName; // objitem.CreatedDate = SystemConfig.CurrentDate; TimeLogManager.Add(objitem); } return(Content(JsonConvert.SerializeObject(obj), "application/json")); }
// DELETE api/<controller>/5 /// <summary> /// Deletes the specified identifier. /// </summary> /// <param name="id">The identifier.</param> public void Delete(int id) { TimeLogManager.DeleteItem(id); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public TimeLogCollection Post(string method, [FromBody] SearchFilter value) { return(TimeLogManager.Search(value)); }
// PUT api/<controller>/5 /// <summary> /// Puts the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="value">The value.</param> /// <returns></returns> /// <exception cref="HttpResponseException"></exception> public TimeLog Put(string id, [FromBody] TimeLog value) { return(TimeLogManager.UpdateItem(value)); }
// POST api/<controller> /// <summary> /// Posts the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public TimeLog Post([FromBody] TimeLog value) { return(TimeLogManager.AddItem(value)); }
// GET api/<controller>/5 /// <summary> /// Gets the specified COM group identifier. /// </summary> /// <param name="TimeLogId">The COM group identifier.</param> /// <returns></returns> public TimeLog Get(int TimeLogId) { return(TimeLogManager.GetItemByID(TimeLogId)); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> //public TimeLogCollection Get() //{ // return TimeLogManager.GetAllItem(); //} public TimeLogCollection GetbyUser(string usr) { return(TimeLogManager.GetbyUser(usr)); }
public ActionResult Get(int TimeLogId, string action) { TimeLog objItem = TimeLogManager.GetById(TimeLogId); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
public ActionResult Get(int TimeLogId) { TimeLog objItem = TimeLogManager.GetById(TimeLogId); return(View(objItem)); }
public ActionResult list() { TimeLogCollection collection = TimeLogManager.GetAll(); return(View(ViewFolder + "list.cshtml", collection)); }