public int UpPageAreaStatus(PageArea model) { try { return _beradao.UpPageAreaStatus(model); } catch (Exception ex) { throw new Exception("PageAreaMgr-->UpPageAreaStatus-->" + ex.Message, ex); } }
/// <summary> /// 保存新增區域數據 /// </summary> /// <param name="ba"></param> /// <returns></returns> public int AreaSave(PageArea ba) { try { return _beradao.AreaSave(ba); } catch (Exception ex) { throw new Exception("BannerAreaMgr-->AreaSave-->" + ex.Message, ex); } }
public JsonResult UpdatePageAreaActive() { string jsonStr = string.Empty; try { _pageAreaMgr = new PageAreaMgr(mySqlConnectionString); int id = Convert.ToInt32(Request.Params["id"]); PageArea model = new PageArea(); model.area_id = id; model = _pageAreaMgr.GetModel(model); int statusValue = Convert.ToInt32(Request.Params["active"]); model.area_id = id; model.area_status = statusValue; model.update_userid = int.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); model.area_updatedate = DateTime.Now; if (_pageAreaMgr.UpPageAreaStatus(model) > 0) { return Json(new { success = "true" }); } else { return Json(new { success = "false" }); } } 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); return Json(new { success = "false" }); } }
public int UpPageAreaStatus(PageArea model) { model.Replace4MySQL(); StringBuilder sb = new StringBuilder(); try { sb.AppendFormat("update page_area set area_status={0},area_updatedate='{1}',update_userid={2} where area_id={3} ", model.area_status, CommonFunction.DateTimeToString(model.area_updatedate), model.update_userid, model.area_id); return _access.execCommand(sb.ToString()); } catch (Exception ex) { throw new Exception("PageAreaDao.UpPageAreaStatus-->" + ex.Message + sb.ToString(), ex); } }
/// <summary> /// 保存新增區域數據 /// </summary> /// <param name="ba"></param> /// <returns></returns> public int AreaSave(PageArea ba) { ba.Replace4MySQL(); StringBuilder strSql = new StringBuilder(); try { strSql.AppendFormat("insert into page_area (area_name,area_status,area_createdate,area_updatedate,update_userid,create_userid,area_desc,area_element_id,show_number,element_type)value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", ba.area_name, ba.area_status, ba.area_createdate.ToString("yyyy-MM-dd HH:mm:ss"), ba.area_updatedate.ToString("yyyy-MM-dd HH:mm:ss"), ba.update_userid, ba.create_userid, ba.area_desc, ba.area_element_id, ba.show_number, ba.element_type); return _access.execCommand(strSql.ToString()); } catch (Exception ex) { throw new Exception("BannerArea.Dao-->AreaSave-->" + ex.Message + strSql.ToString(), ex); } }
public PageArea GetModel(PageArea model) { model.Replace4MySQL(); StringBuilder sb = new StringBuilder(); try { sb.Append(@"select area_id,area_name,area_desc,element_type,area_element_id,show_number,area_status,area_createdate,area_updatedate,create_userid,update_userid "); sb.AppendFormat(@"from page_area where area_id ={0}", model.area_id); return _access.getSinggleObj<PageArea>(sb.ToString()); } catch (Exception ex) { throw new Exception("BannerArea.GetModel-->" + ex.Message + sb.ToString(), ex); } }