コード例 #1
0
ファイル: Show.aspx.cs プロジェクト: liu4434004/EHR2
 private void ShowInfo(int NationID)
 {
     Maticsoft.BLL.Nation   bll   = new Maticsoft.BLL.Nation();
     Maticsoft.Model.Nation model = bll.GetModel(NationID);
     this.lblNationID.Text = model.NationID.ToString();
     this.lblN_Name.Text   = model.N_Name;
 }
コード例 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Nation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Nation set ");
            strSql.Append("N_Name=@N_Name");
            strSql.Append(" where NationID=@NationID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@N_Name",   SqlDbType.NVarChar, 50),
                new SqlParameter("@NationID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.N_Name;
            parameters[1].Value = model.NationID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: Modify.aspx.cs プロジェクト: liu4434004/EHR2
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtN_Name.Text.Trim().Length == 0)
            {
                strErr += "民族名不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    NationID = int.Parse(this.lblNationID.Text);
            string N_Name   = this.txtN_Name.Text;


            Maticsoft.Model.Nation model = new Maticsoft.Model.Nation();
            model.NationID = NationID;
            model.N_Name   = N_Name;

            Maticsoft.BLL.Nation bll = new Maticsoft.BLL.Nation();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
コード例 #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.Nation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Nation(");
            strSql.Append("N_Name)");
            strSql.Append(" values (");
            strSql.Append("@N_Name)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@N_Name", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.N_Name;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #5
0
ファイル: Nation.cs プロジェクト: hezejiang/EHR
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Nation DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Nation model=new Maticsoft.Model.Nation();
     if (row != null)
     {
         if(row["NationID"]!=null && row["NationID"].ToString()!="")
         {
             model.NationID=int.Parse(row["NationID"].ToString());
         }
         if(row["N_Name"]!=null)
         {
             model.N_Name=row["N_Name"].ToString();
         }
     }
     return model;
 }
コード例 #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Nation DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Nation model = new Maticsoft.Model.Nation();
     if (row != null)
     {
         if (row["NationID"] != null && row["NationID"].ToString() != "")
         {
             model.NationID = int.Parse(row["NationID"].ToString());
         }
         if (row["N_Name"] != null)
         {
             model.N_Name = row["N_Name"].ToString();
         }
     }
     return(model);
 }
コード例 #7
0
ファイル: Add.aspx.cs プロジェクト: hezejiang/EHR2
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtN_Name.Text.Trim().Length==0)
            {
                strErr+="民族名不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string N_Name=this.txtN_Name.Text;

            Maticsoft.Model.Nation model=new Maticsoft.Model.Nation();
            model.N_Name=N_Name;

            Maticsoft.BLL.Nation bll=new Maticsoft.BLL.Nation();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
コード例 #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtN_Name.Text.Trim().Length == 0)
            {
                strErr += "民族名不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string N_Name = this.txtN_Name.Text;

            Maticsoft.Model.Nation model = new Maticsoft.Model.Nation();
            model.N_Name = N_Name;

            Maticsoft.BLL.Nation bll = new Maticsoft.BLL.Nation();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
コード例 #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Nation GetModel(int NationID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 NationID,N_Name from Nation ");
            strSql.Append(" where NationID=@NationID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NationID", SqlDbType.Int, 4)
            };
            parameters[0].Value = NationID;

            Maticsoft.Model.Nation model = new Maticsoft.Model.Nation();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #10
0
ファイル: Modify.aspx.cs プロジェクト: hezejiang/EHR2
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtN_Name.Text.Trim().Length==0)
            {
                strErr+="民族名不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int NationID=int.Parse(this.lblNationID.Text);
            string N_Name=this.txtN_Name.Text;

            Maticsoft.Model.Nation model=new Maticsoft.Model.Nation();
            model.NationID=NationID;
            model.N_Name=N_Name;

            Maticsoft.BLL.Nation bll=new Maticsoft.BLL.Nation();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
コード例 #11
0
ファイル: Nation.cs プロジェクト: hezejiang/EHR
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Nation GetModel(int NationID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 NationID,N_Name from Nation ");
            strSql.Append(" where NationID=@NationID");
            SqlParameter[] parameters = {
                    new SqlParameter("@NationID", SqlDbType.Int,4)
            };
            parameters[0].Value = NationID;

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