/// <summary> /// 訂便當-查詢店家詳細資料 /// </summary> /// 2018/1/10 By Dean_Chiang /// <returns></returns> public ActionResult ReadDetailOrderStore(string storeId) { using (OrderStoreDac dac = new OrderStoreDac()) { OrderStoreModel model = dac.GetStoreByStoreId(storeId); return(View(model)); } }
public ActionResult EditOrderStore(OrderStoreModel model) { using (OrderStoreDac dac = new OrderStoreDac()) { int UpdateResult = dac.UpdateStore(model); return(RedirectToAction("EditOrderStore", "OrderStore", new { storeId = model.STORE_ID.ToString() })); } }
public ActionResult CreateOrderStore(OrderStoreModel model) { if (ModelState.IsValid) { using (OrderStoreDac dac = new OrderStoreDac()) { int InsertResult = dac.InsertStore(model); return(RedirectToAction("CreateOrderStore", "OrderStore")); } } return(View(model)); }
/// <summary> /// 訂便當-修改店家 /// </summary> /// 2018/1/11 By Dean_Chiang /// <returns></returns> public ActionResult EditOrderStore(string storeId) { using (OrderStoreDac dac = new OrderStoreDac()) { SelectList LIST_STORE_SUB = new SelectList(dac.GetDrowDown("SubType"), "DROP_VALUE", "DROP_NAME"); SelectList LIST_STORE_STATUS = new SelectList(dac.GetDrowDown("StoreStatus"), "DROP_VALUE", "DROP_NAME"); SelectList LIST_STORE_TYPE = new SelectList(dac.GetDrowDown("StoreType"), "DROP_VALUE", "DROP_NAME"); SelectList LIST_STORE_DELIVERY = new SelectList(dac.GetDrowDown("StoreDelivery"), "DROP_VALUE", "DROP_NAME"); ViewBag.STORE_SUB = LIST_STORE_SUB; ViewBag.STORE_STATUS = LIST_STORE_STATUS; ViewBag.STORE_TYPE = LIST_STORE_TYPE; ViewBag.STORE_DELIVERY = LIST_STORE_DELIVERY; OrderStoreModel model = dac.GetStoreByStoreId(storeId); return(View(model)); } }
/// <summary> /// 2018/1/10 By Dean_Chiang /// </summary> public int InsertStore(OrderStoreModel model) { using (TransactionScope scope = new TransactionScope()) { try { sbSql.Clear(); sbSql.AppendLine(@" INSERT INTO OrderFoodStore VALUES ( {0} --[STORE_NAME] ,{1}--[STORE_STATUS] ,{2}--[STORE_TYPE] ,{3}--[STORE_COST] ,{4}--[STORE_DELIVERY] ,{5}--[STORE_COPIES] ,0--[STORE_BLICKLIST] ,0--[STORE_FREQ] ,''--[STORE_FINALDATE] ,{6}--[STORE_TEL1] ,{7}--[STORE_TEL2] ,{8}--[STORE_ADDRESS] ,{9}--[STORE_SUB] ,{10}--[STORE_MENUURL] ,N'蔣定文'--[STORE_SIGNNAME] ,GETDATE()--[STORE_SIGNDATE] ,{11}--[STORE_REMARK] ) "); int result = ExecuteNoQuery(dc, sbSql.ToString(), model.STORE_NAME, model.STORE_STATUS, model.STORE_TYPE, model.STORE_COST , model.STORE_DELIVERY, model.STORE_COPIES, model.STORE_TEL1, model.STORE_TEL2, model.STORE_ADDRESS , model.STORE_SUB, model.STORE_MENUURL, model.STORE_REMARK ); scope.Complete(); return(result); } catch (Exception) { return(0); } } }
/// <summary> /// 2018/1/11 By Dean_Chiang /// </summary> public int UpdateStore(OrderStoreModel model) { using (TransactionScope scope = new TransactionScope()) { try { sbSql.Clear(); sbSql.AppendLine(@" UPDATE OrderFoodStore SET [STORE_NAME]={0}--[STORE_NAME] ,[STORE_STATUS]={1}--[STORE_STATUS] ,[STORE_TYPE]= {2}--[STORE_TYPE] ,[STORE_COST]={3}--[STORE_COST] ,[STORE_DELIVERY]={4}--[STORE_DELIVERY] ,[STORE_COPIES]={5}--[STORE_COPIES] ,[STORE_TEL1]={6}--[STORE_TEL1] ,[STORE_TEL2]={7}--[STORE_TEL2] ,[STORE_ADDRESS]={8}--[STORE_ADDRESS] ,[STORE_SUB]={9}--[STORE_SUB] ,[STORE_MENUURL]={10}--[STORE_MENUURL] ,[STORE_REMARK]={11}--[STORE_REMARK] WHERE STORE_ID={12} "); int result = ExecuteNoQuery(dc, sbSql.ToString(), model.STORE_NAME, model.STORE_STATUS, model.STORE_TYPE, model.STORE_COST, model.STORE_DELIVERY, model.STORE_COPIES , model.STORE_TEL1, model.STORE_TEL2, model.STORE_ADDRESS, model.STORE_SUB, model.STORE_MENUURL, model.STORE_REMARK, model.STORE_ID ); scope.Complete(); return(result); } catch (Exception) { return(0); } } }