예제 #1
0
    private void SaveDataToDB(DataTable SourceTable)
    {
        RegistrationViewEntity RegInfo;
        Regex  regex = new Regex(@"/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/");
        String IDNumber, PackageName, PersonName;
        int    DeptID = 1;

        using (RegistrationBusiness Registration = new RegistrationBusiness()) {
            DataRowCollection Rows = SourceTable.Rows;
            if (Rows.Count > 0)
            {
                DeptID = GetDeptID(Rows[0][0] + "");
                if (DeptID == int.MinValue)
                {
                    ShowMessage("该体检单位在系统中不存在,请在体检单位设置中录入该体检单位!");
                    return;
                }
            }
            foreach (DataRow Row in Rows)
            {
                PackageName = Row[7] + "";
                PersonName  = Row[1] + "";
                if (String.IsNullOrWhiteSpace(PackageName))
                {
                    continue;
                }
                if (String.IsNullOrWhiteSpace(PersonName))
                {
                    continue;
                }
                RegInfo              = new RegistrationViewEntity();
                RegInfo.DeptID       = DeptID;
                RegInfo.RegisterDate = DateTime.Now.Date;
                RegInfo.CheckDate    = DateTime.Now.Date;
                RegInfo.Name         = PersonName;
                RegInfo.Sex          = Row[2] + "";
                IDNumber             = Row[3] + "";
                RegInfo.Age          = EnvConverter.ToInt32(Row[5] + "");
                if (regex.IsMatch(IDNumber))
                {
                    RegInfo.IDNumber = IDNumber;
                    RegInfo.Birthday = GetBirthday(IDNumber);
                    RegInfo.Age      = GetAge(IDNumber);
                    RegInfo.Sex      = GetSex(IDNumber);
                }
                RegInfo.Marriage  = Row[4] + "";
                RegInfo.LinkTel   = Row[6] + "";
                RegInfo.PackageID = GetPackage(PackageName, RegInfo.Sex, RegInfo.Marriage);
                if (RegInfo.PackageID == null)
                {
                    ShowMessage(String.Format("该套餐{0}在系统中不存在,请在套餐设置中录入该套餐!", PackageName));
                    continue;
                }
                RegInfo.Mobile = RegInfo.LinkTel;
                Registration.SaveRegistration(RegInfo);
            }
        }
    }
예제 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RegistrationViewEntity Result = GetRegistrationUI();

        m_Registration.SaveRegistration(Result);
        RegisterNo = Result.RegisterNo;
        ShowMessage("体检登记数据保存成功!");
        //int Succeed = m_Registration.SaveRegistration(Result);
        //if (Succeed > 0) ShowMessage("数据保存成功!");
        //if (Succeed < 0) ShowMessage("数据保存失败!");
        DataBind();
        BindCheckedGroups(Result.RegisterNo);
        SetUIState("Default");
    }