Exemplo n.º 1
0
 public JsonResult UpdateStatus(string id)
 {
     GlobalVarible.Clear();
     try
     {
         if (id != null)
         {
             Model         = new Web.Framework.Entity.Routing();
             Model.routeid = new Guid(id);
             Model         = (ENT.Routing)objBAL.GetByPrimaryKey(Model);
             if (Model.Status == COM.MyEnumration.MyStatus.Active)
             {
                 if (!objBAL.UpdateStatus(Model.routeid, COM.MyEnumration.MyStatus.DeActive))
                 {
                     throw new Exception("Internal Server Error in status update.");
                 }
             }
             if (Model.Status == COM.MyEnumration.MyStatus.DeActive)
             {
                 if (!objBAL.UpdateStatus(Model.routeid, 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));
 }
Exemplo n.º 2
0
 public JsonResult SaveEntry(ENT.Routing model, string routeid)
 {
     try
     {
         List <Guid> dctDuplication = new List <Guid>();
         if (model.EntryMode == COM.Enumration.EntryMode.ADD)
         {
             model.Status = COM.MyEnumration.MyStatus.Active;
             List <ENT.Routing> lstResult = new BAL.Routing().CheckDuplicateCombination(dctDuplication, model.routetitle, "none");
             if (lstResult.Count > 0)
             {
                 throw new Exception("Route Title Already Exists.");
             }
             if (objBAL.Insert(model))
             {
                 GlobalVarible.AddMessage("Record Save Successfully");
             }
         }
         else
         {
             model.UpdatedDateTime = DateTime.Now;
             model.routeid         = new Guid(routeid.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));
 }
Exemplo n.º 3
0
 public JsonResult EditRecord(string id)
 {
     if (id != null)
     {
         Model = new Web.Framework.Entity.Routing();
         Model.UpdatedDateTime = DateTime.Now;
         Model.routeid         = new Guid(id);
         Model = (ENT.Routing)objBAL.GetByPrimaryKey(Model);
     }
     return(Json(new { Model = Model }, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 4
0
        public object GetByPrimaryKey(ENT.Routing Entity)
        {
            object objResult = null;

            try
            {
                DAL.CRUDOperation tt = new DAL.CRUDOperation();
                objResult = tt.GetEntityByPrimartKey(Entity);
            }
            catch (Exception)
            {
                throw;
            }
            return(objResult);
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
 public JsonResult DeleteEntry(string id)
 {
     GlobalVarible.Clear();
     if (id != null)
     {
         Model         = new Web.Framework.Entity.Routing();
         Model.routeid = 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));
 }
Exemplo n.º 7
0
 private List <string> ValidationEntry(object obj)
 {
     strvalidationResult.Clear();
     Entity = (ENT.Routing)obj;
     if (string.IsNullOrWhiteSpace(Entity.routetitle))
     {
         strvalidationResult.Add("route title Required!");
     }
     if (Entity.operatorid.ToString() == "00000000-0000-0000-0000-000000000000")
     {
         strvalidationResult.Add("Please Select Operator.");
     }
     if (Entity.amountmethod.ToString() == "-1")
     {
         strvalidationResult.Add("Please Select amount method.");
     }
     if (Entity.rechargemethod.ToString() == "-1")
     {
         strvalidationResult.Add("Please Select recharge method.");
     }
     if (Entity.amountmethod.ToString() == "0")
     {
         Entity.amountrangefrom = 0; Entity.amountrangeto = 0;
     }
     if (Entity.amountmethod.ToString() == "1")
     {
         Entity.amountSpecific = "0";
     }
     if (Entity.rechargemethod.ToString() == "0")
     {
         Entity.machineid = new Guid("00000000-0000-0000-0000-000000000000"); Entity.smartid = new Guid("00000000-0000-0000-0000-000000000000");
     }
     if (Entity.rechargemethod.ToString() == "1")
     {
         Entity.apiid = new Guid("00000000-0000-0000-0000-000000000000"); Entity.smartid = new Guid("00000000-0000-0000-0000-000000000000");
     }
     if (Entity.rechargemethod.ToString() == "2")
     {
         Entity.apiid = new Guid("00000000-0000-0000-0000-000000000000"); Entity.machineid = new Guid("00000000-0000-0000-0000-000000000000");
     }
     return(strvalidationResult);
 }