public int UpSiteStatus(SiteModel site) { try { return _siteDao.UpSiteStatus(site); } catch (Exception ex) { throw new Exception("SiteMgr-->upSiteStatus-->" + ex.Message, ex); } }
public int InsertSite(SiteModel site) { try { return _siteDao.InsertSite(site); } catch (Exception ex) { throw new Exception("SiteMgr-->InsertSite-->" + ex.Message, ex); } }
public int UpSiteStatus(SiteModel site) { site.Replace4MySQL(); StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"update site set site_status='{0}',site_updatedate='{1}'", site.site_status, site.site_updatedate.ToString("yyyy-MM-dd HH:mm:ss")); sb.AppendFormat(@",update_userid='{0}' where site_id='{1}'", site.update_userid, site.site_id); return _access.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("SiteDao-->UpSiteStatus-->" + ex.Message + sb.ToString(), ex); } }
public int UpSite(SiteModel site) { site.Replace4MySQL(); StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"update site SET site_name='{0}',domain='{1}',cart_delivery='{2}'", site.site_name, site.domain, site.cart_delivery); sb.AppendFormat(@",max_user='******',page_location='{1}'", site.max_user, site.page_location); sb.AppendFormat(",site_updatedate='{0}',update_userid='{1}'", site.site_updatedate.ToString("yyyy-MM-dd HH:mm:ss"), site.update_userid); sb.AppendFormat(" where site_id='{0}'", site.site_id); return _access.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("SiteDao-->UpSite-->" + ex.Message + sb.ToString(), ex); } }
/// <summary> /// 添加站臺信息 /// </summary> /// <param name="site"></param> /// <returns>int</returns> public int InsertSite(SiteModel site) { site.Replace4MySQL(); StringBuilder sb = new StringBuilder(); try { sb.AppendFormat(@"insert into site(site_name,domain,cart_delivery,online_user"); sb.AppendFormat(@",max_user,page_location,site_status,site_createdate,site_updatedate,"); sb.AppendFormat(@"create_userid,update_userid)VALUES("); sb.AppendFormat(@"'{0}','{1}','{2}','{3}',", site.site_name, site.domain, site.cart_delivery, site.online_user); sb.AppendFormat(@"'{0}','{1}','{2}','{3}'", site.max_user, site.page_location, site.site_status, site.site_createdate.ToString("yyyy-MM-dd HH:mm:ss")); sb.AppendFormat(@",'{0}','{1}','{2}')", site.site_updatedate.ToString("yyyy-MM-dd HH:mm:ss"), site.create_userid, site.update_userid); return _access.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("SiteDao-->InsertSite-->" + ex.Message + sb.ToString(), ex); } }
/// <summary> ///修改站臺狀態 /// </summary> /// <returns></returns> public JsonResult UpdateSiteState() { uint id = Convert.ToUInt32(Request.Params["id"]); int activeValue = Convert.ToInt32(Request.Params["active"]); SiteModel site = new SiteModel(); site.site_id = id; site.site_status = activeValue; site.site_updatedate = DateTime.Now; site.update_userid = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); _siteMgr = new SiteMgr(mySqlConnectionString); if (_siteMgr.UpSiteStatus(site) > 0) { return Json(new { success = "true", msg = "" }); } else { return Json(new { success = "false", msg = "" }); } }
/// <summary> /// 保存站臺信息 /// </summary> /// <returns></returns> public HttpResponseBase SaveSiteInfo() { string json = string.Empty; SiteModel query = new SiteModel(); query.site_name = Request.Params["site_name"]; query.domain = Request.Params["domain"]; query.cart_delivery = uint.Parse(Request.Params["cart_delivery"].ToString()); query.max_user = int.Parse(Request.Params["max_user"].ToString()); //query.online_user = int.Parse(Request.Params["online_user"].ToString()); query.page_location = Request.Params["page_location"]; query.site_status = 0; query.update_userid = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); try { if (!string.IsNullOrEmpty(Request.Params["site_id"]))//修改 { query.site_id = uint.Parse(Request.Params["site_id"].ToString()); query.site_updatedate = DateTime.Now; _siteMgr = new SiteMgr(mySqlConnectionString); _siteMgr.UpSite(query); } else//新增 { query.site_createdate = DateTime.Now; query.site_updatedate = query.site_createdate; query.create_userid = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); _siteMgr = new SiteMgr(mySqlConnectionString); _siteMgr.InsertSite(query); } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; //listUser是准备转换的对象 json = "{success:true,msg:\"" + "" + "\"}"; //返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:\"" + ex.Message + "\"}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }