//新版 public static PmchSslRequest3 setPaymentInfo2(ProductModel prod, DataModel data, string orderMid, B2dAccount UserData, Pmgw pmgw, string memUuid) { PmchSslRequest3 pmch = new PmchSslRequest3(); pmch.api_key = "kkdayapi"; pmch.user_oid = "1"; pmch.ver = "1.0.1"; pmch.lang_code = "zh-tw"; pmch.ipaddress = "127.0.0.1"; CallJsonPay2 json = new CallJsonPay2(); json.pmch_oid = pmgw.pmchOid; json.is_3d = "0"; json.pay_currency = data.currency; json.pay_amount = Convert.ToDouble(data.currPriceTotal); json.return_url = Website.Instance.Configuration["payRtnUrl:returnUrl"].ToString() + orderMid; json.cancel_url = Website.Instance.Configuration["payRtnUrl:returnUrl"].ToString() + orderMid; json.user_locale = UserData.LOCALE;// "zh-tw"; json.paymentParam1 = ""; json.paymentParam2 = ""; if (prod.img_list.Count > 0) { json.logo_url = Website.Instance.Configuration["kkUrl:imgUrl"].ToString() + prod.img_list[0].img_kkday_url; } else { json.logo_url = ""; } payment_source_info pay = new payment_source_info(); pay.source_type = "KKDAY"; pay.order_mid = orderMid; json.payment_source_info = pay; credit_card_info credit = new credit_card_info(); credit.card_holder = data.card.cardHolder; credit.card_no = data.card.cardNo.Replace(" ", ""); credit.card_type = data.card.cardType;//"VISA"; credit.card_cvv = data.card.cardCvv; data.card.expiry = data.card.expiry.Replace(" ", "").Replace("/", ""); credit.card_exp = "20" + data.card.expiry.Substring(2, 2) + data.card.expiry.Substring(0, 2);// "202312"; json.credit_card_info = credit; payer_info payer = new payer_info(); payer.first_name = UserData.NAME_LAST; payer.last_name = UserData.NAME_LAST; payer.phone = UserData.TEL; payer.email = UserData.EMAIL; json.payer_info = payer; product_info prodInfo = new product_info(); prodInfo.prod_name = prod.prod_name; prodInfo.prod_oid = prod.prod_no.ToString(); json.product_info = prodInfo; member member = new member(); member.member_uuid = memUuid; member.risk_status = "01"; member.ip = "127.0.0.1"; json.member = member; pmch.json = json; return(pmch);// JsonConvert.SerializeObject(pmch); }
private void Receive() // 서버로 부터 값 받아오기 { formatter = new BinaryFormatter(); BinaryWriter binWriter = new BinaryWriter(stream); BinaryReader binReader = new BinaryReader(binWriter.BaseStream); Dictionary <string, product_info> dic = new Dictionary <string, product_info>(); product_info[] prod; prod = new product_info[6]; for (int i = 0; i < 6; i++) { prod[i] = new product_info(); } for (int i = 0; i < 6; i++) { prod[i].name = name_list[i]; prod[i].price = price_list[i]; prod[i].quantity = quantity_list[i]; dic.Add(label_list[i], prod[i]); } while (Connected) { //Thread.Sleep(1); if (stream.CanRead) { try { Array.Clear(buff, 0, buff.Length); int tempInt = stream.Read(buff, 0, 100000); Writer.Write('A'); Writer.Flush(); Console.WriteLine(tempInt.ToString()); Image x = (Bitmap)((new ImageConverter()).ConvertFrom(buff)); Array.Clear(buff2, 0, buff2.Length); int tempInt2 = stream.Read(buff2, 0, 100); Writer.Write('B'); Writer.Flush(); //if (tempInt > 0) //{ Console.WriteLine(tempInt2.ToString()); //var myMat = convertToMat(buff); ////byte[] byte_array = Encoding.GetEncoding("UTF-8").GetBytes(buff); HandleInvoke(() => { pbi1.Image = (Bitmap)x.Clone(); string recv_label_string = ByteToString(buff2); Console.WriteLine(recv_label_string); //recv_label_string = recv_label_string.Remove(0, 1); string[] check_label_string = recv_label_string.Split(']'); string[] recv_labels = check_label_string[0].Split(','); int num_labels = recv_labels.Length; if (recv_labels[0].Length != 1) { try { for (int i = 0; i < num_labels; i++) { recv_labels[i] = recv_labels[i].Remove(0, 2); recv_labels[i] = recv_labels[i].Remove(recv_labels[i].Length - 1, 1); Console.WriteLine(recv_labels[i]); } if (num_labels >= max_num_labels) { max_num_labels = num_labels; Size resize = new Size(480, 300); Bitmap resizeImage = new Bitmap(pbi1.Image, resize); pbi2.Image = resizeImage; try { int totalPrice_int = 0; for (int i = 0; i < num_labels; i++) { lbObj[i].Text = dic[recv_labels[i]].name; lbQuantity[i].Text = dic[recv_labels[i]].quantity.ToString(); lbPrice[i].Text = dic[recv_labels[i]].price.ToString(); totalPrice_int += dic[recv_labels[i]].quantity * dic[recv_labels[i]].price; } priceTotal.Text = totalPrice_int.ToString(); } catch { } } } catch { } } }); } catch { } } } }
public async Task <ActionResult <int> > AddProduct_info([FromBody] product_info product) { db.product_info.Add(product); return(await db.SaveChangesAsync()); }
public ActionResult AddProduct(product pr, string sMale, string sFemale, product_features pf, string sleeveLong, string sleeveShort, int[] size, int[] color, product_info pi, HttpPostedFileBase[] img) { if (sleeveLong == "long") { pf.sleeve_id = 1; } else if (sleeveShort == "short") { pf.sleeve_id = 2; } if (pf.material_id == 0) { pf.material_id = null; } if (pf.neckline_id == 0) { pf.neckline_id = null; } if (pf.pattern_id == 0) { pf.pattern_id = null; } if (pf.pocket_id == 0) { pf.pocket_id = null; } if (pf.upper_fit_id == 0) { pf.pocket_id = null; } if (pf.base_id == 0) { pf.base_id = null; } if (pf.bottom_fit_id == 0) { pf.bottom_fit_id = null; } eshop_entities.product_features.Add(pf); eshop_entities.SaveChanges(); if (sMale == "male") { pr.sex_id = 1; } else if (sFemale == "female") { pr.sex_id = 2; } if (pr.sub_category_id == 0) { pr.sub_category_id = null; } pr.product_features_id = pf.id; pr.approved = true; eshop_entities.product.Add(pr); eshop_entities.SaveChanges(); for (int i = 0; i < size.Length; i++) { size_prod_pivot sp = new size_prod_pivot(); sp.size_id = (byte)size[i]; sp.product_id = pf.id; eshop_entities.size_prod_pivot.Add(sp); eshop_entities.SaveChanges(); } for (int i = 0; i < color.Length; i++) { color_prod_pivot cp = new color_prod_pivot(); cp.color_id = (byte)color[i]; cp.product_id = pf.id; eshop_entities.color_prod_pivot.Add(cp); eshop_entities.SaveChanges(); } for (int i = 0; i < img.Length; i++) { string path = ""; string path_small = ""; if (img[i] != null) { Image myImg = Image.FromStream(img[i].InputStream); Bitmap bm = new Bitmap(myImg, 600, 750); path = "/Content/images/" + Guid.NewGuid() + System.IO.Path.GetExtension(img[i].FileName); bm.Save(Server.MapPath(path)); Bitmap bm_small = new Bitmap(myImg, 100, 125); path_small = "/Content/images/" + Guid.NewGuid() + "small" + System.IO.Path.GetExtension(img[i].FileName); bm.Save(Server.MapPath(path_small)); } elite_shopping.Models.picture pc = new picture(); pc.medium = path; pc.product_id = pf.id; eshop_entities.picture.Add(pc); eshop_entities.SaveChanges(); elite_shopping.Models.picture pc_small = new picture(); pc_small.small = path_small; pc_small.product_id = pf.id; eshop_entities.picture.Add(pc_small); eshop_entities.SaveChanges(); } return(RedirectToAction("Product")); }
public async Task <ActionResult <int> > Revisestorage([FromBody] product_info product) { db.Entry(product).State = EntityState.Modified; return(await db.SaveChangesAsync()); }