Exemplo n.º 1
0
 public JsonResult GetUnitPrice()
 {
     try
     {
         //jQuery DataTables Param
         string id = (Request.Form.GetValues("id").FirstOrDefault() == null
             ? ""
             : Request.Form.GetValues("id").FirstOrDefault().ToString());
         if (id.All(Char.IsDigit))
         {
             TBL_SERVICE item = DA_Service.Instance.GetById(Convert.ToInt32(id));
             return(Json(item == null ? 1 : item.UnitPrice));
         }
     }
     catch (Exception ex) {}
     return(Json(1));
 }
Exemplo n.º 2
0
 public ActionResult Edit(string serviceID, string serviceName, string unitPrice, string notes, string isActive)
 {
     if (!string.IsNullOrWhiteSpace(serviceID) && !string.IsNullOrWhiteSpace(serviceName) && serviceID.All(Char.IsDigit))
     {
         try
         {
             unitPrice = !unitPrice.All(Char.IsDigit) && string.IsNullOrWhiteSpace(unitPrice) ? "0" : unitPrice;
             TBL_SERVICE item = DA_Service.Instance.GetById(Convert.ToInt32(serviceID));
             item.ServiceName = serviceName;
             item.UnitPrice   = Convert.ToDecimal(unitPrice);
             item.Notes       = notes;
             item.IsActive    = (isActive == "on") ? true : false;
             DA_Service.Instance.Update(item);
             return(RedirectToAction("Index", "Service"));
         }
         catch (Exception ex) { return(View()); }
     }
     return(View());
 }
Exemplo n.º 3
0
 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_SERVICE user = DA_Service.Instance.GetById(Convert.ToInt32(id));
             return(Json(user == null ? 0 : DA_Service.Instance.Delete(user)));
         }
         return(Json(0));
     }
     catch (Exception ex)
     {
         return(Json(0));
     }
 }