/// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.education_Prescription DataRowToModel(DataRow row)
 {
     Maticsoft.Model.education_Prescription model=new Maticsoft.Model.education_Prescription();
     if (row != null)
     {
         if(row["PrescriptionID"]!=null && row["PrescriptionID"].ToString()!="")
         {
             model.PrescriptionID=int.Parse(row["PrescriptionID"].ToString());
         }
         if(row["P_Object"]!=null && row["P_Object"].ToString()!="")
         {
             model.P_Object=decimal.Parse(row["P_Object"].ToString());
         }
         if(row["P_Name"]!=null)
         {
             model.P_Name=row["P_Name"].ToString();
         }
         if(row["P_Content"]!=null)
         {
             model.P_Content=row["P_Content"].ToString();
         }
         if(row["P_Doctor"]!=null && row["P_Doctor"].ToString()!="")
         {
             model.P_Doctor=int.Parse(row["P_Doctor"].ToString());
         }
         if(row["P_Date"]!=null && row["P_Date"].ToString()!="")
         {
             model.P_Date=DateTime.Parse(row["P_Date"].ToString());
         }
     }
     return model;
 }
Exemple #2
0
        /// <summary>
        /// 根据信息类型返回对应的信息名称
        /// </summary>
        /// <param name="superision_type"></param>
        /// <returns></returns>
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.education_Prescription education_Prescription_bll = new Maticsoft.BLL.education_Prescription();
            Maticsoft.Model.education_Prescription education_Prescription_model = education_Prescription_bll.GetModel(PrescriptionID);
            if (education_Prescription_model == null)
            {
                education_Prescription_model = new Maticsoft.Model.education_Prescription();
            }

            //获取客户端通过Post方式传递过来的值的
            education_Prescription_model.P_Date = (DateTime)Common.sink(this.P_Date.UniqueID, MethodType.Post, 255, 0, DataType.Dat);
            education_Prescription_model.P_Content = (string)Common.sink(this.P_Content.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            education_Prescription_model.P_Object = Convert.ToInt32(this.P_Object.Value);
            education_Prescription_model.P_Doctor = Convert.ToInt32(this.P_Doctor.Value);
            education_Prescription_model.P_Name = P_Name.Text;

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    //增加操作调用Add方法
                    PrescriptionID = education_Prescription_bll.Add(education_Prescription_model);
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    //是修改操作调用Update方法
                    education_Prescription_bll.Update(education_Prescription_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", PrescriptionID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Exemple #3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDecimal(txtP_Object.Text))
            {
                strErr+="健康处方对象格式错误!\\n";
            }
            if(this.txtP_Name.Text.Trim().Length==0)
            {
                strErr+="处方名称不能为空!\\n";
            }
            if(this.txtP_Content.Text.Trim().Length==0)
            {
                strErr+="处方内容不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtP_Doctor.Text))
            {
                strErr+="处方医生格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtP_Date.Text))
            {
                strErr+="处方日期格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int PrescriptionID=int.Parse(this.lblPrescriptionID.Text);
            decimal P_Object=decimal.Parse(this.txtP_Object.Text);
            string P_Name=this.txtP_Name.Text;
            string P_Content=this.txtP_Content.Text;
            int P_Doctor=int.Parse(this.txtP_Doctor.Text);
            DateTime P_Date=DateTime.Parse(this.txtP_Date.Text);

            Maticsoft.Model.education_Prescription model=new Maticsoft.Model.education_Prescription();
            model.PrescriptionID=PrescriptionID;
            model.P_Object=P_Object;
            model.P_Name=P_Name;
            model.P_Content=P_Content;
            model.P_Doctor=P_Doctor;
            model.P_Date=P_Date;

            Maticsoft.BLL.education_Prescription bll=new Maticsoft.BLL.education_Prescription();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.education_Prescription GetModel(int PrescriptionID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 PrescriptionID,P_Object,P_Name,P_Content,P_Doctor,P_Date from education_Prescription ");
            strSql.Append(" where [email protected]");
            SqlParameter[] parameters = {
                    new SqlParameter("@PrescriptionID", SqlDbType.Int,4)
            };
            parameters[0].Value = PrescriptionID;

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