public JsonResult Insert_VehLocTransMaster(VehicleLocTransVM VehLocTransVM) { bool result = false; string msg = "Failed to save record.."; result = VehLocTransMethods.Insert_VehLocTransMaster(VehLocTransVM, Session["DealerCode"].ToString(), ref msg); if (result) { msg = "Successfully Added"; } return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet)); }
public static bool Insert_VehLocTransMaster(VehicleLocTransVM model, string dealerCode, ref string msg) { try { if (model.TransNo == "" || model.TransNo == null) { strAutoCode = sysfun.AutoGen("VehicleLocTransMaster", "TransNo", DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy"), dealerCode); } else { strAutoCode = model.TransNo; } SqlParameter[] param = { new SqlParameter("@DealerCode", dealerCode), //0 new SqlParameter("@TransNo", strAutoCode), //1 new SqlParameter("@TransDate", sysfun.SaveDate(model.TransDate)), //2 new SqlParameter("@FromLocCode", model.FromLocCode), //3 new SqlParameter("@ToLocCode", model.ToLocCode), //4 new SqlParameter("@UpdUser", AuthBase.UserId), //5 new SqlParameter("@UpdDate", DateTime.Now.ToShortDateString()), //6 new SqlParameter("@UpdTime", DateTime.Now.ToShortTimeString()), //7 new SqlParameter("@UpdTerm", General.CurrentIP), //8 new SqlParameter("@Remarks", model.Remarks) //9 }; if (ObjTrans.BeginTransaction(ref Trans) == true) { sysfun.ExecuteSP_NonQuery("SP_Insert_VehicleLocTransMaster", param, Trans); IsSaved = true; } } catch (Exception ex) { msg = ex.Message; } return(IsSaved); }