Ejemplo n.º 1
0
        // PUT api/mcomplain/5
        //public void Put(int id, [FromBody]string value)
        //{
        //}

        // DELETE api/mcomplain/5
        public void Delete(string ID, string UserKeys, string Description, string Case_id, int CancelID)
        {
            result = falseresult("ข้อมูลไม่ถูกต้อง");
            try
            {
                CustomerMapDao CusMap = new CustomerMapDao();
                int            _id    = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint();
                string         Key    = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp());
                var            Cus    = CusMap.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault();
                if (Cus != null)
                {
                    ComplainsMapDao Map     = new ComplainsMapDao();
                    var             CompObj = Map.FindByCustomerID(Cus.ID).Where(o => o.Complain_Code_ID == Case_id).FirstOrDefault();
                    if (CompObj != null)
                    {
                        SaveComplain.Cancel(CompObj.Keygen, Description, CancelID);
                        result = Trueresult("ยกเลิกข้อมูลสำเร็จ");
                    }
                    else
                    {
                        result = falseresult("ไม่พบข้อมูล");
                    }
                }
            }
            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();
        }
Ejemplo n.º 2
0
 public JsonResult CancelComplain(string Keygen, string Description, int?CancelID)
 {
     if (SaveComplain.Cancel(Keygen.UrlDescriptHttp(), Description, CancelID))
     {
         return(Json(new ResultData()
         {
             Status = true, text = "ยกเลิกข้อมูลสำเร็จ"
         }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new ResultData()
         {
             Status = false, text = "การยกเลิกข้อมูลมีปัญหา กรุณาติดต่อเจ้าหน้าที่"
         }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 3
0
        public void _CancelStatus(string tokenId, string Case_Id)
        {
            try
            {
                if (string.IsNullOrEmpty(tokenId))
                {
                    result = falseresult("UnAuthorized.");
                }

                { result = falseresult("Please provide Identification number."); }

                //string key = Encryption.Decrypt(tokenId);

                //if (!IsValidateToken(key))
                //    result = falseresult("UnAuthorized.");
                if (!IsValidateToken(tokenId))
                {
                    result = falseresult("UnAuthorized.");
                }
                else
                {
                    var comList = ComplainData.GetComplainLogByCaseId(TokenValid.ApiKey, Case_Id);

                    if (comList.Count > 0)
                    {
                        ComplainsMapDao Map = new ComplainsMapDao();

                        var Temp = Map.FindAll().Where(o => o.Complain_Code_ID == Case_Id).FirstOrDefault();
                        if (SaveComplain.Cancel(Temp.Keygen, "", 228))
                        {
                            result = Trueresult("ยกเลิกข้อมูลสำเร็จ.");
                        }
                        else
                        {
                            result = falseresult("การยกเลิกข้อมูลมีปัญหา.");
                        }
                    }
                    else
                    {
                        result = falseresult("การยกเลิกข้อมูลมีปัญหา.");
                    }
                }
            }
            catch (Exception ex)
            {
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }
            //finally
            //{
            //    _mapVer = null;
            //    _Map = null;
            //    _logMap = null;
            //    _departMap = null;
            //    _authenMap = null;
            //    _cusMap = null;
            //}
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }