Example #1
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();
        }
        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();
        }
Example #3
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();
        }
Example #4
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();
        }
Example #5
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();
        }
Example #6
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();
        }