Example #1
0
        //ham tao trip moi
        public JsonResult AddTrip(string TruckId, string DriverId, string Order1, string Order2, string Status, string Note)
        {
            int id1 = 0;

            id1 = Int32.Parse(Order1.Substring(Order1.LastIndexOf("-") + 1));
            string staff_cd = User.Identity.Name.Split('|')[0];

            if (!string.IsNullOrEmpty(Order2))
            {
                int id2 = Int32.Parse(Order2.Substring(Order2.LastIndexOf("-") + 1));
                db.VT_AddNewTrip(Int32.Parse(TruckId), Int32.Parse(DriverId), "", "", id1, id2, DateTime.Now, staff_cd, "OnGoing", Note);
            }
            else
            {
                db.VT_AddNewTrip(Int32.Parse(TruckId), Int32.Parse(DriverId), "", "NULL", id1, 0, DateTime.Now, staff_cd, "OnGoing", Note);
            }
            return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
 //ham tao trip moi
 public JsonResult AddTrip(string TruckId, string DriverId, string Order1, string Order2, string Status, string Note)
 {
     try
     {
         int id1 = 0;
         id1 = Int32.Parse(Order1.Substring(Order1.LastIndexOf("-") + 1));
         string staff_cd = User.Identity.Name.Split('|')[0];
         if (!string.IsNullOrEmpty(Order2))
         {
             int id2 = Int32.Parse(Order2.Substring(Order2.LastIndexOf("-") + 1));
             db.VT_AddNewTrip(Int32.Parse(TruckId), Int32.Parse(DriverId), "", "", id1, id2, DateTime.Now, staff_cd, "OnGoing", Note);
         }
         else
         {
             db.VT_AddNewTrip(Int32.Parse(TruckId), Int32.Parse(DriverId), "", "NULL", id1, 0, DateTime.Now, staff_cd, "OnGoing", Note);
         }
         return(Json(new { success = true, message = "Tạo chuyến xe thành công!" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         help.LogError(ex);
         return(Json(new { success = false, message = "Lỗi tạo chuyến xe" }, JsonRequestBehavior.AllowGet));
     }
 }