Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtlooksindex_id.Text))
            {
                strErr+="容貌指数ID格式错误!\\n";
            }
            if(this.txtuser_telphone.Text.Trim().Length==0)
            {
                strErr+="用户Phone不能为空!\\n";
            }
            if(!PageValidate.IsDecimal(txtlooksindex_change_value.Text))
            {
                strErr+="容貌指数变化值格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtlooksindex_change_time.Text))
            {
                strErr+="容貌指数变化时间格式错误!\\n";
            }
            if(this.txtlooksindex_change_comment.Text.Trim().Length==0)
            {
                strErr+="容貌指数变化说明不能为空!\\n";
            }
            if(!PageValidate.IsDecimal(txtlooksindex_result.Text))
            {
                strErr+="容貌指数结果格式错误!\\n";
            }
            if(this.txtlooksindex_change_type.Text.Trim().Length==0)
            {
                strErr+="容貌指数变化类型不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int looksindex_id=int.Parse(this.txtlooksindex_id.Text);
            string user_telphone=this.txtuser_telphone.Text;
            decimal looksindex_change_value=decimal.Parse(this.txtlooksindex_change_value.Text);
            DateTime looksindex_change_time=DateTime.Parse(this.txtlooksindex_change_time.Text);
            string looksindex_change_comment=this.txtlooksindex_change_comment.Text;
            decimal looksindex_result=decimal.Parse(this.txtlooksindex_result.Text);
            string looksindex_change_type=this.txtlooksindex_change_type.Text;

            la.Model.looksindex model=new la.Model.looksindex();
            model.looksindex_id=looksindex_id;
            model.user_telphone=user_telphone;
            model.looksindex_change_value=looksindex_change_value;
            model.looksindex_change_time=looksindex_change_time;
            model.looksindex_change_comment=looksindex_change_comment;
            model.looksindex_result=looksindex_result;
            model.looksindex_change_type=looksindex_change_type;

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

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