示例#1
0
        public void OP_Command(object sender, CommandEventArgs e)
        {
            int intId = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "edit")
            {
                if (HelperUtility.hasPurviewOP("MedicalRecord_update"))
                {
                    Response.Redirect("edit.aspx?id=" + intId.ToString() + "&page=" + ViewState["page"]);
                }
                else
                {
                    string strUrl = "list.aspx?page=" + ViewState["page"];
                    HelperUtility.showAlert("没有操作权限", strUrl);
                }
            }
            else if (e.CommandName == "del")
            {
                if (HelperUtility.hasPurviewOP("MedicalRecord_del"))
                {
                    BllMedicalRecord.deleteById(intId);
                }
                else
                {
                    string strUrl = "list.aspx?page=" + ViewState["page"];
                    HelperUtility.showAlert("没有操作权限", strUrl);
                }
            }
            LoadDataPage();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int intAdminId = HelperUtility.hasPurviewPage("MedicalRecord_update");
                ViewState["AdminId"] = intAdminId;
                // 本页只能从list.aspx的编辑页转过来
                // 因此要得到要修改的id值和页面的page值用于修改成功后返回
                int intId = HelperUtility.getQueryInt("id");
                ViewState["id"] = intId;
                int intPage = HelperUtility.getQueryInt("page");
                ViewState["page"] = intPage;
                // 根据入库单id查询得到入库单model
                ModelMedicalRecord model = BllMedicalRecord.getById(intId);

                tbSickbedNumber.Value         = model.sickbed_number;
                tbNameReal.Value              = model.name_real;
                rblSex.SelectedValue          = model.sex;
                tbBirthday.Value              = model.birthday.ToString("yyyy-MM-dd");
                tbDepartment.Value            = model.department;
                tbNameDisease.Value           = model.name_disease;
                tbTimeIn.Value                = model.time_in.ToString("yyyy-MM-dd");
                tbTimeOut.Value               = model.time_out.ToString("yyyy-MM-dd");
                cblSituationOut.SelectedValue = model.situation_out;
                tbComment.Text                = model.comment;
                string strPhotoUrls = model.photo_urls;
                if (!"".Equals(strPhotoUrls))
                {
                    string        strImgUrl, strJS;
                    List <string> listPhotoUrls = strPhotoUrls.Split(',').ToList();
                    intPhotoAmounts = listPhotoUrls.Count;
                    for (int i = 0; i < intPhotoAmounts; i++)
                    {
                        strImgUrl = listPhotoUrls[i];
                        strJS     = "<div id=\"img-" + i + "\" class=\"wrapper-photo-show\">";
                        strJS    += "<img width=\"100\" height=\"100\" src=\"" + strImgUrl + "\" /><br />";
                        strJS    += "<input type=\"button\" id=\"btnDelPhoto\" class=\"btn btn-sm btn-warning\"" +
                                    " onclick=\"delPhoto(" + i + ")\" value=\"删除\" /></div>";
                        ltrShowPhoto.Text += strJS;
                    }
                }
                tbPhotoUrls.Value = strPhotoUrls;
            }
        }
示例#3
0
        private int intRecordCount = 0;  //总记录数

        public void LoadDataPage()
        {
            DataTable objDT;

            if ("".Equals(lblCurentPage.Text.Trim()))
            {
                lblCurentPage.Text = "1";
            }
            intCurrentPage = Convert.ToInt32(lblCurentPage.Text.Trim());
            if (intCurrentPage <= 0)
            {
                intCurrentPage = 1;
            }
            // 得到总记录数
            intRecordCount = BllMedicalRecord.getRecordsAmount();
            // 计算总页数
            intPageCount = (intRecordCount + intPageSize - 1) / intPageSize;
            if (intCurrentPage > intPageCount)
            {
                intCurrentPage = intPageCount;
            }
            lblPageCount.Text = intPageCount.ToString();
            // 根据当前页获取当前页的分页记录DataTable
            if (intRecordCount > 0)
            {
                objDT = BllMedicalRecord.getPage(intCurrentPage, intPageSize);
            }
            else
            {
                lblCurentPage.Text = "1";
                objDT = null;
            }
            if (objDT != null && objDT.Rows.Count > 0)
            {
                lbtnFirst.Enabled = true;
                lbtnPrev.Enabled  = true;
                lbtnNext.Enabled  = true;
                lbtnLast.Enabled  = true;
                if (intCurrentPage == 1)
                {
                    lbtnFirst.Enabled = false;
                    lbtnPrev.Enabled  = false;
                }
                if (intCurrentPage == intPageCount)
                {
                    lbtnNext.Enabled = false;
                    lbtnLast.Enabled = false;
                }
            }
            else
            {
                lbtnFirst.Enabled = false;
                lbtnPrev.Enabled  = false;
                lbtnNext.Enabled  = false;
                lbtnLast.Enabled  = false;
            }
            gvShow.DataSource = objDT;
            gvShow.DataBind();
            lblRecordCount.Text = intRecordCount.ToString();
            lblCurentPage.Text  = intCurrentPage.ToString();
            tbPageNum.Text      = intCurrentPage.ToString();
            ViewState["page"]   = intCurrentPage;
        }
