Beispiel #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDecimal(txtVIP_change_credit.Text))
            {
                strErr+="VIP变化积分格式错误!\\n";
            }
            if(this.txtVIP_change_comment.Text.Trim().Length==0)
            {
                strErr+="VIP变化原因不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtVIP_change_time.Text))
            {
                strErr+="VIP变化时间格式错误!\\n";
            }
            if(!PageValidate.IsDecimal(txtVIP_credit.Text))
            {
                strErr+="VIP积分值格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtVIP_level.Text))
            {
                strErr+="VIP变化后等级格式错误!\\n";
            }
            if(this.txtVIP_change_type.Text.Trim().Length==0)
            {
                strErr+="VIP积分变化类型不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int VIPID=int.Parse(this.lblVIPID.Text);
            string user_telphone=this.lbluser_telphone.Text;
            decimal VIP_change_credit=decimal.Parse(this.txtVIP_change_credit.Text);
            string VIP_change_comment=this.txtVIP_change_comment.Text;
            DateTime VIP_change_time=DateTime.Parse(this.txtVIP_change_time.Text);
            decimal VIP_credit=decimal.Parse(this.txtVIP_credit.Text);
            int VIP_level=int.Parse(this.txtVIP_level.Text);
            string VIP_change_type=this.txtVIP_change_type.Text;

            la.Model.VIP model=new la.Model.VIP();
            model.VIPID=VIPID;
            model.user_telphone=user_telphone;
            model.VIP_change_credit=VIP_change_credit;
            model.VIP_change_comment=VIP_change_comment;
            model.VIP_change_time=VIP_change_time;
            model.VIP_credit=VIP_credit;
            model.VIP_level=VIP_level;
            model.VIP_change_type=VIP_change_type;

            la.BLL.VIP bll=new la.BLL.VIP();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public la.Model.VIP DataRowToModel(DataRow row)
 {
     la.Model.VIP model=new la.Model.VIP();
     if (row != null)
     {
         if(row["VIPID"]!=null && row["VIPID"].ToString()!="")
         {
             model.VIPID=int.Parse(row["VIPID"].ToString());
         }
         if(row["user_telphone"]!=null)
         {
             model.user_telphone=row["user_telphone"].ToString();
         }
         if(row["VIP_change_credit"]!=null && row["VIP_change_credit"].ToString()!="")
         {
             model.VIP_change_credit=decimal.Parse(row["VIP_change_credit"].ToString());
         }
         if(row["VIP_change_comment"]!=null)
         {
             model.VIP_change_comment=row["VIP_change_comment"].ToString();
         }
         if(row["VIP_change_time"]!=null && row["VIP_change_time"].ToString()!="")
         {
             model.VIP_change_time=DateTime.Parse(row["VIP_change_time"].ToString());
         }
         if(row["VIP_credit"]!=null && row["VIP_credit"].ToString()!="")
         {
             model.VIP_credit=decimal.Parse(row["VIP_credit"].ToString());
         }
         if(row["VIP_level"]!=null && row["VIP_level"].ToString()!="")
         {
             model.VIP_level=int.Parse(row["VIP_level"].ToString());
         }
         if(row["VIP_change_type"]!=null)
         {
             model.VIP_change_type=row["VIP_change_type"].ToString();
         }
     }
     return model;
 }
Beispiel #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public la.Model.VIP GetModel(int VIPID,string user_telphone)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 VIPID,user_telphone,VIP_change_credit,VIP_change_comment,VIP_change_time,VIP_credit,VIP_level,VIP_change_type from VIP ");
            strSql.Append(" where VIPID=@VIPID and user_telphone=@user_telphone ");
            SqlParameter[] parameters = {
                    new SqlParameter("@VIPID", SqlDbType.Int,4),
                    new SqlParameter("@user_telphone", SqlDbType.VarChar,20)			};
            parameters[0].Value = VIPID;
            parameters[1].Value = user_telphone;

            la.Model.VIP model=new la.Model.VIP();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }