public JsonResult UpdateStatus(string id) { GlobalVarible.Clear(); try { if (id != null) { Model = new Web.Framework.Entity.APIDocument(); Model.ipid = new Guid(id); Model = (ENT.APIDocument)objBAL.GetByPrimaryKey(Model); if (Model.Status == COM.MyEnumration.MyStatus.Active) { if (!objBAL.UpdateStatus(Model.ipid, COM.MyEnumration.MyStatus.DeActive)) { throw new Exception("Internal Server Error in status update."); } } if (Model.Status == COM.MyEnumration.MyStatus.DeActive) { if (!objBAL.UpdateStatus(Model.ipid, 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)); }
public object GetByPrimaryKey(ENT.APIDocument Entity) { object objResult = null; try { DAL.CRUDOperation tt = new DAL.CRUDOperation(); objResult = tt.GetEntityByPrimartKey(Entity); } catch (Exception) { throw; } return(objResult); }
private List <string> ValidationEntry(object obj) { strvalidationResult.Clear(); Entity = (ENT.APIDocument)obj; if (string.IsNullOrWhiteSpace(Entity.address)) { strvalidationResult.Add("Ip Address Required!"); } else { bool result = COM.ExtendedMethods.ValidIpAddress(Entity.address); if (result == false) { strvalidationResult.Add("Invalid Ip Address!"); } } return(strvalidationResult); }
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; strvalidationResult = null; // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public JsonResult DeleteEntry(string id) { GlobalVarible.Clear(); if (id != null) { Model = new Web.Framework.Entity.APIDocument(); Model.ipid = new Guid(id); if (objBAL.Delete(Model)) { GlobalVarible.AddMessage("Record Delete Successfully."); } else { GlobalVarible.AddError("Internal Server Error Please Try Again"); } } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
public bool UpdatePartial(ENT.APIDocument objEntity) { bool blnResult = false; try { Dictionary <string, bool> dctFields = new Dictionary <string, bool>(); dctFields.Add(COM.HelperMethod.PropertyName <ENT.APIDocument>(x => x.ipid), true); dctFields.Add(COM.HelperMethod.PropertyName <ENT.APIDocument>(x => x.address), false); objEntity.FieldCollection = dctFields; if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity)) { blnResult = true; } } catch (Exception) { throw; } return(blnResult); }
public JsonResult SaveEntry(ENT.APIDocument model, string ipid) { try { if (model.EntryMode == COM.Enumration.EntryMode.ADD) { model.Status = COM.MyEnumration.MyStatus.Active; model.userid = Guid.Parse(User.Identity.GetUserId()); if (objBAL.Insert(model)) { GlobalVarible.AddMessage("Record Save Successfully"); } } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }