Beispiel #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDateTime(txt评价时间.Text))
            {
                strErr+="评价时间格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int 评价编号=int.Parse(this.lbl评价编号.Text);
            int travle_ID=int.Parse(this.lbltravle_ID.Text);
            string user_telphone=this.lbluser_telphone.Text;
            int 评价字典编号=int.Parse(this.lbl评价字典编号.Text);
            DateTime 评价时间=DateTime.Parse(this.txt评价时间.Text);

            la.Model.comment model=new la.Model.comment();
            model.评价编号=评价编号;
            model.travle_ID=travle_ID;
            model.user_telphone=user_telphone;
            model.评价字典编号=评价字典编号;
            model.评价时间=评价时间;

            la.BLL.comment bll=new la.BLL.comment();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public la.Model.comment DataRowToModel(DataRow row)
 {
     la.Model.comment model=new la.Model.comment();
     if (row != null)
     {
         if(row["评价编号"]!=null && row["评价编号"].ToString()!="")
         {
             model.评价编号=int.Parse(row["评价编号"].ToString());
         }
         if(row["travle_ID"]!=null && row["travle_ID"].ToString()!="")
         {
             model.travle_ID=int.Parse(row["travle_ID"].ToString());
         }
         if(row["user_telphone"]!=null)
         {
             model.user_telphone=row["user_telphone"].ToString();
         }
         if(row["评价字典编号"]!=null && row["评价字典编号"].ToString()!="")
         {
             model.评价字典编号=int.Parse(row["评价字典编号"].ToString());
         }
         if(row["评价时间"]!=null && row["评价时间"].ToString()!="")
         {
             model.评价时间=DateTime.Parse(row["评价时间"].ToString());
         }
     }
     return model;
 }
Beispiel #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txt评价编号.Text))
            {
                strErr+="评价编号格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txttravle_ID.Text))
            {
                strErr+="旅行ID格式错误!\\n";
            }
            if(this.txtuser_telphone.Text.Trim().Length==0)
            {
                strErr+="用户Phone不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txt评价字典编号.Text))
            {
                strErr+="评价字典编号格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txt评价时间.Text))
            {
                strErr+="评价时间格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int 评价编号=int.Parse(this.txt评价编号.Text);
            int travle_ID=int.Parse(this.txttravle_ID.Text);
            string user_telphone=this.txtuser_telphone.Text;
            int 评价字典编号=int.Parse(this.txt评价字典编号.Text);
            DateTime 评价时间=DateTime.Parse(this.txt评价时间.Text);

            la.Model.comment model=new la.Model.comment();
            model.评价编号=评价编号;
            model.travle_ID=travle_ID;
            model.user_telphone=user_telphone;
            model.评价字典编号=评价字典编号;
            model.评价时间=评价时间;

            la.BLL.comment bll=new la.BLL.comment();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public la.Model.comment GetModel(int 评价编号,int travle_ID,string user_telphone,int 评价字典编号)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 评价编号,travle_ID,user_telphone,评价字典编号,评价时间 from comment ");
            strSql.Append(" where 评价编号=@评价编号 and travle_ID=@travle_ID and user_telphone=@user_telphone and 评价字典编号=@评价字典编号 ");
            SqlParameter[] parameters = {
                    new SqlParameter("@评价编号", SqlDbType.Int,4),
                    new SqlParameter("@travle_ID", SqlDbType.Int,4),
                    new SqlParameter("@user_telphone", SqlDbType.VarChar,20),
                    new SqlParameter("@评价字典编号", SqlDbType.Int,4)			};
            parameters[0].Value = 评价编号;
            parameters[1].Value = travle_ID;
            parameters[2].Value = user_telphone;
            parameters[3].Value = 评价字典编号;

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