public async Task <Response> AddCartProduct(CartMaster detail) { var data = JsonConvert.SerializeObject(detail); var result = await CallPostFunction(data, AddCartProductAction); return(result); }
public ActionResult DeleteConfirmed(int id) { CartMaster cartMaster = db.CartMasters.Find(id); db.CartMasters.Remove(cartMaster); db.SaveChanges(); return(RedirectToAction("Index")); }
private void UpdateData() { if (this.comboNames.SelectedValue != null) { int id = int.Parse(this.comboNames.SelectedValue.ToString()); CartMaster row = BaseMasterModel.Find <CartMaster>(this.m_db.Conn, id); SetData(row); } }
public ActionResult Edit([Bind(Include = "CartId,Qnt,Date,refUserId,refProductId")] CartMaster cartMaster) { if (ModelState.IsValid) { db.Entry(cartMaster).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.refProductId = new SelectList(db.ProductMasters, "ProductId", "ProductName", cartMaster.refProductId); ViewBag.refUserId = new SelectList(db.UserMasters, "UserId", "UserName", cartMaster.refUserId); return(View(cartMaster)); }
public ActionResult Create([Bind(Include = "CartId,Qty,refAdminId,refProductId,Date,refUserId")] CartMaster cartMaster) { if (ModelState.IsValid) { db.CartMasters.Add(cartMaster); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.refProductId = new SelectList(db.ProductMasters, "ProductId", "ProductName", cartMaster.refProductId); ViewBag.refUserId = new SelectList(db.UserMasters, "UserId", "userFirstName", cartMaster.refUserId); return(View(cartMaster)); }
public CancelHistory() { InitializeComponent(); string localeCode = CommonUtil.GetAppLocaleCode(); // コンボボックスの初期化 InitCombo(SectionMaster.SelectIdAndNameSql(localeCode), this.comboReqSect); InitCombo(SectionMaster.SelectIdAndNameSql(localeCode), this.comboToSect); InitCombo(MuMaster.SelectIdAndNameSql(localeCode) + " ORDER BY mu_id", this.comboMu); InitCombo(CartMaster.SelectIdAndNameSql(localeCode), this.comboCart); // 検索条件を初期化 InitCondition(); }
// GET: User/CartManage/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CartMaster cartMaster = db.CartMasters.Find(id); if (cartMaster == null) { return(HttpNotFound()); } return(View(cartMaster)); }
// GET: User/CartManage/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CartMaster cartMaster = db.CartMasters.Find(id); if (cartMaster == null) { return(HttpNotFound()); } ViewBag.refProductId = new SelectList(db.ProductMasters, "ProductId", "ProductName", cartMaster.refProductId); ViewBag.refUserId = new SelectList(db.UserMasters, "UserId", "UserName", cartMaster.refUserId); return(View(cartMaster)); }
public ActionResult AddToCart(int id, int quantity) { CartMaster ct = new CartMaster(); ct.Date = DateTime.Now; ct.refProductId = id; ct.Qty = quantity; ct.refUserId = 1; db.CartMasters.Add(ct); db.SaveChanges(); return(View(ct)); }
private void SetData(CartMaster row) { bool isNew = false; if (row.cart_id != 0) { // 更新のとき 変更不可 this.cart_id.IsEnabled = false; // 削除を有効に this.deleteButton.IsEnabled = true; this.cart_id.Text = row.cart_id.ToString(); } else { // 新規のとき isNew = true; // 変更可 this.cart_id.IsEnabled = true; // 削除を無効に this.deleteButton.IsEnabled = false; this.cart_id.Text = ""; } this.cart_name_en.Text = row.cart_name_en; this.cart_name_jp.Text = row.cart_name_jp; this.cart_name_cn.Text = row.cart_name_cn; SelectComboByTag(this.cart_enable, row.cart_enable); this.cart_section_id.SelectedValue = row.cart_section_id; SelectTextBoxNumber(this.cart_sect_restrict_flg, row.cart_sect_restrict_flg, isNew); SelectTextBoxNumber(this.cart_dest_id, row.cart_dest_id, isNew); SelectTextBoxNumber(this.cart_dest_restrict_flg, row.cart_dest_restrict_flg, isNew); SelectTextBoxNumber(this.cart_use, row.cart_use, isNew); this.cart_key.Text = row.cart_key; SelectTextBoxNumber(this.cart_func, row.cart_func, isNew); }
/// <summary> /// オーダーIDからカートに変換 /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int order_id; string result_value = ""; if (this.GetInt(value, out order_id)) { // order_status_logのorder_log_idの一致する行でorder_log_datetimeが最新の行が対象 OrderStatusLog order_status_log = GetOrderStatusLog(order_id); if (order_status_log != null) { string localeCode = CommonUtil.GetAppLocaleCode(); // カート名を取得 string valueFieldName = "cart_name_" + localeCode; result_value = GetValue <string>(CartMaster.SelectNameSql(localeCode, order_status_log.order_log_cart_id.ToString()), valueFieldName); } } return(result_value); }
public async Task <ActionResult> AddProductToCart(string ProductId, string Quantity) { if (string.IsNullOrEmpty(ProductId)) { return(Json("Incomplete detail")); } if (Request.Cookies["UserSetting"] != null && !string.IsNullOrEmpty(Request.Cookies["UserSetting"]["Name"]) && !string.IsNullOrEmpty(Request.Cookies["UserSetting"]["Id"])) { //save product in db repository = new Repository(); var cartProd = new CartMaster { Pid = ProductId, Uid = Request.Cookies["UserSetting"]["Id"], Quantity = Convert.ToInt32(Quantity) }; var res = await repository.AddCartProduct(cartProd); if (res.Status) { return(Json(res.ResponseValue)); } else { return(Json("0")); } } else { //save product in cookie var count = AddProductIdToCartCookie(ProductId, Quantity); return(Json(count)); } }
/// <summary> /// 登録または更新ようにコントロールの値を行にを設定 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="row"></param> /// <param name="id"></param> protected override bool SetRowData(object t_row, int id) { bool bRet = true; CartMaster row = (CartMaster)t_row; row.cart_id = id; row.cart_name_en = this.cart_name_en.Text; row.cart_name_jp = this.cart_name_jp.Text; row.cart_name_cn = this.cart_name_cn.Text; row.cart_enable = (Int16)GetComboSelectedTagValue(this.cart_enable, 0); row.cart_section_id = GetComboSelectedValueAsInt(this.cart_section_id); row.cart_key = this.cart_key.Text; int cart_sect_restrict_flg; if (IsValidInt(this.cart_sect_restrict_flg.Text, Properties.Resources.CART_SECT_RESTRICT_FLG, out cart_sect_restrict_flg)) { row.cart_sect_restrict_flg = (Int16)cart_sect_restrict_flg; } else { bRet = false; } int cart_dest_id; if (IsValidInt(this.cart_dest_id.Text, Properties.Resources.CART_DEST_ID, out cart_dest_id)) { row.cart_dest_id = cart_dest_id; } else { bRet = false; } int cart_dest_restrict_flg; if (IsValidInt(this.cart_dest_restrict_flg.Text, Properties.Resources.CART_DEST_RESTRICT_FLG, out cart_dest_restrict_flg)) { row.cart_dest_restrict_flg = (Int16)cart_dest_restrict_flg; } else { bRet = false; } int cart_use; if (IsValidInt(this.cart_use.Text, Properties.Resources.CART_USE, out cart_use)) { row.cart_use = (Int16)cart_use; } else { bRet = false; } int cart_func; if (IsValidInt(this.cart_func.Text, Properties.Resources.CART_FUNC, out cart_func)) { row.cart_func = (Int16)cart_func; } else { bRet = false; } return(bRet); }
protected override void SetID(object t_row, int id) { CartMaster row = (CartMaster)t_row; row.cart_id = id; }