Exemplo n.º 1
0
        /// <summary>
        /// 房貸執行 Krsik 前先刪除
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public Tuple <string, List <EL_Data_Out> > deleteC07(Flow_Apply_Status data)
        {
            string             resilt   = string.Empty;
            List <EL_Data_Out> cacheC07 = new List <EL_Data_Out>();

            using (IFRS9DBEntities db = new IFRS9DBEntities())
            {
                var reportDate = data.Report_Date.ToString(C07reportDateFormate);
                var _Loan_1    = Product_Code.M.GetDescription();
                cacheC07 = db.EL_Data_Out.AsNoTracking()
                           .Where(x => x.Report_Date == reportDate &&
                                  x.Version == 1 &&
                                  x.Product_Code == _Loan_1 &&
                                  x.PRJID == data.PRJID &&
                                  x.FLOWID == data.FLOWID).ToList();

                string sql = $@"
delete EL_Data_Out
where Report_Date = '{reportDate}'
and Product_Code = '{_Loan_1}'
and Version = 1
and PRJID = '{data.PRJID}'
and FLOWID = '{data.FLOWID}'
";
                try
                {
                    db.Database.ExecuteSqlCommand(sql);
                }
                catch (Exception ex)
                {
                    resilt = ex.exceptionMessage();
                }
            }
            return(new Tuple <string, List <EL_Data_Out> >(resilt, cacheC07));
        }
Exemplo n.º 2
0
 public void saveD04(Flow_Apply_Status data)
 {
     using (IFRS9DBEntities db = new IFRS9DBEntities())
     {
         db.Flow_Apply_Status.Add(data);
         try
         {
             db.SaveChanges();
         }
         catch (Exception ex) {
         }
     }
 }
Exemplo n.º 3
0
        public async Task <JsonResult> KriskBondsComplete(string date, string version, string product, string productCode)
        {
            DateTime dt  = DateTime.MinValue;
            int      ver = 0;

            if (date.IsNullOrWhiteSpace() || version.IsNullOrWhiteSpace() ||
                product.IsNullOrWhiteSpace() || !DateTime.TryParse(date, out dt) ||
                !int.TryParse(version, out ver))
            {
                return(Json(new KRiskFlowLoaderResult()
                {
                    result = "1", message = Message_Type.parameter_Error.GetDescription()
                }));
            }
            var productInfo       = KriskRepository.getProductInfo(productCode);
            var pc                = string.Join(",", product.Split(',').Select(x => string.Format("'{0}'", x)));
            Flow_Apply_Status D04 = new Flow_Apply_Status();

            D04.Report_Date        = dt;
            D04.Run_Time_Start     = DateTime.Now;
            D04.PRJID              = productInfo.Item1;
            D04.FLOWID             = productInfo.Item2;
            D04.Group_Product_Code = productCode;
            D04.Version            = ver;
            D04.Flow_Result        = "1";
            string message = string.Empty;
            List <KRiskFlowLoaderParm> parms = new List <KRiskFlowLoaderParm>();

            parms.Add(new KRiskFlowLoaderParm()
            {
                key = "v_uni_project_name", value = productInfo.Item1
            });
            parms.Add(new KRiskFlowLoaderParm()
            {
                key = "v_uni_flow_name", value = productInfo.Item2
            });
            parms.Add(new KRiskFlowLoaderParm()
            {
                key = "v_etl_product_code", value = pc
            });
            parms.Add(new KRiskFlowLoaderParm()
            {
                key = "v_etl_report_date", value = string.Format("'{0}'", dt.ToString("yyyyMMdd"))
            });
            parms.Add(new KRiskFlowLoaderParm()
            {
                key = "v_etl_version", value = version.Trim()
            });
            HttpClient client = new HttpClient();

            client.BaseAddress = new System.Uri(kriskUrl);
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            client.Timeout = ts;
            try
            {
                HttpResponseMessage response = await client.PostAsJsonAsync(@"KRiskFlowLoader/KRiskFlowLoaderServlet", parms);

                if (response.IsSuccessStatusCode)
                {
                    KRiskFlowLoaderResult data = JsonConvert.DeserializeObject <KRiskFlowLoaderResult>(await response.Content.ReadAsStringAsync());
                    if (data.result == "0")
                    {
                        D04.Flow_Result = "0";
                        message         = "Success!";
                        KriskRepository.getBondC07CheckData(dt, ver);
                    }
                    else
                    {
                        if (data.message.IndexOf("唯一索引鍵值") > -1)
                        {
                            message = Message_Type.kriskError.GetDescription(null, "執行重複資料");
                        }
                        else
                        {
                            message = data.message;
                        }
                    }
                }
                else
                {
                    message = string.Format("Status Code : {0}", response.StatusCode);
                }
            }
            catch (Exception ex)
            {
                message = ex.exceptionMessage();
            }
            SaveD04Action act = SaveD04;

            act.Invoke(D04);
            return(Json(new KRiskFlowLoaderResult()
            {
                result = D04.Flow_Result, message = message
            }));
        }
Exemplo n.º 4
0
 public void SaveD04(Flow_Apply_Status D04)
 {
     D04.Run_Time_End = DateTime.Now;
     KriskRepository.saveD04(D04);
 }