Exemplo n.º 1
0
 public ActionResult Index(Clue obj, bool captchaValid, List <HttpPostedFileBase> Filename)
 {
     if (captchaValid)
     {
         if (ModelState.IsValid)
         {
             ClueMapDao clueMap = new ClueMapDao();
             if (obj.ID == 0)
             {
                 obj.Active     = true;
                 obj.CreateDate = DateTime.Now;
                 obj.Keygen     = Guid.NewGuid().ToString();
             }
             obj.Complain_Channel_id = 1;//เรื่องร้องทุกข์ Online
             clueMap.Add(obj);
             clueMap.CommitChange();
             SaveUtility.SaveClueFileUpload(Filename, "Clue", obj.Keygen);
             return(RedirectToAction("ClueModal", "Clue"));
         }
     }
     TempData.Clear();
     ModelState.AddModelError("", "ข้อมูลไม่ถูกต้อง");
     MvcCaptcha.ResetCaptcha("ClueCaptcha");
     return(View(obj));
 }
Exemplo n.º 2
0
        public void _SaveClue(string tokenId, string title, string description, string Consumer_firstname, string Consumer_lastname, string Consumer_Email, string Consumer_Mobile, string address, string Amphur_text, string Province_text)
        {
            if (string.IsNullOrEmpty(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }
            //string key = Encryption.Decrypt(tokenId);
            //if (!IsValidateToken(key))
            //    result = falseresult("UnAuthorized.");

            if (!IsValidateToken(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }

            ClueMapDao clueMap = new ClueMapDao();
            AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao();
            Department_ExMapDao     _departMap = new Department_ExMapDao();

            //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault();
            try
            {
                int? ChannelID = _departMap.FindByKeygen(TokenValid.ApiKey).FirstOrDefault().ChanelID;
                Clue obj       = new Clue();
                obj.Active              = true;
                obj.CreateDate          = DateTime.Now;
                obj.Keygen              = Guid.NewGuid().ToString();
                obj.Title               = title;
                obj.Address             = address;
                obj.Description         = description;
                obj.Amphur_text         = Amphur_text;
                obj.Province_text       = Province_text;
                obj.Complain_Channel_id = ChannelID;
                obj.Fname               = Consumer_firstname;
                obj.Lname               = Consumer_lastname;
                obj.Mobile              = Consumer_Mobile;
                obj.Email               = Consumer_Email;
                clueMap.Add(obj);
                clueMap.CommitChange();
                SaveUtility.SaveTransactionLog(obj.Keygen, "Save Clue", SaveUtility.TransStatus.Create, TokenValid.Keygen, IPAddress, "s"); //s: service
                clueMap = null;
                result  = Trueresult("ระบบได้รับคำแจ้งเบาแสเรียบร้อยแล้ว");
            }
            catch (Exception ex)
            {
                clueMap    = null;
                _authenMap = null;
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }
Exemplo n.º 3
0
        public void Post([FromBody] MClueModel value)
        {
            result = falseresult("ข้อมูลไม่ถูกต้อง");
            try
            {
                Clue       obj     = new Clue();
                ClueMapDao clueMap = new ClueMapDao();
                if (obj.ID == 0)
                {
                    obj.Active     = true;
                    obj.CreateDate = DateTime.Now;
                    obj.Keygen     = Guid.NewGuid().ToString();
                }
                obj.Address             = value.Address;
                obj.Description         = value.Description;
                obj.Title               = value.Title;
                obj.Email               = value.Email;
                obj.Fname               = value.Fname;
                obj.Lname               = value.Lname;
                obj.Mobile              = value.Mobile;
                obj.Url                 = value.Url;
                obj.PrefectureID        = value.PrefectureID;
                obj.ProvinceID          = value.ProvinceID;
                obj.Complain_Channel_id = 1;//เรื่องร้องทุกข์ Online
                clueMap.Add(obj);
                clueMap.CommitChange();
                result = Trueresult("ได้รับเรื่องร้องเรียนของท่านเรียบร้อยแล้ว");
            }
            catch (Exception ex)
            {
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }

            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }