Beispiel #1
0
 private void ShowInfo(int QuestionId)
 {
     NoName.NetShop.BLL.QuestionModelBll bll   = new NoName.NetShop.BLL.QuestionModelBll();
     NoName.NetShop.Model.QuestionModel  model = bll.GetModel(QuestionId);
     this.lblUserId.Text         = model.UserId.ToString();
     this.lblContentType.Text    = model.ContentType.ToString();
     this.lblContentId.Text      = model.ContentId;
     this.lblTitle.Text          = model.Title;
     this.lblContent.Text        = model.Content;
     this.lblBrief.Text          = model.Brief;
     this.lblInsertTime.Text     = model.InsertTime.ToString();
     this.lblLastAnswerTime.Text = model.LastAnswerTime.ToString();
     this.lblLastAnswerId.Text   = model.LastAnswerId;
     this.lblAnswerNum.Text      = model.AnswerNum.ToString();
 }
 private void ShowInfo(int QuestionId)
 {
     NoName.NetShop.BLL.QuestionModelBll bll=new NoName.NetShop.BLL.QuestionModelBll();
     NoName.NetShop.Model.QuestionModel model=bll.GetModel(QuestionId);
     this.lblUserId.Text=model.UserId.ToString();
     this.lblContentType.Text=model.ContentType.ToString();
     this.lblContentId.Text=model.ContentId;
     this.lblTitle.Text=model.Title;
     this.lblContent.Text=model.Content;
     this.lblBrief.Text=model.Brief;
     this.lblInsertTime.Text=model.InsertTime.ToString();
     this.lblLastAnswerTime.Text=model.LastAnswerTime.ToString();
     this.lblLastAnswerId.Text=model.LastAnswerId;
     this.lblAnswerNum.Text=model.AnswerNum.ToString();
 }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtUserId.Text))
            {
            strErr+="UserId�������֣�\\n";
            }
            if(!PageValidate.IsNumber(txtContentType.Text))
            {
            strErr+="ContentType�������֣�\\n";
            }
            if(this.txtContentId.Text =="")
            {
            strErr+="ContentId����Ϊ�գ�\\n";
            }
            if(this.txtTitle.Text =="")
            {
            strErr+="Title����Ϊ�գ�\\n";
            }
            if(this.txtContent.Text =="")
            {
            strErr+="Content����Ϊ�գ�\\n";
            }
            if(this.txtBrief.Text =="")
            {
            strErr+="Brief����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsDateTime(txtInsertTime.Text))
            {
            strErr+="InsertTime����ʱ���ʽ��\\n";
            }
            if(!PageValidate.IsDateTime(txtLastAnswerTime.Text))
            {
            strErr+="LastAnswerTime����ʱ���ʽ��\\n";
            }
            if(this.txtLastAnswerId.Text =="")
            {
            strErr+="LastAnswerId����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsNumber(txtAnswerNum.Text))
            {
            strErr+="AnswerNum�������֣�\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            int UserId=int.Parse(this.txtUserId.Text);
            int ContentType=int.Parse(this.txtContentType.Text);
            string ContentId=this.txtContentId.Text;
            string Title=this.txtTitle.Text;
            string Content=this.txtContent.Text;
            string Brief=this.txtBrief.Text;
            DateTime InsertTime=DateTime.Parse(this.txtInsertTime.Text);
            DateTime LastAnswerTime=DateTime.Parse(this.txtLastAnswerTime.Text);
            string LastAnswerId=this.txtLastAnswerId.Text;
            int AnswerNum=int.Parse(this.txtAnswerNum.Text);

            NoName.NetShop.Model.QuestionModel model=new NoName.NetShop.Model.QuestionModel();
            model.UserId=UserId;
            model.ContentType=ContentType;
            model.ContentId=ContentId;
            model.Title=Title;
            model.Content=Content;
            model.Brief=Brief;
            model.InsertTime=InsertTime;
            model.LastAnswerTime=LastAnswerTime;
            model.LastAnswerId=LastAnswerId;
            model.AnswerNum=AnswerNum;

            NoName.NetShop.BLL.QuestionModelBll bll=new NoName.NetShop.BLL.QuestionModelBll();
            bll.Update(model);
        }
Beispiel #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtUserId.Text))
            {
                strErr += "UserId不是数字!\\n";
            }
            if (!PageValidate.IsNumber(txtContentType.Text))
            {
                strErr += "ContentType不是数字!\\n";
            }
            if (this.txtContentId.Text == "")
            {
                strErr += "ContentId不能为空!\\n";
            }
            if (this.txtTitle.Text == "")
            {
                strErr += "Title不能为空!\\n";
            }
            if (this.txtContent.Text == "")
            {
                strErr += "Content不能为空!\\n";
            }
            if (this.txtBrief.Text == "")
            {
                strErr += "Brief不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtInsertTime.Text))
            {
                strErr += "InsertTime不是时间格式!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastAnswerTime.Text))
            {
                strErr += "LastAnswerTime不是时间格式!\\n";
            }
            if (this.txtLastAnswerId.Text == "")
            {
                strErr += "LastAnswerId不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtAnswerNum.Text))
            {
                strErr += "AnswerNum不是数字!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      UserId         = int.Parse(this.txtUserId.Text);
            int      ContentType    = int.Parse(this.txtContentType.Text);
            string   ContentId      = this.txtContentId.Text;
            string   Title          = this.txtTitle.Text;
            string   Content        = this.txtContent.Text;
            string   Brief          = this.txtBrief.Text;
            DateTime InsertTime     = DateTime.Parse(this.txtInsertTime.Text);
            DateTime LastAnswerTime = DateTime.Parse(this.txtLastAnswerTime.Text);
            string   LastAnswerId   = this.txtLastAnswerId.Text;
            int      AnswerNum      = int.Parse(this.txtAnswerNum.Text);

            NoName.NetShop.Model.QuestionModel model = new NoName.NetShop.Model.QuestionModel();
            model.UserId         = UserId;
            model.ContentType    = ContentType;
            model.ContentId      = ContentId;
            model.Title          = Title;
            model.Content        = Content;
            model.Brief          = Brief;
            model.InsertTime     = InsertTime;
            model.LastAnswerTime = LastAnswerTime;
            model.LastAnswerId   = LastAnswerId;
            model.AnswerNum      = AnswerNum;

            NoName.NetShop.BLL.QuestionModelBll bll = new NoName.NetShop.BLL.QuestionModelBll();
            bll.Add(model);
        }