示例#1
0
 /// <summary>
 /// 绑定前端页面空间信息
 /// </summary>
 /// <param name="drug"></param>
 private void BindInfoDrug(Med_Model.Drug drug)
 {
     this.txtDrugName.Text = drug.Name;
     this.txtDrugUpperName.Text = drug.UpperName;
     this.txtDrugLowerName.Text = drug.LowerName;
     this.txtDrugPrice.Text = drug.Price.ToString();
     this.ddDrugStoreId.SelectedValue = Convert.ToString(drug.DrugStoreId);
     if (manager.Level == 2)
     {
         this.ddDrugStoreId.Enabled = false;
     }
 }
示例#2
0
        /// <summary>
        /// 检查用户输入的输入,合乎要求返回实体对象,前端已经校验了,后端再校验 一次,安全性
        /// </summary>
        /// <param name="patient"></param>
        private void CheckTheData(ref Med_Model.Patient patient, string action)
        {
            if (string.IsNullOrEmpty(this.txtName.Text))
            {
                MessageBox.Show(this.Page, "姓名不能为空");
                this.txtName.Focus(); //获得焦点
                return;
            }
            string name = this.txtName.Text.Trim();

            if (string.IsNullOrEmpty(this.txtIdCard.Text))
            {
                MessageBox.Show(this.Page, "身份证不能为空");
                this.txtIdCard.Focus(); //获得焦点
                return;
            }
            string idCard = this.txtIdCard.Text.Trim();

            if (string.IsNullOrEmpty(this.txtTel.Text))
            {
                MessageBox.Show(this.Page, "联系电话不能为空");
                this.txtTel.Focus(); //获得焦点
                return;
            }
            string tel = this.txtTel.Text.Trim();

            int helpNums;
            int? helpNumsBalance;
            if (string.IsNullOrEmpty(this.txtHelpNums.Text) || !int.TryParse(this.txtHelpNums.Text.Trim(), out helpNums))
            {
                MessageBox.Show(this.Page, "救助次数不能为空");
                this.txtHelpNums.Focus(); //获得焦点
                return;
            }

            float helpScale;
            if (string.IsNullOrEmpty(this.txtHelpScale.Text) || !float.TryParse(this.txtHelpScale.Text.Trim(), out helpScale))
            {
                MessageBox.Show(this.Page, "报销比例填写不正确");
                this.txtHelpScale.Focus(); //获得焦点
                return;
            }

            decimal HelpMax;
            decimal? HelpMaxBalance;
            if (string.IsNullOrEmpty(this.txtHelpMax.Text) || !decimal.TryParse(this.txtHelpMax.Text.Trim(), out HelpMax))
            {
                MessageBox.Show(this.Page, "封顶线填写不正确");
                this.txtHelpMax.Focus(); //获得焦点
                return;
            }

            decimal cliMoney;
            if (string.IsNullOrEmpty(this.txtCliMoney.Text) || !decimal.TryParse(this.txtCliMoney.Text.Trim(), out cliMoney))
            {
                MessageBox.Show(this.Page, "门诊金额填写不正确");
                this.txtCliMoney.Focus(); //获得焦点
                return;
            }

            decimal phaMoney;
            if (string.IsNullOrEmpty(this.txtPhaMoney.Text) || !decimal.TryParse(this.txtPhaMoney.Text.Trim(), out phaMoney))
            {
                MessageBox.Show(this.Page, "药店金额填写不正确");
                this.txtPhaMoney.Focus(); //获得焦点
                return;
            }
            decimal cliBalance;
            decimal phaBalance;
            //编辑状态下
            if (action == "edit")
            {
                if (string.IsNullOrEmpty(this.txtCliBalance.Text) ||
                    !decimal.TryParse(this.txtCliBalance.Text.Trim(), out cliBalance))
                {
                    MessageBox.Show(this.Page, "门诊余额填写不正确");
                    this.txtCliBalance.Focus(); //获得焦点
                    return;
                }
                if (string.IsNullOrEmpty(this.txtPhaBalance.Text) ||
                    !decimal.TryParse(this.txtPhaBalance.Text.Trim(), out phaBalance))
                {
                    MessageBox.Show(this.Page, "药店余额填写不正确");
                    this.txtPhaBalance.Focus(); //获得焦点
                    return;
                }
            }
            //添加状态
            else
            {
                //此状态下,余额即当前金额
                cliBalance = cliMoney;
                phaBalance = phaMoney;
                patient.HosId = null;
                patient.IsHos = 0;
            }
            if (this.ddHome.SelectedIndex == 0)
            {
                MessageBox.Show(this.Page, "必须选择救助对象所属乡镇");
                this.ddHome.Focus();//获得焦点
                return;
            }
            if (this.ddPatientClass.SelectedIndex == 0)
            {
                MessageBox.Show(this.Page, "必须选择救助对象类型");
                this.ddPatientClass.Focus();//获得焦点
                return;
            }
            if (this.ddHelpClass.SelectedIndex == 0)
            {
                MessageBox.Show(this.Page, "必须选择救助对象 救助类型");
                this.ddHelpClass.Focus();//获得焦点
                return;
            }
            //赋值
            patient.Name = name;
            patient.Sex = this.rblSex.SelectedValue;
            patient.IdCard = idCard;
            patient.Birthday = this.txtBrisday.Text.Trim();
            patient.Tel = tel;
            patient.HomeId = int.Parse(this.ddHome.SelectedValue);
            patient.HomeDetails = (!string.IsNullOrEmpty(this.txtDetails.Text.Trim())) ? this.txtDetails.Text.Trim() : ""; //获取详细地址 ,为空判断
            patient.HelpId = string.IsNullOrEmpty(this.txtHelpId.Text) ? default(string) : this.txtHelpId.Text.Trim(); //救助编号 有填则为用户填写值,否则未默认null
            patient.PatientClass = int.Parse(this.ddPatientClass.SelectedValue);
            patient.HelpClass = int.Parse(this.ddHelpClass.SelectedValue);
            patient.HelpNums = helpNums;
            patient.HelpScale = Convert.ToString(helpScale);
            patient.HelpMax = HelpMax;

            patient.CliMoney = cliMoney;
            patient.CliBalance = cliBalance;
            patient.PhaMoney = phaMoney;
            patient.PhaBalance = phaBalance;
            patient.AddTime = DateTime.Now;
        }
        /// <summary>
        /// 检查用户输入的输入,合乎要求返回实体对象
        /// </summary>
        /// <param name="manager"></param>
        private void CheckTheData(ref Med_Model.Manager manager)
        {
            if (this.ddlRoleId.SelectedIndex == 0)
            {
                MessageBox.Show(this.Page, "角色编号必须选择");
                return;
            }
            if (string.IsNullOrEmpty(this.ddlDept.SelectedValue))
            {
                MessageBox.Show(this.Page, "部门必须选择");
                return;
            }
            if (string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
            {
                MessageBox.Show(this.Page, "用户名不能为空");
                this.txtUserName.Focus(); //获得焦点
                return;
            }
            if (string.IsNullOrEmpty(this.txtPassword.Text.Trim()) || string.IsNullOrEmpty(this.txtPassword1.Text.Trim()) || (!string.Equals(this.txtPassword.Text.Trim(), this.txtPassword.Text.Trim())))
            {
                MessageBox.Show(this.Page, "密码填写不正确");
                this.txtPassword.Focus(); //获得焦点
                return;
            }

            if (string.IsNullOrEmpty(this.txtRealName.Text.Trim()))
            {
                MessageBox.Show(this.Page, "真实姓名不能为空");
                this.txtRealName.Focus(); //获得焦点
                return;
            }
            long tel;
            if (string.IsNullOrEmpty(this.txtTelephone.Text.Trim()) || !long.TryParse(this.txtTelephone.Text.Trim(), out tel))
            {
                MessageBox.Show(this.Page, "电话号码不正确");
                this.txtTelephone.Focus(); //获得焦点
                return;
            }
            //赋值
            manager.RoleId = int.Parse(this.ddlRoleId.SelectedValue);
            manager.DeptId = int.Parse(this.ddlDept.SelectedValue);
            manager.UserName = this.txtUserName.Text.Trim();
            manager.RealName = this.txtRealName.Text.Trim();
            manager.Tel = tel.ToString();
            manager.IsLock = this.cbIsLock.Checked ? 0 : 1;
            manager.AddTime = DateTime.Now;
            manager.UserSalt = Utils.GetCheckCode(6);
            manager.UserPwd = DESEncrypt.Encrypt(this.txtPassword.Text.Trim().Trim(), manager.UserSalt);
            manager.Level = int.Parse(this.ddlRoleId.SelectedValue) == 8 ? 1 : 2;  //系统管理员 level的等级为1
        }
        /// <summary>
        /// 检查用户输入的输入,合乎要求返回实体对象
        /// </summary>
        private void CheckTheData(ref Med_Model.HelpStandard helpStandard, string type)
        {
            if (string.IsNullOrEmpty(this.ddlDept.SelectedValue))
            {
                MessageBox.Show(this.Page, "救助类别必须选择");
                return;
            }
            if (string.IsNullOrEmpty(this.txtHelpMax.Text.Trim()))
            {
                MessageBox.Show(this.Page, "封顶线不能为空");
                this.txtHelpMax.Focus(); //获得焦点
                return;
            }
            if (string.IsNullOrEmpty(this.txtHelpNums.Text.Trim()))
            {
                MessageBox.Show(this.Page, "最大救助次数不能为空");
                this.txtHelpNums.Focus(); //获得焦点
                return;
            }
            if (string.IsNullOrEmpty(this.txtHelpScale.Text.Trim()))
            {
                MessageBox.Show(this.Page, "报销比例不能为空");
                this.txtHelpScale.Focus(); //获得焦点
                return;
            }
            if (string.IsNullOrEmpty(this.txtClinicMoney.Text.Trim()))
            {
                MessageBox.Show(this.Page, "门诊救助金额不能为空");
                this.txtClinicMoney.Focus(); //获得焦点
                return;
            }
            if (string.IsNullOrEmpty(this.txtDrugMoney.Text.Trim()))
            {
                MessageBox.Show(this.Page, "药店救助金额不能为空");
                this.txtDrugMoney.Focus(); //获得焦点
                return;
            }
            if (type == "edit")
            {
                helpStandard.Id = Convert.ToInt32(this.txtHelpStandardId.Value);
            }

            helpStandard.HelpTypeId = Convert.ToInt32(this.ddlDept.SelectedValue);
            helpStandard.HelpMax = Convert.ToDecimal(this.txtHelpMax.Text.Trim());
            helpStandard.HelpNums = Convert.ToInt32(this.txtHelpNums.Text.Trim());
            helpStandard.HelpScale = Convert.ToInt32(this.txtHelpScale.Text.Trim());
            helpStandard.ClinicMoney = Convert.ToDecimal(this.txtClinicMoney.Text.Trim());
            helpStandard.DrugMoney = Convert.ToDecimal(this.txtDrugMoney.Text.Trim());
            //把救助细则的选项拼接字符串,保存
            helpStandard.HelpDetails = Convert.ToString(this.rbHosTotalMoneyYes.Checked ? 1 : 0) + "," + Convert.ToString(this.rbMeetHospitalYes.Checked ? 1 : 0) + "," + Convert.ToString(this.rbHospitalDiscountYes.Checked ? 1 : 0) + "," + (string.IsNullOrEmpty(this.txtFloatMoney.Text) ? 0 : Convert.ToDecimal(this.txtFloatMoney.Text));
        }
        /// <summary>
        /// 绑定页面控件信息
        /// </summary>
        /// <param name="manager"></param>
        private void BindInfoByManager(Med_Model.Manager manager)
        {
            this.ddlRoleId.SelectedValue = manager.RoleId.ToString();
            if (manager.DeptId != 0)
            {
                this.ddlDept.SelectedValue = manager.DeptId.ToString();
            }
            else
            {
                BindDeptByRoleId(manager.RoleId);
            }
            this.cbIsLock.Checked = manager.IsLock == 0 ? true : false;  //设置此帐户是否被锁定
            this.txtUserName.Text = manager.UserName;
            this.txtUserName.ReadOnly = true; //设置用户名相关样式  用户名不能更改
            this.txtRealName.Text = manager.RealName;
            this.txtTelephone.Text = manager.Tel;

            if (!string.IsNullOrEmpty(manager.UserPwd)) //简单判断密码
            {
                this.txtPassword.Attributes["value"] = this.txtPassword1.Attributes["value"] = "0|0|0|0";
            }
        }