public RSModel getProductList(PMSSourse pms, ref RezdyProductListModel rezdyProductListModel, string supplierId, int offset) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); var get = CommonTool.GetData(string.Format(Startup.Instance.GetParameter(pms, ParameterType.Product), Startup.Instance.GetParameter(pms, ParameterType.ApiKey), supplierId) + "&limit=1&offset=" + offset); //RezdyProductListModel rezdyProductListModel = JsonConvert.DeserializeObject <RezdyProductListModel>(get); if (rezdyProductListModel.RequestStatus.success == false) { rsModel.result = "0001"; rsModel.msg = "沒找到商品"; return(rsModel); } rsModel.result = "0000"; rsModel.msg = "正確"; return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public RSModel setScmProduct(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel) { try { RSModel rsModel = new RSModel(); string timezoneString = null; SCMProductModel scmModel = new SCMProductModel(); scmModel.json = new ScmProductJson(); scmModel.json.supplierOid = supplierLoginRSModel.supplierOid; scmModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; scmModel.json.deviceId = supplierLoginRSModel.deviceId; scmModel.json.tokenKey = supplierLoginRSModel.tokenKey; setStep1(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel, ref timezoneString); // 基本設定 setStep2(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 商品分類 setStep3(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel, timezoneString); // 上架時間 setStep4(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 憑證設定 setStep5(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 行程說明 //setStep6(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 照片及影片 //setStep7(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 行程表 //setStep8(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 集合地點 //setStep9(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 費用包含細節 //setStep10(supplierLoginRSModel, prodOid, rezdyProductModel, scmModel); // 兌換方式 return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public RSModel setStep3(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel, string timezoneString) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); JObject scmRSModel; UpdateDateRQModel updateDateRQModel; JObject updateDateRSModel; scmModel.json.confirmHour = "48"; // 自訂確認時間 //後面參數為model有null時 不顯示在model內 scmRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_productmodify), prodOid), JsonConvert.SerializeObject(scmModel, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); if (scmRSModel["content"]["result"].ToString() != "0000") { rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } updateDateRQModel = new UpdateDateRQModel(); updateDateRQModel.json = new UpdateDateJson(); updateDateRQModel.json.supplierOid = supplierLoginRSModel.supplierOid; updateDateRQModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; updateDateRQModel.json.deviceId = supplierLoginRSModel.deviceId; updateDateRQModel.json.tokenKey = supplierLoginRSModel.tokenKey; updateDateRQModel.json.cutOfDay = 5; //訂購前置日 updateDateRQModel.json.cutoffdayProcessTimezone = timezoneString; //每日結單時區 updateDateRQModel.json.begSaleDt = $"{DateTime.Now.ToString("yyyyMMdd")}0000"; //自動上架日期 updateDateRQModel.json.endSaleDt = $"{DateTime.Now.AddYears(3).ToString("yyyyMMdd")}2359"; //自動下架日期 updateDateRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_updateDate), prodOid), JsonConvert.SerializeObject(updateDateRQModel)); if (updateDateRSModel["content"]["result"].ToString() != "0000") { rsModel.result = updateDateRSModel["content"]["result"].ToString(); rsModel.msg = updateDateRSModel["content"]["msg"].ToString(); return(rsModel); } rsModel.result = updateDateRSModel["content"]["result"].ToString(); rsModel.msg = updateDateRSModel["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public RSModel createProduct(SupplierLoginRSModel supplierLoginRSModel, ref long prodOid, RezdyProductModel rezdyProductModel) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); SCMProductModel scmModel = new SCMProductModel(); scmModel.json = new ScmProductJson(); scmModel.json.supplierOid = supplierLoginRSModel.supplierOid; scmModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; scmModel.json.deviceId = supplierLoginRSModel.deviceId; scmModel.json.tokenKey = supplierLoginRSModel.tokenKey; scmModel.json.productName = rezdyProductModel.Product.name; scmModel.json.masterLang = scmModel.Locale; if (rezdyProductModel.Product.productType == "DAYTOUR") { scmModel.json.mainCat = "M01"; } else if (rezdyProductModel.Product.productType == "MULTIDAYTOUR") { scmModel.json.mainCat = "M02"; } else { rsModel.result = "0001"; rsModel.msg = "此商品為:" + rezdyProductModel.Product.productType + " ,非DAYTOUR 也非MULTIDAYTOUR"; return(rsModel); } JObject productNew = CommonTool.GetDataPost(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_productnew), JsonConvert.SerializeObject(scmModel)); if (productNew["content"]["result"].ToString() != "0000") { rsModel.result = productNew["content"]["result"].ToString(); rsModel.msg = productNew["content"]["msg"].ToString(); return(rsModel); } prodOid = (long)productNew["content"]["product"]["prodOid"]; rsModel.result = productNew["content"]["result"].ToString(); rsModel.msg = productNew["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
private RSModel RSSample() { var kota = KotaSample(); var result = new RSModel { RSID = "A", RSName = "B", KotaID = kota.KotaID, KotaName = kota.KotaName }; return(result); }
public RSModel setStep10(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public IHttpActionResult Delete(string rsID) { var jbtn = new RSModel { RSID = rsID }; try { _rsBL.Delete(jbtn); return(Ok("Data has been deleted")); } catch (ArgumentException ex) { return(BadRequest(ex.Message)); } }
public RSModel setStep4(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); VoucherUpdateRQModel voucherUpdateRQModel; JObject voucherUpdateRSModel; voucherUpdateRQModel = new VoucherUpdateRQModel(); voucherUpdateRQModel.json = new VoucherUpdateJson(); voucherUpdateRQModel.json.moduleSetting = new ModuleSetting(); voucherUpdateRQModel.json.moduleSetting.setting = new Setting(); voucherUpdateRQModel.json.moduleSetting.setting.dataItems = new DataItems(); voucherUpdateRQModel.json.moduleSetting.setting.dataItems.validOptions = new ValidOptions(); voucherUpdateRQModel.json.supplierOid = supplierLoginRSModel.supplierOid; voucherUpdateRQModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; voucherUpdateRQModel.json.deviceId = supplierLoginRSModel.deviceId; voucherUpdateRQModel.json.tokenKey = supplierLoginRSModel.tokenKey; voucherUpdateRQModel.json.moduleType = "PMDL_VOUCHER"; // 固定 voucherUpdateRQModel.json.moduleSetting.isRequired = true; // 固定 voucherUpdateRQModel.json.moduleSetting.setting.voucherType = "02"; // 憑證類型 供應商憑證 //後面參數為model有null時 不顯示在model內 voucherUpdateRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_voucherupdate), prodOid), JsonConvert.SerializeObject(voucherUpdateRQModel)); if (voucherUpdateRSModel["content"]["result"].ToString() != "0000") { rsModel.result = voucherUpdateRSModel["content"]["result"].ToString(); rsModel.msg = voucherUpdateRSModel["content"]["msg"].ToString(); return(rsModel); } rsModel.result = voucherUpdateRSModel["content"]["result"].ToString(); rsModel.msg = voucherUpdateRSModel["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public void Insert(RSModel entity) { var sql = @" INSERT INTO OFTA_RS ( RSID, RSName, KotaID ) VALUES ( @RSID, @RSName, @KotaID )"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@RSID", entity.RSID, SqlDbType.VarChar); cmd.AddParam("@RSName", entity.RSName, SqlDbType.VarChar); cmd.AddParam("@KotaID", entity.KotaID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public static byte[] ExportMTL(RSModel m) { List<string> exportLines = new List<string>(); string dataTotal = ""; for (int i = 0; i < m.colorValues.Length; i++) { exportLines.Add("newmtl color" + i); System.Drawing.Color c = m.getColor(i); double r = Math.Round(c.R / 255.0, 3); double g = Math.Round(c.G / 255.0, 3); double b = Math.Round(c.B / 255.0, 3); exportLines.Add("\tKd " + r + " " + g + " " + b); if (m.triangleAlphaValues != null) exportLines.Add("\td " + (255 - (m.triangleAlphaValues[i] / 255.0))); } foreach (string s in exportLines) dataTotal += s + "\n"; return Encoding.UTF8.GetBytes(dataTotal.TrimEnd('\n')); }
public RSModel setStep2(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); JObject scmRSModel; //scmModel.json.tagCd = new List<string>(); if (rezdyProductModel.Product.productType == "DAYTOUR") { scmModel.json.tagCd = new List <string>(new String[] { "TAG_4_4" }); // 商品分類 一日遊 } else if (rezdyProductModel.Product.productType == "MULTIDAYTOUR") { scmModel.json.tagCd = new List <string>(new String[] { "TAG_4_5" }); // 商品分類 多日遊 } //後面參數為model有null時 不顯示在model內 scmRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_productmodify), prodOid), JsonConvert.SerializeObject(scmModel, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); if (scmRSModel["content"]["result"].ToString() != "0000") { rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public IHttpActionResult GetData(string rsID) { var jbtn = new RSModel { RSID = rsID }; try { var result = _rsBL.GetData(jbtn); if (result is null) { return(BadRequest("Data Not Found")); } return(Ok(result)); } catch (ArgumentException ex) { return(BadRequest(ex.Message)); } }
public void Init() { OwnTransform = GetComponent <Transform>(); Engine = GetComponent <Engine> (); Model = GetComponentInChildren <RSModel> (); RSConnection = GetComponent <RSConnection> (); RSComposition = GetComponent <RSComposition> (); CarProperties = GetComponent <CarProperties> (); if (Engine) { OwnEngine = Engine; IsEngine = true; } RSConnection.Init(); RSComposition.Init(); // set bogeys to RS SetBogeys(); }
public void Update(RSModel entity) { var sql = @" UPDATE OFTA_RS SET RSname = @RSName, KotaID = @KotaID WHERE RSID = @RSID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@RSID", entity.RSID, SqlDbType.VarChar); cmd.AddParam("@RSName", entity.RSName, SqlDbType.VarChar); cmd.AddParam("@KotaID", entity.KotaID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public RSModel Save(RSAddDto rs) { // INPUT VALIDATION rs.Empty().Throw("DATA RUMAH SAKIT empty"); rs.Empty().Throw("RUMAH SAKIT kosong"); rs.RSID.Empty().Throw("RUMAH SAKIT ID invalid"); rs.RSID.Length.GreaterThan(5).Throw("RUMAH SAKIT ID max length is 5"); rs.RSName.Empty().Throw("RUMAH SAKIT NAME empty"); rs.RSName.Length.GreaterThan(30).Throw("RUMAH SAKIT NAME max length is 30"); rs.KotaID.Empty().Throw("KOTA ID empty"); // CONSTRUCT MODEL var result = new RSModel { RSID = rs.RSID, RSName = rs.RSName, KotaID = rs.KotaID }; // BUSINESS VALIDATION var kt = _kotaDal.GetData(result); kt.Empty().Throw("KOTA ID invalid"); result.KotaName = kt.KotaName; // APPLY var exist = _rsDal.GetData(result); if (exist != null) { _rsDal.Update(result); } else { _rsDal.Insert(result); } // RETURN return(result); }
public static byte[] ExportOBJ(RSModel m, string mtl = null) { List<string> exportLines = new List<string>(); exportLines.Add("# Runescape Model Format"); exportLines.Add("# Exported to OBJ with RunePackage"); if (mtl != null) exportLines.Add("mtllib " + mtl); for (int i = 0; i < m.numVertices; i++) // Vertices exportLines.Add("v " + m.verticesX[i] + " " + m.verticesY[i] + " " + m.verticesZ[i]); exportLines.Add("o runescapemodel"); for (int i = 0; i < m.numTriangles; i++) // Faces { //exportLines.Add("g col" + i); exportLines.Add("usemtl color" + i); exportLines.Add("f " + (m.trianglePoints1[i] + 1) + " " + (m.trianglePoints2[i] + 1) + " " + (m.trianglePoints3[i] + 1)); exportLines.Add(""); } string dataTotal = ""; foreach(string s in exportLines) dataTotal += s + "\n"; return Encoding.UTF8.GetBytes(dataTotal.TrimEnd('\n')); }
public IEnumerable <RSModel> ListData() { List <RSModel> result = null; var sql = @" SELECT aa.RSID, aa.RSName, aa.KotaID, ISNULL(bb.KotaName, '') KotaName FROM OFTA_RS aa LEFT JOIN OFTA_Kota bb ON aa.KotaID = bb.KotaID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } result = new List <RSModel>(); while (dr.Read()) { var itemResult = new RSModel { RSID = dr["RSID"].ToString(), RSName = dr["RSName"].ToString(), KotaID = dr["KotaID"].ToString(), KotaName = dr["KotaName"].ToString() }; result.Add(itemResult); } } } return(result); }
public RSModel setStep5(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); JObject scmRSModel; scmModel.json.introduction = Regex.Replace(rezdyProductModel.Product.shortDescription, "<.*?>", "\n"); // 商品概述 將html tag 都取代成 換行 scmModel.json.productDesc = Regex.Replace(rezdyProductModel.Product.description, "<.*?>", "\n"); // 詳細內容 將html tag 都取代成 換行 //後面參數為model有null時 不顯示在model內 scmRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_productmodify), prodOid), JsonConvert.SerializeObject(scmModel, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); if (scmRSModel["content"]["result"].ToString() != "0000") { rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }
public RSModel GetData(IRSKey key) { RSModel result = null; var sql = @" SELECT aa.RSName, aa.KotaID, ISNULL(bb.KotaName,'') KotaName FROM OFTA_RS aa LEFT JOIN OFTA_Kota bb ON aa.KotaID = bb.KotaID WHERE RSID = @RSID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@RSID", key.RSID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new RSModel { RSID = key.RSID, RSName = dr["RSName"].ToString(), KotaID = dr["KotaID"].ToString(), KotaName = dr["KotaName"].ToString() }; } } return(result); }
static void Main(string[] args) { try { //Startup startup = new Startup(); //startup.Initial(); //Website.Instance.Init(configuration); Startup.Instance.Initial(); //initial log4net CommonTool.LoadLog4netConfig(); Console.WriteLine("Log4net initial.."); //待補 long prodOid = 20451; SupplierLoginRSModel supplierLoginRSModel = new SupplierLoginRSModel(); RezdyProductListModel rezdyProductListModel = new RezdyProductListModel(); RezdyProductModel rezdyProductModel = new RezdyProductModel(); PackageRepository packageRepository = new PackageRepository(); RSModel getProductRSModel = new RSModel(); RSModel getProductListRSModel = new RSModel(); RSModel createProductRSModel = new RSModel(); RSModel setScmProductRSModel = new RSModel(); int offset = 0; // 抓取productList會限定一次只抓一筆 故 offset從0開始抓 var accounts = new[] { new { id = 1, name = "thisisname" } }; var pmsList = new[] { new { id = 1, pmsname = "Rezdy" } }; //var suppliers ; foreach (var account in accounts) { foreach (var pms in pmsList) { //prodOid = 0; //抓取所有supplier清單 var supplierList = SupplierDAL.GetSupplierList(pms.pmsname); foreach (var supplier in supplierList["Table"]) { // 設定參數 supplierLoginRSModel = product.setParameters(PMSSourse.Rezdy, supplier["pms_supplier_name"].ToString(), supplier["kkday_supplier_oid"].ToString(), supplier["scm_account"].ToString(), supplier["scm_password"].ToString()); if (supplierLoginRSModel.result == "0000") { offset = 0; getProductListRSModel = product.getProductList(PMSSourse.Rezdy, ref rezdyProductListModel, supplier["pms_supplier_id"].ToString(), offset); //foreach (var prod in productList) while (getProductListRSModel.result == "0000" && rezdyProductListModel.Products.Count > 0) { rezdyProductModel.RequestStatus = rezdyProductListModel.RequestStatus; rezdyProductModel.Product = rezdyProductListModel.Products[0]; // rezdyProductListModel.Product 每次只取一筆 把取到資料給 rezdyProductModel.Product //抓取商品 //getProductRSModel = product.getProduct(PMSSourse.Rezdy, ref rezdyProductModel, "PSSPVU"); if (rezdyProductModel.Product != null) { //建立SCM商品 //createProductRSModel = product.createProduct(supplierLoginRSModel, ref prodOid, rezdyProductModel); //if (createProductRSModel.result == "0000") { //商品明細 setScmProductRSModel = product.setScmProduct(supplierLoginRSModel, prodOid, rezdyProductModel); //套餐 //PackageRepository packageRepository = new PackageRepository(); packageRepository.Main( Models.Shared.Enum.PMSSourse.Rezdy, prodOid, supplierLoginRSModel.supplierOid, rezdyProductModel.Product.productCode, rezdyProductModel.Product.currency, supplierLoginRSModel.supplierUserUuid, supplierLoginRSModel.deviceId, supplierLoginRSModel.tokenKey); //旅規 //module.Main(); } //else //{ // Console.WriteLine("建立商品錯誤:" + createProductRSModel.result); //} } else { Console.WriteLine("抓取商品錯誤:" + getProductRSModel.result); } offset++; getProductListRSModel = product.getProductList(PMSSourse.Rezdy, ref rezdyProductListModel, supplier["pms_supplier_id"].ToString(), offset); } } else { Console.WriteLine("設定參數錯誤:" + supplierLoginRSModel.result); } } } } Console.WriteLine("Done!"); } catch (Exception ex) { //error log _log.Error(ex.ToString()); throw ex; } }
public RSModel setStep1(SupplierLoginRSModel supplierLoginRSModel, long prodOid, RezdyProductModel rezdyProductModel, SCMProductModel scmModel, ref string timezoneString) { try { //Startup startup = new Startup(); //startup.Initial(); RSModel rsModel = new RSModel(); JObject scmRSModel; JObject countryList; JObject cityList; JObject countryModifyRSModel; JObject setCostMethodRSModel; JObject timezone; AreaRQModel areaModel; CountryModifyRQModel countryModifyRQModelModel; SetCostMethodRQModel setCostMethodRQModel; areaModel = new AreaRQModel(); areaModel.json = new AreaJson(); areaModel.json.supplierOid = supplierLoginRSModel.supplierOid; areaModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; areaModel.json.deviceId = supplierLoginRSModel.deviceId; areaModel.json.tokenKey = supplierLoginRSModel.tokenKey; countryModifyRQModelModel = new CountryModifyRQModel(); countryModifyRQModelModel.json = new CountryModifyJson(); countryModifyRQModelModel.json.supplierOid = supplierLoginRSModel.supplierOid; countryModifyRQModelModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; countryModifyRQModelModel.json.deviceId = supplierLoginRSModel.deviceId; countryModifyRQModelModel.json.tokenKey = supplierLoginRSModel.tokenKey; scmModel.Currency = rezdyProductModel.Product.currency; scmModel.json.productName = rezdyProductModel.Product.name; // 商品名稱 string country = null; string city = null; if (rezdyProductModel.Product.timezone != null) { foreach (var i in rezdyProductModel.Product.timezone.Split('/')) { if (country == null) { country = i; } else { city = i; } } } foreach (var i in new string[] { "A01", "A03", "A04", "A04", "A05", "A06", "A07", "A08", "A09" }) { areaModel.json.parentAreaCd = i; countryList = CommonTool.GetDataPost(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_area), JsonConvert.SerializeObject(areaModel)); foreach (var j in countryList["content"]["areaList"]) { if (country == j["areaShortName"].ToString()) { areaModel.json.parentAreaCd = j["areaCd"].ToString(); cityList = CommonTool.GetDataPost(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_area), JsonConvert.SerializeObject(areaModel)); foreach (var k in cityList["content"]["areaList"]) { if (city == k["areaShortName"].ToString()) { countryModifyRQModelModel.json.opType = "UPDATE"; countryModifyRQModelModel.json.cityCd = k["areaCd"].ToString(); // 區域(城巿) countryModifyRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_countrymodify), prodOid), JsonConvert.SerializeObject(countryModifyRQModelModel)); if (countryModifyRSModel["content"]["result"].ToString() != "0000") { rsModel.result = countryModifyRSModel["content"]["result"].ToString(); rsModel.msg = countryModifyRSModel["content"]["msg"].ToString(); return(rsModel); } break; } } break; } } } timezone = CommonTool.GetDataPost(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_timezone), JsonConvert.SerializeObject(scmModel)); foreach (var i in timezone["content"]["codeList"]) { if (i["code"]["dataName"].ToString().StartsWith(rezdyProductModel.Product.timezone) == true) { scmModel.json.timezone = i["code"]["dataCd"].ToString(); // 商品時區 timezoneString = scmModel.json.timezone; break; } } setCostMethodRQModel = new SetCostMethodRQModel(); setCostMethodRQModel.json = new SetCostMethodJson(); setCostMethodRQModel.json.supplierOid = supplierLoginRSModel.supplierOid; setCostMethodRQModel.json.supplierUserUuid = supplierLoginRSModel.supplierUserUuid; setCostMethodRQModel.json.deviceId = supplierLoginRSModel.deviceId; setCostMethodRQModel.json.tokenKey = supplierLoginRSModel.tokenKey; setCostMethodRQModel.json.costCalcMethod = "NET"; //成本計算方式 setCostMethodRQModel.json.prodCurrCd = rezdyProductModel.Product.currency; //成本計算方式 幣別 setCostMethodRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_setCostMethod), prodOid), JsonConvert.SerializeObject(setCostMethodRQModel)); if (setCostMethodRSModel["content"]["result"].ToString() != "0000") { rsModel.result = setCostMethodRSModel["content"]["result"].ToString(); rsModel.msg = setCostMethodRSModel["content"]["msg"].ToString(); return(rsModel); } // 有可能是 en-au 但是scm均為en 所以要作轉換 //for (int i = 0; i < rezdyProductModel.Product.Languages.Count; i++) //{ // if (rezdyProductModel.Product.Languages[i].StartsWith("en") == true) // rezdyProductModel.Product.Languages[i] = "en"; //} //scmModel.json.guideLang = rezdyProductModel.Product.Languages; // 提供解說服務 scmModel.json.keyWord = ""; // 自訂關鍵字 用逗號分隔 共三格 11,22,33 scmModel.json.orderEmail = supplierLoginRSModel.email; // 訂單通知 email scmModel.json.supplierNote = rezdyProductModel.Product.productCode; // 備註(店家內部使用) 對應到對方的productCode //後面參數為model有null時 不顯示在model內 scmRSModel = CommonTool.GetDataPost(string.Format(Startup.Instance.GetParameter(PMSSourse.KKday, ParameterType.KKdayApi_productmodify), prodOid), JsonConvert.SerializeObject(scmModel, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); if (scmRSModel["content"]["result"].ToString() != "0000") { rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } rsModel.result = scmRSModel["content"]["result"].ToString(); rsModel.msg = scmRSModel["content"]["msg"].ToString(); return(rsModel); } catch (Exception ex) { _log.Debug(ex.ToString()); throw ex; } }