Esempio n. 1
0
 public void _MChange(string Identity, string Email)
 {
     result = falseresult("ข้อมูลไม่ถูกต้อง");
     try
     {
         OCPB.Controllers.HomeController obj = new HomeController();
         var _resultMChange = obj._Forget(MobileEncryption.Decrypt(Identity.UrlDescriptHttp()), MobileEncryption.Decrypt(Email.UrlDescriptHttp()));
         if (_resultMChange.Status == true)
         {
             result = Trueresult(_resultMChange);
         }
         else
         {
             result = falseresult(_resultMChange);
         }
     }
     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();
 }
Esempio n. 2
0
        public void Post([FromUri] Pfile items)
        {
            //    Encryption.Encrypt
            try
            {
                result = falseresult("ข้อมูลไม่ถูกต้อง");
                CustomerMapDao map = new CustomerMapDao();
                int            _id = MobileEncryption.Decrypt(items.ID.UrlDescriptHttp()).Toint();
                string         Key = MobileEncryption.Decrypt(items.UserKeys.UrlDescriptHttp());
                var            Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault();
                if (Obj != null)
                {
                    SaveAccount.UpdateUser(Obj.ID, items.TitleID, items.Fname, items.Lname, items.DateOfBirth, items.OccupationID, items.SalaryID, items.Address, items.ProvinceID, items.PrefectureID, items.DistrictID, items.ZipCode,
                                           items.Tel, items.Tel_ext, items.Mobile, items.Fax, items.Email);
                    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();
        }
Esempio n. 3
0
        public void Get(string ID, string UserKeys, string Oldpass, string newPass, string PassCompare)
        {
            //_MChange(Identity, Email);

            int            _id  = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint();
            string         Key  = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp());
            CustomerMapDao map  = new CustomerMapDao();
            var            _obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault();

            result = falseresult("ข้อมูลไม่ถูกต้อง");
            if (newPass == PassCompare || _obj != null)
            {
                if (_obj.Password == Encryption.Encrypt(Oldpass))
                {
                    _obj.Password = Encryption.Encrypt(newPass);
                    map.AddOrUpdate(_obj);
                    map.CommitChange();
                    result = Trueresult("แก้ไขข้อมูลเรียบร้อยแล้ว");
                }
            }

            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
        // POST api/login

        private void _resultLogin(string tokenId, string Identity)
        {
            try
            {
                if (string.IsNullOrEmpty(tokenId))
                {
                    result = falseresult("UnAuthorized.");
                }

                if (string.IsNullOrEmpty(Identity))
                {
                    result = falseresult("Please provide citizen id.");
                }

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

                result = falseresult("ข้อมูลไม่ถูกต้อง");
                if (!string.IsNullOrEmpty(Identity))
                {
                    CustomerMapDao map  = new CustomerMapDao();
                    var            _obj = map.FindAll().Where(o => o.IdentityID == Identity && o.Active == true).FirstOrDefault();
                    if (_obj != null)
                    {
                        string _ID      = MobileEncryption.Encrypt(_obj.ID.ToString()).UrlEnscriptHttp();
                        string UserKeys = MobileEncryption.Encrypt(_obj.Keygen).UrlEnscriptHttp();
                        result = Trueresult(new _resultValue {
                            Fullname = _obj.FullNameStr, ID = _ID, UserKeys = UserKeys
                        });
                    }
                }
                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();
        }
Esempio n. 6
0
        private void _resultLogin(string Username, string Password)
        {
            try
            {
                result = falseresult("ข้อมูลไม่ถูกต้อง");
                if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
                {
                    CustomerMapDao map = new CustomerMapDao();
                    Username = MobileEncryption.Decrypt(Username.UrlDescriptHttp());
                    var _obj = map.FindAll().Where(o => o.IdentityID == Username && o.Active == true).ToList();
                    if (_obj.Count() != 0)
                    {
                        var PEncrypt = MobileEncryption.Decrypt(Password.UrlDescriptHttp());
                        var obj      = _obj.Where(o => o.Password == Encryption.Encrypt(PEncrypt) && o.Active == true).FirstOrDefault();
                        if (obj != null)
                        {
                            string _ID      = MobileEncryption.Encrypt(obj.ID.ToString()).UrlEnscriptHttp();
                            string UserKeys = MobileEncryption.Encrypt(obj.Keygen).UrlEnscriptHttp();
                            result = Trueresult(new _resultValue {
                                Fullname = obj.FullNameStr, ID = _ID, UserKeys = UserKeys
                            });
                        }
                    }
                }
                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();
        }
Esempio n. 7
0
        public void Get(string ID, string UserKeys)
        {
            result = falseresult("ข้อมูลไม่ถูกต้อง");
            try
            {
                CustomerMapDao map = new CustomerMapDao();
                int            _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint();
                string         Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp());
                var            Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).ToList();
                if (Obj.Count() > 0)
                {
                    result = Trueresult(Obj.Select(o => new { o.Address, o.ContinentsID, o.CountriesID, o.DateOfBirthStr, o.DistrictID, o.Email, o.Fax, o.Fname, o.IdentityID, o.Lname, o.Mobile, o.OccupationID, o.PrefectureID, o.ProvinceID, o.RegisterAddress, o.SalaryID, o.Sex, o.Tel, o.Tel_ext, o.TitleID, o.ZipCode }).FirstOrDefault());
                }
            }
            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();
        }
Esempio n. 8
0
        public void Get(string ID, string UserKeys)
        {
            result = falseresult("ข้อมูลไม่ถูกต้อง");
            try
            {
                CustomerMapDao map = new CustomerMapDao();
                int            _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint();
                string         Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp());
                var            Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault();
                if (Obj != null)
                {
                    result = Trueresult(ComplainData.GetComplainTimeLine(null, null, null, null, Obj.ID));
                }
            }
            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();
        }
Esempio n. 9
0
 private void _result(string value)
 {
     HttpContext.Current.Response.ContentType = "application/json";
     HttpContext.Current.Response.Write(JsonConvert.SerializeObject(Trueresult(MobileEncryption.Encrypt(value).UrlEnscriptHttp())));
     HttpContext.Current.Response.End();
 }
Esempio n. 10
0
        public void Get(string ID, string UserKeys, string Case_id)
        {
            result = falseresult("ข้อมูลไม่ถูกต้อง");
            try
            {
                CustomerMapDao map = new CustomerMapDao();

                int    _id = MobileEncryption.Decrypt(ID.UrlDescriptHttp()).Toint();
                string Key = MobileEncryption.Decrypt(UserKeys.UrlDescriptHttp());

                var Obj = map.FindByActive().Where(o => o.ID == _id && o.Keygen == Key).FirstOrDefault();
                if (Obj != null)
                {
                    var comList = ComplainData.GetComplainByCaseId(null, Case_id);
                    foreach (var i in comList)
                    {
                        i.AttachmentFiles = OCPB.Controllers.Service.GetCaseController.GetfileUpload(i.ID);
                    }
                    if (comList.Count > 0)
                    {
                        var selected = from c in comList
                                       select new
                        {
                            Complain_Code_ID      = c.Complain_Code_ID,
                            Complain_Date         = c.Complain_Date,
                            Complain_Time         = c.Complain_Time,
                            Complain_Subject      = c.Complain_Subject,
                            Complain_Details      = c.Complain_Details,
                            Complain_Channel_id   = c.Complain_Channel_id,
                            Complain_Channel_Text = c.Complain_Channel_Text,
                            Consumer_Citizen_id   = c.CusIden,
                            Consumer_Name         = c.Cusname,
                            Case_id                = c.Complain_Cause_id,
                            Defendent_Name         = c.CompanyName,
                            Defendent_Detail       = c.Complain_Details,
                            PaymentID              = c.PaymentID,
                            PaymentText            = c.PaymentText,
                            Complain_TypeID        = c.Complain_TypeID,
                            Complain_Type_Text     = c.Complain_Type_Text,
                            Complain_Type_Sub_ID   = c.Complain_Type_Sub_ID,
                            Complain_Type_Sub_Text = c.Complain_Type_Sub_Text,
                            Complain_Cause_ID      = c.Complain_Cause_id,
                            Complain_Cause_Text    = c.Complain_Cause_Text,
                            PlacePurchaseID        = c.PlacePurchaseID,
                            PlacePurchase_Text     = c.PlacePurchase_Text,
                            MotiveID               = c.MotiveID,
                            Motive_Text            = c.Motive_Text,
                            Complain_Status_text   = c.Complain_Status_text,
                            AttachmentFiles        = c.AttachmentFiles
                        };
                        result = Trueresult(selected);
                    }
                }
            }
            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();
        }