public JsonResult UpdateStatus(string id) { GlobalVarible.Clear(); try { if (id != null) { Model = new Web.Framework.Entity.CountryMaster(); Model.countryid = new Guid(id); Model = (ENT.CountryMaster)objBAL.GetByPrimaryKey(Model); if (Model.Status == COM.MyEnumration.MyStatus.Active) { if (!objBAL.UpdateStatus(Model.countryid, COM.MyEnumration.MyStatus.DeActive)) { throw new Exception("Internal Server Error in status update."); } } if (Model.Status == COM.MyEnumration.MyStatus.DeActive) { if (!objBAL.UpdateStatus(Model.countryid, COM.MyEnumration.MyStatus.Active)) { throw new Exception("Internal Server Error in status update."); } } GlobalVarible.AddMessage("Status Update Successfully."); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
// this function for just referance for partial update field user have to create seperate function learn from this function. public bool UpdatePartial(ENT.CountryMaster objEntity) { bool blnResult = false; try { //Create Fields List in dictionary Dictionary <string, bool> dctFields = new Dictionary <string, bool>(); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.countryid), true); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.name), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.nicename), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.isocode), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.iso3), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.numcode), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.phonecode), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.UpdatedBy), false); dctFields.Add(COM.HelperMethod.PropertyName <ENT.CountryMaster>(x => x.UpdatedDateTime), false); objEntity.FieldCollection = dctFields; if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity)) { blnResult = true; } } catch (Exception) { throw; } return(blnResult); }
private List <string> ValidationEntry(object obj) { strvalidationResult.Clear(); Entity = (ENT.CountryMaster)obj; if (string.IsNullOrWhiteSpace(Entity.name)) { strvalidationResult.Add("Country Name Required!"); } return(strvalidationResult); }
public JsonResult EditRecord(string id) { if (id != null) { Model = new Web.Framework.Entity.CountryMaster(); Model.UpdatedDateTime = DateTime.Now; Model.countryid = new Guid(id); Model = (ENT.CountryMaster)objBAL.GetByPrimaryKey(Model); } return(Json(new { Model = Model }, JsonRequestBehavior.AllowGet)); }
public object GetByPrimaryKey(ENT.CountryMaster Entity) { object objResult = null; try { DAL.CRUDOperation tt = new DAL.CRUDOperation(); objResult = tt.GetEntityByPrimartKey(Entity); } catch (Exception) { throw; } return(objResult); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } objDAL = null; clsDAL = null; Entity = null; lstEntity = null; // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public JsonResult SaveEntry(ENT.CountryMaster model, string countryid) { try { List <Guid> dctDuplication = new List <Guid>(); if (model.EntryMode == COM.Enumration.EntryMode.ADD) { model.name = model.nicename.ToUpper(); model.Status = COM.MyEnumration.MyStatus.Active; List <ENT.CountryMaster> lstResult = new BAL.CountryMaster().CheckDuplicateCombination(dctDuplication, model.nicename, "none"); if (lstResult.Count > 0) { throw new Exception("Country Name Already Exists."); } if (objBAL.Insert(model)) { GlobalVarible.AddMessage("Record Save Successfully"); } } else { model.name = model.nicename.ToUpper(); model.UpdatedDateTime = DateTime.Now; model.UpdatedBy = Guid.Parse(User.Identity.GetUserId()); model.countryid = new Guid(countryid.Replace("/", "")); if (objBAL.UpdatePartial(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)); }