/// <summary> /// 查所有集合 kevin创建 /// </summary> /// <returns></returns> public List<ShowShop.Model.Member.MemberRank> GetAllMemberRank() { string strSql = "select * from yxs_memberrank"; List<ShowShop.Model.Member.MemberRank> ranklist = new List<ShowShop.Model.Member.MemberRank>(); using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql)) { while(reader.Read()){ ShowShop.Model.Member.MemberRank model = new ShowShop.Model.Member.MemberRank(); model.Id = (int)reader["Id"]; model.Name = (string)reader["Name"]; model.LogoPic = (string)reader["LogoPic"]; model.Discount = Convert.ToDecimal(reader["Discount"]); model.MinScore = Convert.ToDecimal(reader["MinScore"]); model.MaxScore = Convert.ToDecimal(reader["MaxScore"]); model.Priority = Convert.ToInt32(reader["Priority"]); model.IsSpecial =Convert.ToInt32(reader["IsSpecial"]); model.IsShowPrice =Convert.ToInt32(reader["IsShowPrice"]); model.Article =Convert.ToInt32(reader["Article"]); model.Product =Convert.ToInt32(reader["Product"]); model.ArticleAuditing = Convert.ToInt32(reader["ArticleAuditing"]); model.ProductAuditing = Convert.ToInt32(reader["ProductAuditing"]); model.MaxMoney =Convert.ToDecimal(reader["MaxMoney"]); model.UpgradeMoney =Convert.ToDecimal(reader["UpgradeMoney"]); model.IsUpgrade =Convert.ToInt32(reader["IsUpgrade"]); ranklist.Add(model); } } return ranklist; }
/// <summary> /// 得到一个对象实体 /// </summary> public ShowShop.Model.Member.MemberRank GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,Name,LogoPic,Discount,MinScore,MaxScore,Priority,IsSpecial,IsShowPrice,Article,Product,ArticleAuditing,ProductAuditing,MaxMoney,UpgradeMoney,IsUpgrade from yxs_memberrank "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int,4)}; parameters[0].Value = Id; ShowShop.Model.Member.MemberRank model =null; using(SqlDataReader reader=ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString(),parameters)) { while(reader.Read()) { model=new ShowShop.Model.Member.MemberRank(); model.Id = (int)reader["Id"]; model.Name = (string)reader["Name"]; model.LogoPic = (string)reader["LogoPic"]; model.Discount = Convert.ToDecimal(reader["Discount"]); model.MinScore = Convert.ToDecimal(reader["MinScore"]); model.MaxScore = Convert.ToDecimal(reader["MaxScore"]); model.Priority = Convert.ToInt32(reader["Priority"]); model.IsSpecial =Convert.ToInt32(reader["IsSpecial"]); model.IsShowPrice =Convert.ToInt32(reader["IsShowPrice"]); model.Article =Convert.ToInt32(reader["Article"]); model.Product =Convert.ToInt32(reader["Product"]); model.ArticleAuditing = Convert.ToInt32(reader["ArticleAuditing"]); model.ProductAuditing = Convert.ToInt32(reader["ProductAuditing"]); model.MaxMoney =Convert.ToDecimal(reader["MaxMoney"]); model.UpgradeMoney =Convert.ToDecimal(reader["UpgradeMoney"]); model.IsUpgrade =Convert.ToInt32(reader["IsUpgrade"]); } } return model; }
private void Sava() { if (UploadFile()) { ShowShop.BLL.Member.MemberRank bll = new ShowShop.BLL.Member.MemberRank(); Model.Member.MemberRank model = new ShowShop.Model.Member.MemberRank(); //model.Discount=(decimal)ChangeHope.Common.StringHelper.String2Double(this.txtDiscount.Text); model.Discount = Convert.ToDecimal(this.txtDiscount.Text); model.Id = ChangeHope.Common.StringHelper.StringToInt(this.txtId.Value); model.LogoPic = this.txtLogoPicUrl.Value; model.MaxMoney = (decimal)ChangeHope.Common.StringHelper.String2Double(this.txtMaxMoney.Text); model.MaxScore = (decimal)ChangeHope.Common.StringHelper.String2Double(this.txtMaxScore.Text); model.MinScore = (decimal)ChangeHope.Common.StringHelper.String2Double(this.txtMinScore.Text); model.Name = this.txtName.Text; model.Priority = ChangeHope.Common.StringHelper.StringToInt(this.txtPriority.Text); model.UpgradeMoney = (decimal)ChangeHope.Common.StringHelper.String2Double(this.txtUpgradeMoney.Text); model.IsUpgrade = ChangeHope.Common.StringHelper.StringToInt(this.ckbIsUpgrade.SelectedValue); model.IsShowPrice = 0; model.IsSpecial = 0; model.Product = 0; model.ProductAuditing = 0; model.Article = 0; model.ArticleAuditing = 0; foreach (ListItem it in this.ckbOtherInfo.Items) { if (it.Selected) { if (it.Value.Equals("IsShowPrice")) { model.IsShowPrice = 1; } if (it.Value.Equals("IsSpecial")) { model.IsSpecial = 1; } if (it.Value.Equals("Article")) { model.Article = 1; } if (it.Value.Equals("Product")) { model.Product = 1; } if (it.Value.Equals("ArticleAuditing")) { model.ArticleAuditing = 1; } if (it.Value.Equals("ProductAuditing")) { model.ProductAuditing = 1; } } } if (model.Id > 0) { bll.Update(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { bll.Add(model); this.txtName.Text = string.Empty; this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } model = null; bll = null; } }