Example #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.EmpiInfo DataRowToModel(DataRow row)
 {
     RuRo.Model.EmpiInfo model = new RuRo.Model.EmpiInfo();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["PatientName"] != null)
         {
             model.PatientName = row["PatientName"].ToString();
         }
         if (row["Sex"] != null)
         {
             model.Sex = row["Sex"].ToString();
         }
         if (row["Birthday"] != null)
         {
             model.Birthday = row["Birthday"].ToString();
         }
         if (row["CardId"] != null)
         {
             model.CardId = row["CardId"].ToString();
         }
         if (row["SourceType"] != null)
         {
             model.SourceType = row["SourceType"].ToString();
         }
     }
     return(model);
 }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(RuRo.Model.EmpiInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into EmpiInfo(");
            strSql.Append("PatientName,Sex,Birthday,CardId,SourceType)");
            strSql.Append(" values (");
            strSql.Append("@PatientName,@Sex,@Birthday,@CardId,@SourceType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PatientName", SqlDbType.NVarChar, 50),
                new SqlParameter("@Sex",         SqlDbType.NVarChar, 50),
                new SqlParameter("@Birthday",    SqlDbType.NVarChar, 50),
                new SqlParameter("@CardId",      SqlDbType.NVarChar, 50),
                new SqlParameter("@SourceType",  SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.PatientName;
            parameters[1].Value = model.Sex;
            parameters[2].Value = model.Birthday;
            parameters[3].Value = model.CardId;
            parameters[4].Value = model.SourceType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
 private void ShowInfo(int Id)
 {
     RuRo.BLL.EmpiInfo   bll   = new RuRo.BLL.EmpiInfo();
     RuRo.Model.EmpiInfo model = bll.GetModel(Id);
     this.lblId.Text          = model.Id.ToString();
     this.txtPatientName.Text = model.PatientName;
     this.txtSex.Text         = model.Sex;
     this.txtBirthday.Text    = model.Birthday;
     this.txtCardId.Text      = model.CardId;
     this.txtSourceType.Text  = model.SourceType;
 }
Example #4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtPatientName.Text.Trim().Length == 0)
            {
                strErr += "姓名不能为空!\\n";
            }
            if (this.txtSex.Text.Trim().Length == 0)
            {
                strErr += "性别不能为空!\\n";
            }
            if (this.txtBirthday.Text.Trim().Length == 0)
            {
                strErr += "出生日期不能为空!\\n";
            }
            if (this.txtCardId.Text.Trim().Length == 0)
            {
                strErr += "身份证号不能为空!\\n";
            }
            if (this.txtSourceType.Text.Trim().Length == 0)
            {
                strErr += "SourceType不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    Id          = int.Parse(this.lblId.Text);
            string PatientName = this.txtPatientName.Text;
            string Sex         = this.txtSex.Text;
            string Birthday    = this.txtBirthday.Text;
            string CardId      = this.txtCardId.Text;
            string SourceType  = this.txtSourceType.Text;


            RuRo.Model.EmpiInfo model = new RuRo.Model.EmpiInfo();
            model.Id          = Id;
            model.PatientName = PatientName;
            model.Sex         = Sex;
            model.Birthday    = Birthday;
            model.CardId      = CardId;
            model.SourceType  = SourceType;

            RuRo.BLL.EmpiInfo bll = new RuRo.BLL.EmpiInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #5
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtPatientName.Text.Trim().Length==0)
            {
                strErr+="姓名不能为空!\\n";
            }
            if(this.txtSex.Text.Trim().Length==0)
            {
                strErr+="性别不能为空!\\n";
            }
            if(this.txtBirthday.Text.Trim().Length==0)
            {
                strErr+="出生日期不能为空!\\n";
            }
            if(this.txtCardId.Text.Trim().Length==0)
            {
                strErr+="身份证号不能为空!\\n";
            }
            if(this.txtSourceType.Text.Trim().Length==0)
            {
                strErr+="SourceType不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int Id=int.Parse(this.lblId.Text);
            string PatientName=this.txtPatientName.Text;
            string Sex=this.txtSex.Text;
            string Birthday=this.txtBirthday.Text;
            string CardId=this.txtCardId.Text;
            string SourceType=this.txtSourceType.Text;

            RuRo.Model.EmpiInfo model=new RuRo.Model.EmpiInfo();
            model.Id=Id;
            model.PatientName=PatientName;
            model.Sex=Sex;
            model.Birthday=Birthday;
            model.CardId=CardId;
            model.SourceType=SourceType;

            RuRo.BLL.EmpiInfo bll=new RuRo.BLL.EmpiInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Example #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtPatientName.Text.Trim().Length==0)
            {
                strErr+="姓名不能为空!\\n";
            }
            if(this.txtSex.Text.Trim().Length==0)
            {
                strErr+="性别不能为空!\\n";
            }
            if(this.txtBirthday.Text.Trim().Length==0)
            {
                strErr+="出生日期不能为空!\\n";
            }
            if(this.txtCardId.Text.Trim().Length==0)
            {
                strErr+="身份证号不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string PatientName=this.txtPatientName.Text;
            string Sex=this.txtSex.Text;
            string Birthday=this.txtBirthday.Text;
            string CardId=this.txtCardId.Text;
            bool isDel=this.chkisDel.Checked;

            RuRo.Model.EmpiInfo model=new RuRo.Model.EmpiInfo();
            model.PatientName=PatientName;
            model.Sex=Sex;
            model.Birthday=Birthday;
            model.CardId=CardId;
            model.isDel=isDel;

            RuRo.BLL.EmpiInfo bll=new RuRo.BLL.EmpiInfo();
            bll.Add(model);
            RuRo.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Example #7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.EmpiInfo DataRowToModel(DataRow row)
 {
     RuRo.Model.EmpiInfo model=new RuRo.Model.EmpiInfo();
     if (row != null)
     {
         if(row["Id"]!=null && row["Id"].ToString()!="")
         {
             model.Id=int.Parse(row["Id"].ToString());
         }
         if(row["PatientName"]!=null)
         {
             model.PatientName=row["PatientName"].ToString();
         }
         if(row["Sex"]!=null)
         {
             model.Sex=row["Sex"].ToString();
         }
         if(row["Birthday"]!=null)
         {
             model.Birthday=row["Birthday"].ToString();
         }
         if(row["CardId"]!=null)
         {
             model.CardId=row["CardId"].ToString();
         }
         if(row["isDel"]!=null && row["isDel"].ToString()!="")
         {
             if((row["isDel"].ToString()=="1")||(row["isDel"].ToString().ToLower()=="true"))
             {
                 model.isDel=true;
             }
             else
             {
                 model.isDel=false;
             }
         }
     }
     return model;
 }
Example #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RuRo.Model.EmpiInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update EmpiInfo set ");
            strSql.Append("PatientName=@PatientName,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("Birthday=@Birthday,");
            strSql.Append("CardId=@CardId,");
            strSql.Append("SourceType=@SourceType");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PatientName", SqlDbType.NVarChar, 50),
                new SqlParameter("@Sex",         SqlDbType.NVarChar, 50),
                new SqlParameter("@Birthday",    SqlDbType.NVarChar, 50),
                new SqlParameter("@CardId",      SqlDbType.NVarChar, 50),
                new SqlParameter("@SourceType",  SqlDbType.NVarChar, 50),
                new SqlParameter("@Id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.PatientName;
            parameters[1].Value = model.Sex;
            parameters[2].Value = model.Birthday;
            parameters[3].Value = model.CardId;
            parameters[4].Value = model.SourceType;
            parameters[5].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.EmpiInfo GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,PatientName,Sex,Birthday,CardId,SourceType from EmpiInfo ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(RuRo.Model.EmpiInfo model)
 {
     return(dal.Update(model));
 }
Example #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(RuRo.Model.EmpiInfo model)
 {
     return(dal.Add(model));
 }
Example #12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.EmpiInfo GetModel(int Id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 Id,PatientName,Sex,Birthday,CardId,isDel from EmpiInfo ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

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