示例#4
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (!HelperUtility.hasPurviewOP("MedicalRecord_update"))
            {
                HelperUtility.showAlert("没有操作权限", "/BackManager/home.aspx");
            }
            int    intAdminId       = Convert.ToInt32(ViewState["AdminId"]);
            int    intId            = Convert.ToInt32(ViewState["id"]);
            int    intPage          = Convert.ToInt32(ViewState["page"]);
            string strThisPageUrl   = "edit.aspx?id=" + intId + "&page=" + intPage;
            string strMsgError      = "";
            string strSickbedNumber = tbSickbedNumber.Value.Trim();
            string strNameReal      = tbNameReal.Value.Trim();
            string strBirthday      = tbBirthday.Value.Trim();
            string strDepartment    = tbDepartment.Value.Trim();
            string strNameDisease   = tbNameDisease.Value.Trim();
            string strTimeIn        = tbTimeIn.Value.Trim();
            string strTimeOut       = tbTimeOut.Value.Trim();
            string strPhotoUrls     = tbPhotoUrls.Value.Trim();
            string strComment       = tbComment.Text.Trim();

            if ("".Equals(strNameReal))
            {
                strMsgError += "姓名不能为空!\n";
            }
            if ("".Equals(strBirthday))
            {
                strMsgError += "出生年月不能为空!\n";
            }
            if ("".Equals(strNameDisease))
            {
                strMsgError += "疾病名称不能为空!\n";
            }
            if ("".Equals(strTimeIn))
            {
                strMsgError += "入院日期不能为空!\n";
            }
            if ("".Equals(strTimeOut))
            {
                strMsgError += "出院日期不能为空!\n";
            }
            if (!HelperUtility.isDateType(strBirthday))
            {
                strMsgError += "出生年月格式不正确!\n";
            }
            if (!HelperUtility.isDateType(strTimeIn))
            {
                strMsgError += "入院日期格式不正确!\n";
            }
            if (!HelperUtility.isDateType(strTimeOut))
            {
                strMsgError += "出院日期格式不正确!\n";
            }
            if (!"".Equals(strMsgError))
            {
                HelperUtility.showAlert(strMsgError, strThisPageUrl);
            }
            // 验证完毕,提交数据
            ModelMedicalRecord model = BllMedicalRecord.getById(intId);

            model.sickbed_number = strSickbedNumber;
            model.name_real      = strNameReal;
            model.sex            = rblSex.SelectedValue.Trim();
            model.birthday       = Convert.ToDateTime(strBirthday);
            model.department     = strDepartment;
            model.name_disease   = strNameDisease;
            model.time_in        = Convert.ToDateTime(strTimeIn);
            model.time_out       = Convert.ToDateTime(strTimeOut);
            model.situation_out  = cblSituationOut.SelectedValue;
            model.photo_urls     = strPhotoUrls;
            model.comment        = strComment;
            // 更新数据库记录
            BllMedicalRecord.update(model);
            // 跳转回列表页
            Response.Redirect("/BackManager/medical_record/list.aspx?page=" + intPage);
        }
示例#5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (!HelperUtility.hasPurviewOP("MedicalRecord_add"))
            {
                string strUrl = "/BackManager/home.aspx";
                HelperUtility.showAlert("没有操作权限", strUrl);
            }
            string strMsgError      = "";
            string strSickbedNumber = tbSickbedNumber.Value.Trim();
            string strNameReal      = tbNameReal.Value.Trim();
            string strBirthday      = tbBirthday.Value.Trim();
            string strDepartment    = tbDepartment.Value.Trim();
            string strNameDisease   = tbNameDisease.Value.Trim();
            string strTimeIn        = tbTimeIn.Value.Trim();
            string strTimeOut       = tbTimeOut.Value.Trim();
            string strSituationOut  = cblSituationOut.SelectedValue;
            string strSituationIn   = "";
            string strPhotoUrls     = tbPhotoUrls.Value.Trim();
            string strComment       = tbComment.Text.Trim();
            int    intAdminId       = Convert.ToInt32(ViewState["AdminId"]);

            if ("".Equals(strNameReal))
            {
                strMsgError += "姓名不能为空!\n";
            }
            if ("".Equals(strBirthday))
            {
                strMsgError += "出生年月不能为空!\n";
            }
            if ("".Equals(strNameDisease))
            {
                strMsgError += "疾病名称不能为空!\n";
            }
            if ("".Equals(strTimeIn))
            {
                strMsgError += "入院日期不能为空!\n";
            }
            if ("".Equals(strTimeOut))
            {
                strMsgError += "出院日期不能为空!\n";
            }
            if (!HelperUtility.isDateType(strBirthday))
            {
                strMsgError += "出生年月格式不正确!\n";
            }
            if (!HelperUtility.isDateType(strTimeIn))
            {
                strMsgError += "入院日期格式不正确!\n";
            }
            if (!HelperUtility.isDateType(strTimeOut))
            {
                strMsgError += "出院日期格式不正确!\n";
            }
            if (!"".Equals(strMsgError))
            {
                HelperUtility.showAlert(strMsgError, "add.aspx");
            }
            // 验证完毕,提交数据
            ModelMedicalRecord model = new ModelMedicalRecord();

            model.sickbed_number = strSickbedNumber;
            model.name_real      = strNameReal;
            model.sex            = rblSex.SelectedValue.Trim();
            model.birthday       = Convert.ToDateTime(strBirthday);
            model.department     = strDepartment;
            model.name_disease   = strNameDisease;
            model.time_in        = Convert.ToDateTime(strTimeIn);
            model.time_out       = Convert.ToDateTime(strTimeOut);
            model.situation_out  = strSituationOut;
            model.situation_in   = strSituationIn;
            model.photo_urls     = strPhotoUrls;
            model.comment        = strComment;
            model.time_create    = DateTime.Now;
            model.id_admin       = intAdminId;
            model.is_deleted     = 0;

            int intId = BllMedicalRecord.add(model);

            if (intId > 0)
            {
                string strUrl = "list.aspx";
                HelperUtility.showAlert("添加成功!", strUrl);
            }
            else
            {
                string strUrl = "add.aspx";
                HelperUtility.showAlert("添加失败,请联系管理员!", strUrl);
            }
        }