public JsonResult delete() { try { //jQuery DataTables Param string id = (Request.Form.GetValues("id").FirstOrDefault() == null ? "" : Request.Form.GetValues("id").FirstOrDefault().ToString()); if (id.All(Char.IsDigit)) { TBL_PRICE_PAYROLL pricePayroll = DA_PricePayroll.Instance.GetById(Convert.ToInt32(id)); return(Json(pricePayroll == null ? 0 : DA_PricePayroll.Instance.Delete(pricePayroll))); } return(Json(0)); } catch (Exception ex) { return(Json(0)); } }
public JsonResult AddOrUpdateEntity(TBL_PRICE_PAYROLL item, bool isEdit, string TimeFrom, string TimeTo) { DateTime timeFrom = new DateTime(2000, 1, 1, Convert.ToInt32(TimeFrom.Split('/')[0]), Convert.ToInt32(TimeFrom.Split('/')[1]), 0); DateTime timeTo = new DateTime(2000, 1, 1, Convert.ToInt32(TimeTo.Split('/')[0]), Convert.ToInt32(TimeTo.Split('/')[1]), 0); if (DateTime.Compare(timeTo, timeFrom) >= 0) { try { item.TimeFrom = timeFrom; item.TimeTo = timeTo; int result = isEdit ? DA_PricePayroll.Instance.Update(item) : DA_PricePayroll.Instance.Insert(item); return(Json(result > 0 ? 1 : 0)); } catch (Exception ex) { } } else { return(Json(2)); } return(Json(0)); }