//Save Entry public JsonResult SaveEntry(ENT.UserAndPlantMappingSUB model, string[] listMultiPlant) { try { List <Guid> dctDuplication = new List <Guid>(); objBAL.DeleteByUserID(model.AspNetUserID); foreach (string el in listMultiPlant) { model.PlantId = Guid.Parse(el); if (model.EntryMode == COM.MyEnumration.EntryMode.ADD) { if (objBAL.Insert(model)) { GlobalVarible.AddMessage("Record Save Successfully"); } } else { model.CreatedDateTime = DateTime.Now; model.UserAndPlantMappingID = new Guid(el.Replace("/", "")); if (objBAL.Update(model)) { GlobalVarible.AddMessage("Record Update Successfully"); } } } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
public bool DeleteByUserID(Guid Userid) { bool blnResult = false; try { Entity = new Framework.Entity.UserAndPlantMappingSUB(); Entity.AspNetUserID = Userid; Dictionary <string, bool> dctFields = new Dictionary <string, bool>(); dctFields.Add("AspNetUserID", true); if (objDAL.DeleteByParameter(dctFields, Entity)) { blnResult = true; } } catch (Exception) { throw; } return(blnResult); }
private List <string> ValidationEntry(object obj) { strvalidationResult.Clear(); Entity = (ENT.UserAndPlantMappingSUB)obj; return(strvalidationResult); }