protected void Page_Load(object sender, EventArgs e) { userId = Convert.ToInt32(Session["UserID"]); userName = Session["UserName"].ToString(); itemTypeList = bll.GetItemTypeList(); catTypeList = cat_bll.GetUserCategoryList(userId); zhuanTiList = zt_bll.GetZhuanTiList(userId); cardList = card_bll.GetCardList(userId); }
private void PupolateControls() { int userId = 0; if (Request.QueryString["userId"] != "" && Request.QueryString["userId"] != null) { userId = Convert.ToInt32(Request.QueryString["userId"]); } DataTable user = user_bll.GetUserDataTableByUserId(userId); UserList.DataSource = user; UserList.DataBind(); OAuthList.DataSource = oauth_bll.GetOAuthListDataTableByUserId(userId); OAuthList.DataBind(); int categoryRate = Convert.ToInt32(user.Rows[0]["CategoryRate"]); UserCategoryList.DataSource = cat_bll.GetUserCategoryList(userId, categoryRate); UserCategoryList.DataBind(); ZhuanTiList.DataSource = zt_bll.GetZhuanTiList(userId); ZhuanTiList.DataBind(); CardList.DataSource = card_bll.GetCardList(userId); CardList.DataBind(); List.DataSource = bll.GetItemListByUserId(userId); List.DataBind(); }
//初始列表 private void BindGrid() { int categoryRate = Convert.ToInt32(Session["CategoryRate"]); DataTable catTypeList = bll.GetUserCategoryList(userId, categoryRate); this.CatTypeList.DataSource = catTypeList; this.CatTypeList.DataBind(); }
//初始列表 private void BindGrid() { int categoryRate = Convert.ToInt32(Session["CategoryRate"]); DataTable catTypeList = bll.GetUserCategoryList(userId, categoryRate); this.CatTypeList.DataSource = catTypeList; this.CatTypeList.DataBind(); this.CatIdEmpIns.Text = (catTypeList.Rows.Count + 1).ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int userId = Convert.ToInt32(Session["UserID"]); DataTable catTypeList = cat_bll.GetUserCategoryList(userId); this.CatTypeList.DataSource = catTypeList; this.CatTypeList.DataBind(); //商品类别 this.CategoryTypeDown.DataSource = catTypeList; this.CategoryTypeDown.DataTextField = "CategoryTypeName"; this.CategoryTypeDown.DataValueField = "CategoryTypeID"; this.CategoryTypeDown.DataBind(); this.CategoryTypeDown.Items.Insert(0, new ListItem("请选择", "0")); //专题 this.ZhuanTiDown.DataSource = zt_bll.GetZhuanTiList(userId); this.ZhuanTiDown.DataTextField = "ZhuanTiName"; this.ZhuanTiDown.DataValueField = "ZTID"; this.ZhuanTiDown.DataBind(); this.ZhuanTiDown.Items.Insert(0, new ListItem("请选择", "0")); //设置只读 this.ItemType.Attributes.Add("readonly", "readonly"); this.CategoryTypeDown.Attributes.Add("readonly", "readonly"); this.ItemBuyDate.Attributes.Add("readonly", "readonly"); if (Session["TodayDate"] != null) { string today = Session["TodayDate"].ToString(); string today2 = Convert.ToDateTime(today).AddMonths(11).ToString("yyyy-MM-dd"); this.ItemBuyDate.Text = today + " " + ItemHelper.GetWeekString(today, 0); this.ItemBuyDateHid.Value = today; this.ItemBuyDate1.Text = today; this.ItemBuyDate2.Text = today2; } //钱包 this.CardDown.DataSource = card_bll.GetCardList(userId); this.CardDown.DataTextField = "CardName"; this.CardDown.DataValueField = "CDID"; this.CardDown.DataBind(); if (Request.Cookies["CardID"] != null) { string cardId = Request.Cookies["CardID"].Value; this.CardDown.SelectedValue = cardId; } } }
protected void Page_Load(object sender, EventArgs e) { userId = Convert.ToInt32(Session["UserID"]); userName = Session["UserName"].ToString(); itemTypeList = bll.GetItemTypeList(); catTypeList = cat_bll.GetUserCategoryList(userId); zhuanTiList = zt_bll.GetZhuanTiList(userId); cardList = card_bll.GetCardList(userId); if (!IsPostBack) { this.ItemBuyDate1.Attributes.Add("readonly", "readonly"); this.ItemBuyDate2.Attributes.Add("readonly", "readonly"); string today = DateTime.Now.ToString("yyyy-MM-dd"); string first = DateHelper.GetMonthFirst(DateTime.Now).ToString("yyyy-MM-dd"); this.ItemBuyDate1.Text = first; this.ItemBuyDate2.Text = today; } }
public string GetCategoryType(string userId, int categoryRate) { UserCategoryTableBLL bll = new UserCategoryTableBLL(); var lists = bll.GetUserCategoryList(1, categoryRate); var results = new List <dynamic>(); foreach (DataRow row in lists.Rows) { dynamic model = new ExpandoObject(); model.value = row["CategoryTypeID"].ToString(); model.text = row["CategoryTypeName"].ToString(); results.Add(model); } return(Newtonsoft.Json.JsonConvert.SerializeObject(results)); }
protected void Page_Load(object sender, EventArgs e) { userId = Convert.ToInt32(Session["UserID"]); curDate = Utility.GetRequestDate(Request.QueryString["date"]).ToString("yyyy-MM-dd"); showType = Request.QueryString["showType"] ?? "m"; itemType = Request.QueryString["itemType"] ?? ""; regionType = Request.QueryString["regionType"] ?? "null"; catId = Request.QueryString["catId"] ?? ""; ztId = Request.QueryString["ztId"] ?? "null"; cardId = Request.QueryString["cardId"] ?? ""; recommend = Request.QueryString["recommend"] ?? "null"; keywords = Request.QueryString["keywords"] ?? ""; sort = Request.QueryString["sort"] ?? "ItemBuyDate"; by = Request.QueryString["by"] ?? "desc"; this.sortHid.Value = (by == "desc" ? "asc" : "desc"); catTypeList = CacheHelper.GetFromCache("cattypeedit", cat_bll.GetUserCategoryList(userId)); itemTypeList = CacheHelper.GetFromCache("itemtypeedit", bll.GetItemTypeList()); cardList = CacheHelper.GetFromCache("cardlistedit", card_bll.GetCardList(userId)); ztList = CacheHelper.GetFromCache("ztlistedit", zt_bll.GetZhuanTiList(userId)); if (!IsPostBack) { BindShowTypeDropDown(); BindItemGrid(); BindItemTypeListBox(); BindCategoryTypeListBox(); BindRegionTypeListBox(); BindZhuanTiListBox(); BindCardListBox(); BindRecommendListBox(); GetQueryInfo(); } }
protected void Page_Load(object sender, EventArgs e) { userId = Convert.ToInt32(Session["UserID"]); ztId = Convert.ToInt32(Request.QueryString["ztid"]); catTypeList = cat_bll.GetUserCategoryList(userId); itemTypeList = item_bll.GetItemTypeList(); cardList = card_bll.GetCardList(userId); if (!IsPostBack) { BindGrid(); BindInsert(); if (Session["TodayDate"] != null) { string today = Session["TodayDate"].ToString(); this.ItemBuyDateEmpIns.Text = today; } } }
protected void Page_Load(object sender, EventArgs e) { userId = Convert.ToInt32(Session["UserID"]); today = Utility.GetRequestDate(Request.QueryString["date"]); catTypeList = cat_bll.GetUserCategoryList(userId); itemTypeList = bll.GetItemTypeList(); cardList = card_bll.GetCardList(userId); if (!IsPostBack) { BindGrid(); BindTotal(); BindInsert(); //专题 this.ZhuanTiDown.DataSource = zt_bll.GetZhuanTiList(userId); this.ZhuanTiDown.DataTextField = "ZhuanTiName"; this.ZhuanTiDown.DataValueField = "ZTID"; this.ZhuanTiDown.DataBind(); this.ZhuanTiDown.Items.Insert(0, new ListItem("请选择", "0")); } }
//导出数据到App protected void Button1_Click(object sender, EventArgs e) { string strUserId = this.UserIDBox.Text.Trim(); if (strUserId == "") { Utility.Alert(this, "用户ID不能为空!"); return; } int userId = Convert.ToInt32(strUserId); UserInfo user = user_bll.GetUserByUserId(userId); string fileName = "aalife2(" + user.UserID + user.UserName + ").bak"; StringBuilder sb = new StringBuilder(); //备份用户表 if (user.UserID > 0) { decimal userMoney = user.UserMoney; if (user.IsUpdate == 1) { userMoney = user.MoneyStart; } string result = "{"; result += "\"userid\":\"" + user.UserID + "\","; result += "\"username\":\"" + user.UserName + "\","; result += "\"userpass\":\"" + user.UserPassword + "\","; result += "\"usernickname\":\"" + user.UserNickName + "\","; result += "\"createdate\":\"" + user.CreateDate.ToString("yyyy-MM-dd") + "\","; result += "\"useremail\":\"" + user.UserEmail + "\","; result += "\"userphone\":\"" + user.UserPhone + "\","; result += "\"userimage\":\"" + user.UserImage + "\","; result += "\"userworkday\":\"" + user.UserWorkDay + "\","; result += "\"usermoney\":\"" + userMoney + "\","; result += "\"categoryrate\":\"" + user.CategoryRate + "\","; result += "\"login\":\"true\","; OAuthInfo oauth = oauth_bll.GetOAuthByUserId(user.UserID); if (oauth.OAuthBound == 0) { result += "\"userbound\":\"0\""; } else { result += "\"userbound\":\"1\""; } result += "}"; sb.AppendLine(result); sb.AppendLine(""); } //备份消费表 DataTable itemListTab = bll.GetItemListByUserId(userId); if (itemListTab.Rows.Count > 0) { sb.AppendLine("DELETE FROM ItemTable;"); for (int i = itemListTab.Rows.Count - 1; i >= 0; i--) { DataRow dr = itemListTab.Rows[i]; sb.AppendLine("INSERT INTO ItemTable (ItemWebID, ItemName, ItemPrice, ItemBuyDate, CategoryID, Recommend, Synchronize, RegionID, RegionType, ItemType, ZhuanTiID, CardID) VALUES ('" + dr["ItemID"].ToString() + "', '" + Utility.ReplaceSql(dr["ItemName"].ToString()) + "', '" + dr["ItemPrice"].ToString() + "', '" + String.Format("{0:yyyy-MM-dd}", dr["ItemBuyDate"]) + "', '" + dr["CategoryTypeID"].ToString() + "', '" + dr["Recommend"].ToString() + "', '0', '" + dr["RegionID"].ToString() + "', '" + dr["RegionType"].ToString() + "', '" + dr["ItemType"].ToString() + "', '" + dr["ZhuanTiID"].ToString() + "', '" + dr["CardID"].ToString() + "');"); } sb.AppendLine(""); } //备份类别表 DataTable catListTab = cat_bll.GetUserCategoryList(userId); if (catListTab.Rows.Count > 0) { sb.AppendLine("DELETE FROM CategoryTable;"); foreach (DataRow dr in catListTab.Rows) { sb.AppendLine("INSERT INTO CategoryTable (CategoryID, CategoryName, CategoryPrice, CategoryRank, CategoryDisplay, CategoryLive, Synchronize) VALUES ('" + dr["CategoryTypeID"].ToString() + "', '" + Utility.ReplaceSql(dr["CategoryTypeName"].ToString()) + "', '" + dr["CategoryTypePrice"].ToString() + "', '" + dr["CategoryTypeID"].ToString() + "', '" + dr["CategoryTypeLive"].ToString() + "', '" + dr["CategoryTypeLive"].ToString() + "', '0');"); } sb.AppendLine(""); } //备份专题表 DataTable zhuanTiTab = zt_bll.GetZhuanTiList(userId); if (zhuanTiTab.Rows.Count > 0) { sb.AppendLine("DELETE FROM ZhuanTiTable;"); foreach (DataRow dr in zhuanTiTab.Rows) { sb.AppendLine("INSERT INTO ZhuanTiTable (ZTID, ZhuanTiName, ZhuanTiImage, ZhuanTiLive, Synchronize) VALUES ('" + dr["ZTID"].ToString() + "', '" + Utility.ReplaceSql(dr["ZhuanTiName"].ToString()) + "', '" + dr["ZhuanTiImage"].ToString() + "', '" + dr["ZhuanTiLive"].ToString() + "', '0');"); } sb.AppendLine(""); } //备份转账表 DataTable zhangTab = zz_bll.GetZhuanZhangList(userId); if (zhangTab.Rows.Count > 0) { sb.AppendLine("DELETE FROM ZhuanZhangTable;"); foreach (DataRow dr in zhangTab.Rows) { sb.AppendLine("INSERT INTO ZhuanZhangTable (ZZID, ZhangFrom, ZhangTo, ZhangMoney, ZhangDate, ZhangNote, ZhangLive, Synchronize) VALUES ('" + dr["ZZID"].ToString() + "', '" + dr["ZhuanZhangFrom"].ToString() + "', '" + dr["ZhuanZhangTo"].ToString() + "', '" + dr["ZhuanZhangMoney"].ToString() + "', '" + String.Format("{0:yyyy-MM-dd}", dr["ZhuanZhangDate"]) + "', '" + Utility.ReplaceSql(dr["ZhuanZhangNote"].ToString()) + "', '" + dr["ZhuanZhangLive"].ToString() + "', '0');"); } sb.AppendLine(""); } //备份钱包表 DataTable cardTab = card_bll.GetCardList(userId); if (cardTab.Rows.Count > 0) { sb.AppendLine("DELETE FROM CardTable;"); foreach (DataRow dr in cardTab.Rows) { if (dr["CardID"].ToString() == "0") { continue; } string cardMoney = dr["CardMoney"].ToString(); if (user.IsUpdate == 1) { cardMoney = dr["MoneyStart"].ToString(); } sb.AppendLine("INSERT INTO CardTable (CDID, CardName, CardMoney, CardLive, Synchronize) VALUES ('" + dr["CDID"].ToString() + "', '" + Utility.ReplaceSql(dr["CardName"].ToString()) + "', '" + cardMoney + "', '" + dr["CardLive"].ToString() + "', '0');"); } } string pathFileName = GetFilePathName(fileName); BackupHelper.WriteBackupFile(pathFileName, sb.ToString()); bll.UpdateItemListWebBackByUserId(userId); cat_bll.UpdateCategoryListWebBack(userId); zt_bll.UpdateZhuanTiListWebBack(userId); card_bll.UpdateCardListWebBack(userId); DownBackFile(pathFileName, fileName); }