public JsonResult setCargoType(int cargoTypeID, string cargoTypeName, int createdByID) { createdByID = 1; ClsCargoType obj = new ClsCargoType() { cargoTypeID = cargoTypeID, cargoTypeName = cargoTypeName, createdByID = createdByID }; ClsReturnValues k = Setup.setCargoType(obj); return Json(new { id = k.ID, isSuccess = k.IsSuccess ?? false ? 1 : 0, msg = k.Response }); }
public static ClsReturnValues setCargoType(ClsCargoType item) { ClsReturnValues obj = new ClsReturnValues(); try { using (var db = new tdoEntities()) { obj = db.uspAddEditCargoType(item.cargoTypeID, item.cargoTypeName,item.createdByID,item.sessionID).FirstOrDefault(); } } catch (Exception ex) { obj.Response = ex.Message; obj.IsSuccess = false; obj.ID = 0; } return obj; }
public static ClsReturnValues setCargoType(ClsCargoType obj, Guid SessionID) { ClsReturnValues lst = new ClsReturnValues(); using (var db = new tdoEntities()) { lst = db.uspAddEditCargoType(obj.cargoTypeID, obj.cargoTypeName, obj.createdByID, SessionID).FirstOrDefault(); } return lst; }
public JsonResult setCargoType(string cargoTypeID, string cargoTypeName) { List<ClsUserDisplay> userDisplay = new List<ClsUserDisplay>(); using (tdoEntities db = new tdoEntities()) { userDisplay = db.uspGetUserDisplay(GetID()).ToList<ClsUserDisplay>(); } List<string> editableForms = Restriction.GetEditableForms(userDisplay); List<string> addableForms = Restriction.GetAddableForms(userDisplay); if (int.Parse(cargoTypeID) == 0 && !addableForms.Contains("CargoType")) { return Json(new { id = 0, isSuccess = false, msg = "You are not allowed to add new records." }); } else if (int.Parse(cargoTypeID) != 0 && !editableForms.Contains("CargoType")) { return Json(new { id = 0, isSuccess = false, msg = "You are not allowed to edit records." }); } if (cargoTypeID == "") { cargoTypeID = "0"; } Guid Session = new Guid(GetSession()); //do not hard code session ID and createdbyID int _id = 0; try { _id = int.Parse(cargoTypeID.Trim()); } catch { } ClsCargoType obj = new ClsCargoType() { cargoTypeID = _id, cargoTypeName = cargoTypeName, createdByID = GetID(), sessionID = Session }; ClsReturnValues k = Administration.setCargoType(obj, Session); return Json(new { id = k.ID, isSuccess = k.IsSuccess ?? false ? 1 : 0, msg = k.Response }); }