public void _GetTimelineHeader_From_Dep(string tokenId, int skip, int take)
        {
            if (string.IsNullOrEmpty(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }
            //string key = Encryption.Decrypt(tokenId);
            //if (!IsValidateToken(key))
            //    result = falseresult("UnAuthorized.");
            if (!IsValidateToken(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }


            if (skip < 1)
            {
                skip = 1;
            }

            if (take < 1)
            {
                take = 20;
            }

            try
            {
                AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao();

                //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault();



                Department_ExMapDao _departMap = new Department_ExMapDao();

                //if (objToken != null)
                //{

                var Dep_ex = _departMap.FindByKeygen(TokenValid.ApiKey).FirstOrDefault();

                var comList = ComplainData.GetTimelineHeader_From_Dep(Dep_ex.ID);
                SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get Time line Header", SaveUtility.TransStatus.Create, TokenValid.Keygen, IPAddress, "s");    //s: service
                result = Trueresult(comList);
                //}
                //else
                //{
                //    result = falseresult("UnAuthorized.");
                //}
            }
            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 GetAttachmentFiles(string tokenId, string Case_Id)
        {
            //if (string.IsNullOrEmpty(tokenId))
            //    result = falseresult("UnAuthorized.");

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

            if (string.IsNullOrEmpty(Case_Id))
            {
                result = falseresult("Please provide Case Id.");
            }
            AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao();
            ComplainsMapDao         _Map       = new ComplainsMapDao();

            try
            {
                //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault();
                //if (objToken != null)
                //{
                //********************* Get Complain list*********************
                //CaseID= Complain_Cause_id
                var comList = ComplainData.GetfileUploadByCaseId(TokenValid.ApiKey, Case_Id).Select(o => new
                {
                    o.Description,
                    o.Complain_file_ID,
                    o.FileName,
                    o.FileType,
                    o.CreateDate,
                    o.GUID
                }).ToList();
                SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get Attachment Files", SaveUtility.TransStatus.Create, TokenValid.ApiKey, IPAddress, "s");    //s: service
                result = Trueresult(comList);
                // }
                //else
                //{
                //    result = falseresult("UnAuthorized.");
                //}
            }
            catch (Exception ex)
            {
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }
            finally
            {
                _Map       = null;
                _authenMap = null;
            }
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }
예제 #3
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();
        }
예제 #4
0
        public void _GetCase(string tokenId, string Case_Id)
        {
            if (string.IsNullOrEmpty(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }

            if (string.IsNullOrEmpty(Case_Id))
            {
                result = falseresult("Please provide Case Id.");
            }

            //if (!IsValidateToken(key))
            //    result = falseresult("UnAuthorized.");
            if (!IsValidateToken(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }
            Department_ExMapDao     _departMap = new Department_ExMapDao();
            AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao();
            ComplainsMapDao         _Map       = new ComplainsMapDao();

            try
            {
                //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault();
                //if (objToken != null)
                //{
                var objDepart = _departMap.FindByKeygen(TokenValid.ApiKey).FirstOrDefault();

                //********************* Get Complain list*********************
                //CaseID= Complain_Code_id
                var comList = ComplainData.GetComplainByCaseId(TokenValid.Keygen, Case_Id).ToList();

                foreach (var i in comList)
                {
                    i.AttachmentFiles = GetfileUpload(i.ID);
                }

                if (comList.Count > 0)
                {
                    // var Status = GetComplain.Get_log_all(obj.Complain_Code_ID, null, null, null, null, null, null, null);

                    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,
                        Complain_Status_text = Liststatus(c.ID),
                        AttachmentFiles      = c.AttachmentFiles,
                    };

                    SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get Case", SaveUtility.TransStatus.Create, TokenValid.ApiKey, IPAddress, "s"); //s: service
                    result = Trueresult(selected);
                }
                else
                {
                    SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get Case", SaveUtility.TransStatus.Create, TokenValid.ApiKey, IPAddress, "s"); //s: service
                                                                                                                                                      // result = Trueresult(new OCPB.Model.Complains());
                    result = _Noresult();
                }
                //}
                //else
                //{
                //    result = falseresult("UnAuthorized.");
                //}
            }
            catch (Exception ex)
            {
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }
            finally
            {
                _Map       = null;
                _departMap = null;
                _authenMap = null;
            }
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }
        public void GetComplainStatus_Log(string tokenId, string Case_Id)
        {
            if (string.IsNullOrEmpty(tokenId))
            {
                result = falseresult("UnAuthorized.");
            }


            if (string.IsNullOrEmpty(Case_Id))
            {
                result = falseresult("Please provide Case Id.");
            }


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

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

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

            // Department_ExMapDao _departMap = new Department_ExMapDao();
            AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao();

            //ComplainsMapDao _Map = new ComplainsMapDao();

            try
            {
                //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault();
                //if (objToken != null)
                //{
                //  var objDepart = _departMap.FindByKeygen(objToken.ApiKey).FirstOrDefault();

                //********************* Get Complain list*********************
                //CaseID= Complain_Code_id
                var comList = ComplainData.GetComplainLogByCaseId(TokenValid.ApiKey, Case_Id);

                if (comList.Count > 0)
                {
                    SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get ComplainStatus_Log", SaveUtility.TransStatus.Create, TokenValid.Keygen, IPAddress, "s");     //s: service
                    result = Trueresult(comList);
                }
                else
                {
                    SaveUtility.SaveTransactionLog(TokenValid.ApiKey, "Get ComplainStatus_Log", SaveUtility.TransStatus.Create, TokenValid.Keygen, IPAddress, "s");     //s: service
                    result = falseresult(new List <OCPB.Service.Model.ComplainLog> {
                        new OCPB.Service.Model.ComplainLog()
                    });
                }

                //}
                //else
                //{
                //    result = falseresult("UnAuthorized.");
                //}
            }
            catch (Exception ex)
            {
                SaveUtility.logError(ex);
                result = falseresult(ex.Message);
            }
            finally
            {
                //_Map = null;
                //_departMap = null;
                _authenMap = null;
            }
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result));
            HttpContext.Current.Response.End();
        }
예제 #6
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();
        }
예제 #7
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();
        }