Esempio n. 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public la.Model.enshrine DataRowToModel(DataRow row)
 {
     la.Model.enshrine model=new la.Model.enshrine();
     if (row != null)
     {
         if(row["enshrine_id"]!=null && row["enshrine_id"].ToString()!="")
         {
             model.enshrine_id=int.Parse(row["enshrine_id"].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["enshrine_time"]!=null && row["enshrine_time"].ToString()!="")
         {
             model.enshrine_time=DateTime.Parse(row["enshrine_time"].ToString());
         }
         if(row["enshrine_islvalid"]!=null && row["enshrine_islvalid"].ToString()!="")
         {
             if((row["enshrine_islvalid"].ToString()=="1")||(row["enshrine_islvalid"].ToString().ToLower()=="true"))
             {
                 model.enshrine_islvalid=true;
             }
             else
             {
                 model.enshrine_islvalid=false;
             }
         }
     }
     return model;
 }
Esempio n. 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDateTime(txtenshrine_time.Text))
            {
                strErr+="收藏时间格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int enshrine_id=int.Parse(this.lblenshrine_id.Text);
            int travle_ID=int.Parse(this.lbltravle_ID.Text);
            string user_telphone=this.lbluser_telphone.Text;
            DateTime enshrine_time=DateTime.Parse(this.txtenshrine_time.Text);
            bool enshrine_islvalid=this.chkenshrine_islvalid.Checked;

            la.Model.enshrine model=new la.Model.enshrine();
            model.enshrine_id=enshrine_id;
            model.travle_ID=travle_ID;
            model.user_telphone=user_telphone;
            model.enshrine_time=enshrine_time;
            model.enshrine_islvalid=enshrine_islvalid;

            la.BLL.enshrine bll=new la.BLL.enshrine();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtenshrine_id.Text))
            {
                strErr+="收藏ID格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txttravle_ID.Text))
            {
                strErr+="旅行ID格式错误!\\n";
            }
            if(this.txtuser_telphone.Text.Trim().Length==0)
            {
                strErr+="用户Phone不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtenshrine_time.Text))
            {
                strErr+="收藏时间格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int enshrine_id=int.Parse(this.txtenshrine_id.Text);
            int travle_ID=int.Parse(this.txttravle_ID.Text);
            string user_telphone=this.txtuser_telphone.Text;
            DateTime enshrine_time=DateTime.Parse(this.txtenshrine_time.Text);
            bool enshrine_islvalid=this.chkenshrine_islvalid.Checked;

            la.Model.enshrine model=new la.Model.enshrine();
            model.enshrine_id=enshrine_id;
            model.travle_ID=travle_ID;
            model.user_telphone=user_telphone;
            model.enshrine_time=enshrine_time;
            model.enshrine_islvalid=enshrine_islvalid;

            la.BLL.enshrine bll=new la.BLL.enshrine();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public la.Model.enshrine GetModel(int enshrine_id,int travle_ID,string user_telphone)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 enshrine_id,travle_ID,user_telphone,enshrine_time,enshrine_islvalid from enshrine ");
            strSql.Append(" where enshrine_id=@enshrine_id and travle_ID=@travle_ID and user_telphone=@user_telphone ");
            SqlParameter[] parameters = {
                    new SqlParameter("@enshrine_id", SqlDbType.Int,4),
                    new SqlParameter("@travle_ID", SqlDbType.Int,4),
                    new SqlParameter("@user_telphone", SqlDbType.VarChar,20)			};
            parameters[0].Value = enshrine_id;
            parameters[1].Value = travle_ID;
            parameters[2].Value = user_telphone;

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