Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtDay.Text.Trim().Length==0)
            {
                strErr+="Day不能为空!\\n";
            }
            if(this.txtTime.Text.Trim().Length==0)
            {
                strErr+="Time不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string Day=this.txtDay.Text;
            string Time=this.txtTime.Text;

            JiaJiao.Model.Class model=new JiaJiao.Model.Class();
            model.Day=Day;
            model.Time=Time;

            JiaJiao.BLL.Class bll=new JiaJiao.BLL.Class();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Ejemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtDay.Text.Trim().Length==0)
            {
                strErr+="Day不能为空!\\n";
            }
            if(this.txtTime.Text.Trim().Length==0)
            {
                strErr+="Time不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int ID=int.Parse(this.lblID.Text);
            string Day=this.txtDay.Text;
            string Time=this.txtTime.Text;

            JiaJiao.Model.Class model=new JiaJiao.Model.Class();
            model.ID=ID;
            model.Day=Day;
            model.Time=Time;

            JiaJiao.BLL.Class bll=new JiaJiao.BLL.Class();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public JiaJiao.Model.Class DataRowToModel(DataRow row)
 {
     JiaJiao.Model.Class model=new JiaJiao.Model.Class();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["Day"]!=null)
         {
             model.Day=row["Day"].ToString();
         }
         if(row["Time"]!=null)
         {
             model.Time=row["Time"].ToString();
         }
     }
     return model;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JiaJiao.Model.Class GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,Day,Time from Class ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

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