public IHttpActionResult PutShop(long id, Shop shop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shop.code) { return(BadRequest()); } ShopBLL.Entry(shop); try { Global.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ShopExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostShop(Shop shop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ShopBLL.Add(shop); try { Global.SaveChanges(); } catch (DbUpdateException) { if (ShopExists(shop.code)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = shop.code }, shop)); }
private void shopSaveButton_Click(object sender, EventArgs e) { aShop = new Shop(shopNameTextBox.Text, shopAddressTextBox.Text); aShopBll = new ShopBLL(); string msg = aShopBll.Save(aShop); MessageBox.Show(msg); }
protected void UpdateSortID(int id, int sortid) { ShopBLL spdll = new ShopBLL(); TShop tshop = spdll.GetShop(id); tshop.SortID = sortid; spdll.UpdateShop(tshop, id); }
public IHttpActionResult DeleteShop(long id) { if (ShopBLL.DeleteShop(id) == false) { return(NotFound()); } return(Ok()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Keyword = Server.UrlDecode(CommonLibrary.CommOperate.GetStrFromRequestQueryString("title")); ShopBLL sbll = new ShopBLL(); Response.Write(sbll.CheckTitle(Keyword).ToString().ToLower()); Response.End(); } }
public IHttpActionResult GetShop(long id) { ShopDTO shop = ShopBLL.GetShopById(id); if (shop == null) { return(NotFound()); } return(Ok(shop)); }
public IHttpActionResult PostShop(ShopDTO shop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ShopDTO s = ShopBLL.Add(shop); return(Ok(s)); }
public IHttpActionResult PutShop(long id, ShopDTO shop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shop.code) { return(BadRequest()); } ShopDTO updatedUser = ShopBLL.Entry(shop); return(Ok(updatedUser)); }
private bool CategoryExists(long id) { return(ShopBLL.ShopExists(id)); }
public void CenterThread(object obj) { object[] objs = (object[])obj; string threadName = (string)objs[0]; Thread tempThread = this.DictThread[threadName]; if (tempThread == null) { InsertListBox(string.Format("上报线程threadName【{0}】启动失败,请检查!", threadName)); LogUtil.WriteInfo(string.Format("上报线程threadName【{0}】启动失败,请检查!", threadName)); return; } else { InsertListBox(string.Format("上报线程threadName【{0}】启动成功!", threadName)); LogUtil.WriteInfo(string.Format("上报线程threadName【{0}】启动成功!", threadName)); } while (true) { try { switch (threadName) { case "ObtainBaiDuAddress1": /* case "ObtainBaiDuAddress2": * case "ObtainBaiDuAddress3": * case "ObtainBaiDuAddress4": * case "ObtainBaiDuAddress5":*/ //int num = int.Parse(threadName.Substring(threadName.Length - 1, 1)); //int sleepTime = num * 1000; endBaiDuAddress = ShopBLL.GetTopShopModel(); break; default: break; } if (endBaiDuAddress == 1) { InsertListBox("【执行完毕】。。。。。。。。"); break; } } catch (ThreadAbortException ex) { string logMg = string.Format("线程{0}:{1}", threadName, ex.Message); LogUtil.WriteInfo(logMg); InsertListBox(logMg); break; } catch (Exception ex) { if (ex.InnerException != null) { ex = ex.InnerException.GetBaseException(); } string logMg = string.Format("线程{0}执行失败 {1} {2}", threadName, ex.Message, ex.StackTrace); LogUtil.WriteInfo(logMg); InsertListBox(string.Format("{0} {1}", DateTime.Now.ToString(), logMg)); tempThread.Join(1000); continue; } tempThread.Join(1000); } }
// GET: api/Shops public IHttpActionResult GetShops() { return(Ok(ShopBLL.GetShops())); }
protected void Button1_Click(object sender, EventArgs e) { #region 变量 string ShopTitle = tbx_title.Text.Trim(); string ShopETitle = Tbx_Identifier.Text.Trim(); string ShopPic = CommonLibrary.CommOperate.GetStrFromRequestForm("CatePic"); string ShopMemo = ContentHolder.Value; string ShopProvince = CommonLibrary.CommOperate.GetStrFromRequestForm("Sel_Province"); if (ShopProvince.Equals("-1")) { CommonLibrary.RunJs.AlertAndBack("请选择省"); } string ShopCity = CommonLibrary.CommOperate.GetStrFromRequestForm("Sel_City"); if (ShopCity.Equals("-1")) { CommonLibrary.RunJs.AlertAndBack("请选择市"); } string ShopArea = CommonLibrary.CommOperate.GetStrFromRequestForm("Sel_Area"); if (ShopArea.Equals("-1")) { CommonLibrary.RunJs.AlertAndBack("请选择区"); } string ShopLongitude = tbx_ShopLongitude.Text.Trim(); //经度 string ShopLatitude = tbx_ShopLatitude.Text.Trim(); //纬度 string ShopRoute = tbx_ShopRoute.Text.Trim(); //交通路线 string ShopOpenTime = tbx_ShopOpenTime.Text.Trim(); //开业时间 string ShopTemplate = Tbx_ShopTemplate.Text.Trim(); //商场模板 DateTime ShopAddtime; DateTime.TryParse(Tbx_Addtime.Text.Trim(), out ShopAddtime); string ShopAdder = H_Adder.Value; int SortID = 0; Int32.TryParse(tbx_SortId.Text, out SortID); bool IsRecom = false; bool.TryParse(CommonLibrary.CommOperate.GetStrFromRequestForm("Chk_tuijian"), out IsRecom); bool IsHtml = false; string HtmlPath = Tbx_htmlpath.Text.Trim(); bool IsRemote = false;//是否远程,获取图片,默认为否 bool.TryParse(CommonLibrary.CommOperate.GetStrFromRequestForm("Chk_Remote"), out IsRemote); #endregion TShop ts = new TShop(); ts.ShopTitle = ShopTitle; ts.ShopETitle = ShopETitle; ts.ShopPic = ShopPic; if (IsRemote == true) { ts.ShopMemo = ImageOperate.GetRemoteImage(ShopMemo, "/uploadfile/remote/"); } else { ts.ShopMemo = ShopMemo; } ts.ShopProvince = ShopProvince; ts.ShopCity = ShopCity; ts.ShopArea = ShopArea; ts.ShopLongitude = ShopLongitude; ts.ShopLatitude = ShopLatitude; ts.ShopRoute = ShopRoute; ts.ShopOpenTime = ShopOpenTime; ts.ShopTemplate = ShopTemplate; ts.ShopAddtime = ShopAddtime; ts.ShopAdder = ShopAdder; ts.SortID = SortID; ts.IsRecom = IsRecom; ts.IsHtml = IsHtml; ts.HtmlPath = HtmlPath; ts.IsRemote = IsRemote; TBLL.ShopBLL shopbll = new ShopBLL(); shopbll.AddShop(ts); int lastid = shopbll.GetLastShopID(); CommonLibrary.RunJs.PageReplace("Shop_UpdateManage.aspx?LastID=" + lastid); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int infoid = 0; Int32.TryParse(CommonLibrary.CommOperate.GetStrFromRequestQueryString("id"), out infoid); TInformation tinfo = new TInformation(); InfoBLL infobll = new InfoBLL(); AdminBLL adinbll = new AdminBLL(); tinfo = infobll.GetInfo(infoid); tbx_title.Text = tinfo.InfoTitle; Tbx_SubMemo.Text = tinfo.InfoSubMemo; ContentHolder.Value = tinfo.InfoMemo; #region 图片列表 L_selpic.Text = ImageOperate.GetImageSelect(tinfo.InfoMemo, tinfo.InfoPic); #endregion #region 信息类型 if (tinfo.InfoType == 1) { L_selinfotype.Text = "<select id='sel_SelInfoType' name='sel_SelInfoType' > <option value=\"1\" selected=selected> 新闻 </option> <option value=\"2\"> 产品 </option></select>"; } else if (tinfo.InfoType == 2) { L_selinfotype.Text = "<select id='sel_SelInfoType' name='sel_SelInfoType' > <option value=\"1\" > 新闻 </option> <option value=\"2\" selected=selected> 产品</option></select>"; //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "InitInfoType", "$('.dazhe').hide();", true); L_js.Text = @"<script type='text/javascript'> $(document).ready( function() { $('.dazhe').hide();} ); </script>"; } #endregion #region 商家id int shopid = tinfo.ShopID; L_shopid.Text = "<input type=\"hidden\" id=\"h_shopid\" name=\"h_shopid\" value=\"" + shopid + "\"/>"; if (shopid == -1) { tbx_ShopID.Text = "暂无商家"; } else { ShopBLL shopbll = new ShopBLL(); tbx_ShopID.Text = shopbll.GetShop(shopid).ShopTitle; } #endregion #region 品牌信息 int brandid = tinfo.BrandID; L_brandid.Text = "<input type=\"hidden\" id=\"h_brandid\" name=\"h_brandid\" value=\"" + brandid + "\"/>"; if (brandid == -1) { tbx_brand.Text = "暂无品牌信息"; } else { BrandBLL brandbll = new BrandBLL(); tbx_brand.Text = brandbll.GetBrandByID(brandid).BrandName; } #endregion tbx_SortId.Text = tinfo.SortID.ToString(); tbx_Etitle.Text = tinfo.InfoETitle; Tbx_modifier.Text = this.LoginUser.Admin_RealName; H_Modifier.Value = LoginUser.Admin_ID.ToString(); Tbx_modifytime.Text = tinfo.ModifyTime.ToString("yyyy-MM-dd hh:mm:ss"); //Tbx_Adder.Text = this.LoginUser.Admin_RealName; //H_Adder.Value = LoginUser.Admin_ID.ToString(); int Adder = 0; Int32.TryParse(tinfo.InfoAdder, out Adder); Tbx_Adder.Text = adinbll.GetAdmin(Adder).Admin_RealName; H_Adder.Value = Adder.ToString(); Tbx_BeginTime.Text = tinfo.InfoStartTime; Tbx_EndTime.Text = tinfo.InfoEndTime; Tbx_from.Text = tinfo.InfoFrom; Tbx_Addtime.Text = tinfo.InfoAddTime.ToString("yyyy-MM-dd hh:mm:ss"); Tbx_clicknum.Text = tinfo.InfoClicks.ToString(); if (tinfo.IsRecom == true) { L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\" Checked=Checked value=\"true\" />"; } else { L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\" value=\"true\" />"; } if (tinfo.IsRemote == true) { L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" Checked=Checked />"; } else { L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" />"; } Tbx_tag.Text = tinfo.InfoTag; NodeBLL nodebll = new NodeBLL(); DataTable dt = nodebll.GetAllNode(); L_CateTree.Text = "<select id='sel' name='sel'><option value='-1'>请选择类别...</option>"; if (dt.Rows.Count > 0) { L_CateTree.Text += tool.NodeTree.GetNodeTree(dt, 0, 0, tinfo.InfoCateID); } L_CateTree.Text += "</Select>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int shopid = 0; Int32.TryParse(CommonLibrary.CommOperate.GetStrFromRequestQueryString("id"), out shopid); TShop tshop = new TShop(); ShopBLL spbll = new ShopBLL(); tshop = spbll.GetShop(shopid); tbx_title.Text = tshop.ShopTitle; Tbx_Identifier.Text = tshop.ShopETitle; ContentHolder.Value = tshop.ShopMemo; tbx_ShopLongitude.Text = tshop.ShopLongitude; tbx_ShopLatitude.Text = tshop.ShopLatitude; tbx_ShopRoute.Text = tshop.ShopRoute; tbx_ShopOpenTime.Text = tshop.ShopOpenTime; Tbx_ShopTemplate.Text = tshop.ShopTemplate; Tbx_Addtime.Text = tshop.ShopAddtime.ToString("yyyy-MM-dd hh:mm:ss"); Tbx_Adder.Text = this.LoginUser.Admin_RealName; H_Adder.Value = LoginUser.Admin_ID.ToString(); tbx_SortId.Text = tshop.SortID.ToString(); if (tshop.IsRecom == true) { L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\" Checked=Checked value=\"true\" />"; } else { L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\" value=\"true\" />"; } Tbx_htmlpath.Text = tshop.HtmlPath; #region 省 市 地区 string ShopProvince = string.Empty; ShopProvince = tshop.ShopProvince; string ShopCity = string.Empty; ShopCity = tshop.ShopCity; string ShopArea = string.Empty; ShopArea = tshop.ShopArea; AddressBLL addbll = new AddressBLL(); StringBuilder sb = new StringBuilder(); #region 省 using (DataTable dtprovince = addbll.GetAllProvince()) { sb.Append("<option value=\"-1\">请选择...</option"); if (dtprovince.Rows.Count > 0) { for (int i = 0; i < dtprovince.Rows.Count; i++) { if (dtprovince.Rows[i]["code"].ToString().Equals(ShopProvince)) { sb.Append("<option value='" + dtprovince.Rows[i]["code"] + "' selected=selected>" + dtprovince.Rows[i]["name"] + "</option>"); } else { sb.Append("<option value='" + dtprovince.Rows[i]["code"] + "'>" + dtprovince.Rows[i]["name"] + "</option>"); } } } } L_province.Text = sb.ToString(); sb.Length = 0; #endregion #region 市 using (DataTable dtcity = addbll.GetCityByProvince(ShopProvince)) { sb.Append("<option value='-1'>市</option>"); if (dtcity.Rows.Count > 0) { for (int i = 0; i < dtcity.Rows.Count; i++) { if (dtcity.Rows[i]["code"].ToString().Equals(ShopCity)) { sb.Append("<option value='" + dtcity.Rows[i]["code"].ToString() + "' selected=selected>" + dtcity.Rows[i]["name"].ToString() + "</option>"); } else { sb.Append("<option value='" + dtcity.Rows[i]["code"].ToString() + "'>" + dtcity.Rows[i]["name"].ToString() + "</option>"); } } } } L_City.Text = sb.ToString(); #endregion sb.Length = 0; #region 地区 using (DataTable dtarea = addbll.GetAreaByCity(ShopCity)) { sb.Append("<option value='-1'>地区</option>"); for (int i = 0; i < dtarea.Rows.Count; i++) { if (dtarea.Rows[i]["code"].ToString().Equals(ShopArea)) { sb.Append("<option value='" + dtarea.Rows[i]["code"].ToString() + "' selected=selected>" + dtarea.Rows[i]["name"].ToString() + "</option>"); } else { sb.Append("<option value='" + dtarea.Rows[i]["code"].ToString() + "' >" + dtarea.Rows[i]["name"].ToString() + "</option>"); } } } L_Area.Text = sb.ToString(); #endregion #endregion #region 是否获取远程图片 if (tshop.IsRemote == true) { L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" Checked=Checked />"; } else { L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" />"; } #endregion #region 图片列表 L_selpic.Text = ImageOperate.GetImageSelect(tshop.ShopMemo, tshop.ShopPic); #endregion } }