예제 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public la.Model.audio DataRowToModel(DataRow row)
 {
     la.Model.audio model=new la.Model.audio();
     if (row != null)
     {
         if(row["audio_id"]!=null && row["audio_id"].ToString()!="")
         {
             model.audio_id=int.Parse(row["audio_id"].ToString());
         }
         if(row["user_telphone"]!=null)
         {
             model.user_telphone=row["user_telphone"].ToString();
         }
         if(row["audio_url"]!=null)
         {
             model.audio_url=row["audio_url"].ToString();
         }
         if(row["audio_time"]!=null && row["audio_time"].ToString()!="")
         {
             model.audio_time=DateTime.Parse(row["audio_time"].ToString());
         }
         if(row["audio_comment"]!=null)
         {
             model.audio_comment=row["audio_comment"].ToString();
         }
         if(row["audio_state"]!=null)
         {
             model.audio_state=row["audio_state"].ToString();
         }
     }
     return model;
 }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtaudio_id.Text))
            {
                strErr+="音频ID格式错误!\\n";
            }
            if(this.txtuser_telphone.Text.Trim().Length==0)
            {
                strErr+="用户Phone不能为空!\\n";
            }
            if(this.txtaudio_url.Text.Trim().Length==0)
            {
                strErr+="音频路径不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtaudio_time.Text))
            {
                strErr+="上传时间格式错误!\\n";
            }
            if(this.txtaudio_comment.Text.Trim().Length==0)
            {
                strErr+="备注不能为空!\\n";
            }
            if(this.txtaudio_state.Text.Trim().Length==0)
            {
                strErr+="审核状态不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int audio_id=int.Parse(this.txtaudio_id.Text);
            string user_telphone=this.txtuser_telphone.Text;
            string audio_url=this.txtaudio_url.Text;
            DateTime audio_time=DateTime.Parse(this.txtaudio_time.Text);
            string audio_comment=this.txtaudio_comment.Text;
            string audio_state=this.txtaudio_state.Text;

            la.Model.audio model=new la.Model.audio();
            model.audio_id=audio_id;
            model.user_telphone=user_telphone;
            model.audio_url=audio_url;
            model.audio_time=audio_time;
            model.audio_comment=audio_comment;
            model.audio_state=audio_state;

            la.BLL.audio bll=new la.BLL.audio();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
예제 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public la.Model.audio GetModel(int audio_id,string user_telphone)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 audio_id,user_telphone,audio_url,audio_time,audio_comment,audio_state from audio ");
            strSql.Append(" where audio_id=@audio_id and user_telphone=@user_telphone ");
            SqlParameter[] parameters = {
                    new SqlParameter("@audio_id", SqlDbType.Int,4),
                    new SqlParameter("@user_telphone", SqlDbType.VarChar,20)			};
            parameters[0].Value = audio_id;
            parameters[1].Value = user_telphone;

            la.Model.audio model=new la.Model.audio();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
예제 #4
0
 /// <summary>
 /// 获取最后一条语音信息。
 /// </summary>
 /// <param name="tel"></param>
 /// <returns></returns>
 public Model.audio getLastAudio(string tel)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1 audio_id,user_telphone,audio_url,audio_time,audio_comment,audio_state from audio ");
     strSql.Append(" where user_telphone=@user_telphone order by audio_time desc ");
     SqlParameter[] parameters = { new SqlParameter("@user_telphone", SqlDbType.VarChar, 20) };
     parameters[0].Value = tel;
     la.Model.audio ad = new la.Model.audio();
     DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }