コード例 #1
0
        public async Task <ActionResult> CancelOrder(string CitizenID)
        {
            try
            {
                Object data = "";
                Init();

                SirirajDb db = new SirirajDb();

                bool cancelResult = db.CancelOrder(CitizenID);

                if (cancelResult == false)
                {
                    throw new Exception("Unable to cancel order");
                }
                else
                {
                    //Sys Stock To Mem


                    db.InitAvailableItems();
                }

                var success = new { Success = "true" };

                return(Json(success, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public async Task <ActionResult> AvailableItems()
        {
            try
            {
                Object data = "";
                Init();

                SirirajDb db = new SirirajDb();

                data = db.AvailableItems();

                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }

            //Object data = "";
            //Init();

            //SirirajDb db = new SirirajDb();

            //data = db.AvailableItems();

            //return Json(data, JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
        //[OutputCache(Duration = 604800, VaryByParam = "none", Location = OutputCacheLocation.Any)]
        public async Task <ActionResult> getAllBranches()
        {
            try
            {
                Init();

                SirirajDb db = new SirirajDb();

                Object data = db.getAllBranches();
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
        public async Task <ActionResult> getRegister(FormSiriraj.Models.SirirajModel model)

        {
            try
            {
                Init();

                SirirajDb db = new SirirajDb();

                Object data = db.getRegister(model.CitizenID);
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #5
0
        public async Task <ActionResult> ResetAvailableItems()
        {
            try
            {
                Object data = "";
                Init();

                SirirajDb db = new SirirajDb();

                db.InitAvailableItems();

                var success = new { Success = "true" };

                return(Json(success, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #6
0
        public async Task <ActionResult> getDeleteRegister(string ID, string SecretCode)
        {
            Object data = "";

            try
            {
                Init();
                if (SecretCode == AppSettings.SecretCode)
                {
                    SirirajDb db = new SirirajDb();

                    data = db.getDeleteRegister(ID, SecretCode);
                }
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #7
0
        public async Task <ActionResult> SaveRegister(FormSiriraj.Models.SirirajModel model)
        {
            try
            {
                Init();

                model.ClearCitizenID = model.CitizenID;
                model.CitizenID      = Hash.HashCitizenID(model.CitizenID);
                //var modeljson = FromString.JsonToString(model);

                //SirirajDb db = new SirirajDb { JsonData = modeljson };
                SirirajDb db   = new SirirajDb();
                Object    data = db.SaveRegister(model);

                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var resultFail = new { Success = "false", e.Message };

                return(Json(resultFail, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #8
0
        public static void   iteminei()
        {
            SirirajDb db = new SirirajDb();

            var data = db.AvailableItems();
        }