protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);
        int    pgNow;
        int    pgSize;
        int    CountyID = 0;
        int    TownID   = 0;
        string BirthDateS;
        string BirthDateE;
        string CaseName;
        string CaseIdNo;
        string SearchReason;
        string SearchConditions = "";
        int    SearcResultCount = 0;
        int    IsSearch         = 0;
        int    SearchKind       = 3;


        BirthDateS = Request.Form["BirthDateS"] ?? "";
        BirthDateE = Request.Form["BirthDateE"] ?? "";
        if (BirthDateS != "")
        {
            try
            {
                //BirthDateS = Convert.ToDateTime(BirthDateS).ToString("yyyyMMdd");
                BirthDateS = TaiwanYear.ToDateTime(BirthDateS).ToString("yyyyMMdd");
            }
            catch {
                BirthDateS = "";
            }
        }
        if (BirthDateE != "")
        {
            try
            {
                // BirthDateE = Convert.ToDateTime(BirthDateE).ToString("yyyyMMdd");
                BirthDateE = TaiwanYear.ToDateTime(BirthDateE).ToString("yyyyMMdd");
            }
            catch
            {
                BirthDateE = "";
            }
        }

        CaseName = Request.Form["CaseName"] ?? "";
        CaseIdNo = Request.Form["CaseIdNo"] ?? "";


        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        int.TryParse(Request.Form["CountyID"], out CountyID);
        int.TryParse(Request.Form["TownID"], out TownID);
        int.TryParse(Request.Form["IsSearch"], out IsSearch);
        SearchReason = Request.Form["SearchReason"] ?? "";


        List <UserProfileListVM> list = new List <UserProfileListVM>();
        PageVM  rtn = new PageVM();
        DataSet ds  = new DataSet();


        try
        {
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetUserList", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pgNow", pgNow == 0 ? 1 : pgNow);
                    cmd.Parameters.AddWithValue("@pgSize", pgSize == 0 ? 10 : pgSize);
                    cmd.Parameters.AddWithValue("@BirthDateS", BirthDateS);
                    cmd.Parameters.AddWithValue("@BirthDateE", BirthDateE);
                    cmd.Parameters.AddWithValue("@CaseName", CaseName);
                    cmd.Parameters.AddWithValue("@CaseIdNo", CaseIdNo);
                    cmd.Parameters.AddWithValue("@CountyID", CountyID);
                    cmd.Parameters.AddWithValue("@TownID", TownID);
                    //cmd.Parameters.AddWithValue("@IsSearch", IsSearch);
                    //cmd.Parameters.AddWithValue("@SearchReason", SearchReason);

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(ds);
                    }
                }
            }

            SearcResultCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);

            EntityS.FillModel(list, ds.Tables[0]);
            EntityS.FillModel(rtn, ds.Tables[1]);
        }
        catch
        {
        }
        finally {
            //記下查詢紀錄

            if (IsSearch == 1)
            {
                if (CaseName != "")
                {
                    SearchConditions += "姓名:" + CaseName;
                }
                if (CaseIdNo != "")
                {
                    SearchConditions += "身份證號:" + CaseIdNo;
                }
                if (BirthDateS != "")
                {
                    SearchConditions += "生日起日:" + BirthDateS;
                }
                if (BirthDateE != "")
                {
                    SearchConditions += "生日迄日:" + BirthDateE;
                }
                if (CountyID != 0)
                {
                    SearchConditions += "戶籍縣市:" + SystemAreaCode.GetName(CountyID);
                }
                if (TownID != 0)
                {
                    SearchConditions += "戶籍鄉鎮:" + SystemAreaCode.GetName(TownID);
                }

                Session["SearchID"] = Convert.ToInt32(DBUtil.DBOp("ConnDB", " exec [dbo].[usp_CaseUser_xAddSearchLog] {0}, {1}, {2} ,{3} ,{4}", new string[] { AuthServer.GetLoginUser().ID.ToString(), SearchConditions, SearchReason, SearcResultCount.ToString(), SearchKind.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar));
            }
        }
        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
Example #2
0
    protected void CompareCaseUser()
    {
        string Col = "";

        if (Session["ModifiedCaseToCheck"] != null)
        {
            //欲修改資料
            m = (CaseUserProfile)Session["ModifiedCaseToCheck"];
            //原資料
            c = new CaseUserProfile(m.CaseID);


            foreach (PropertyInfo prop in c.GetType().GetProperties())
            {
                string ValBefore = Convert.ToString(GetProperty(c, prop.Name));
                string ValAfter  = Convert.ToString(GetProperty(m, prop.Name));
                if (ValBefore != ValAfter)
                {
                    Col += prop.Name + ",";
                }
                //取得有變動的屬性
            }
            #region MyRegion


            //if (m.BirthDate != c.BirthDate) Col += GetPropertyName(() => c.BirthDate) + ",";
            //if (m.IdNo != c.IdNo) Col += GetPropertyName(() => c.IdNo) + ",";
            //if (m.PassportNo != c.PassportNo) Col += GetPropertyName(() => c.PassportNo) + ",";
            //if (m.ResNo != c.ResNo) Col += GetPropertyName(() => c.ResNo) + ",";
            //if (m.ChName != c.ChName) Col += GetPropertyName(() => c.ChName) + ",";
            //if (m.Gender != c.Gender) Col += GetPropertyName(() => c.Gender) + ",";
            //if (m.HouseNo != c.HouseNo) Col += GetPropertyName(() => c.HouseNo) + ",";
            //if (m.ResCounty != c.ResCounty) Col += GetPropertyName(() => c.ResCounty) + ",";
            //if (m.ResTown != c.ResTown) Col += GetPropertyName(() => c.ResTown) + ",";
            //if (m.PregWeek != c.PregWeek) Col += GetPropertyName(() => c.PregWeek) + ",";
            //if (m.BirthNum != c.BirthNum) Col += GetPropertyName(() => c.BirthNum) + ",";
            //if (m.BirthSeq != c.BirthSeq) Col += GetPropertyName(() => c.BirthSeq) + ",";
            //if (m.BirthWeight != c.BirthWeight) Col += GetPropertyName(() => c.BirthWeight) + ",";
            //if (m.BirthPlace != c.BirthPlace) Col += GetPropertyName(() => c.BirthPlace) + ",";
            //if (m.Deliver != c.Deliver) Col += GetPropertyName(() => c.Deliver) + ",";
            //if (m.DeliverOrg != c.DeliverOrg) Col += GetPropertyName(() => c.DeliverOrg) + ",";
            //if (m.MarryStatus != c.MarryStatus) Col += GetPropertyName(() => c.MarryStatus) + ",";
            //if (m.ResVillage != c.ResVillage) Col += GetPropertyName(() => c.ResVillage) + ",";
            //if (m.ResAddr != c.ResAddr) Col += GetPropertyName(() => c.ResAddr) + ",";
            //if (m.ResNei != (c.ResNei == "0" ? "" : c.ResNei)) Col += GetPropertyName(() => c.ResNei) + ",";
            //if (m.EnName != c.EnName) Col += GetPropertyName(() => c.EnName) + ",";
            //if (m.OtherNo != c.OtherNo) Col += GetPropertyName(() => c.OtherNo) + ",";
            #endregion
            //這些欄位需要上傳file


            //再去看哪些需要 uploadfile



            if (Col != "")
            {
                #region 再去看哪些需要 uploadfile
                DataTable dt = (DataTable)DBUtil.DBOp("ConnDB"
                                                      , " SELECT NiisFieldName ,  ID, FieldDiscription, FileToCheck,SystemCodeKey  FROM   C_CaseCheck_FieldCheck where NiisFieldName in (select data from dbo.fn_slip_str({0},',') ) "
                                                      , new string[] { Col }
                                                      , NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);


                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        string ViewBefore    = Convert.ToString(GetProperty(c, r["NiisFieldName"].ToString()));
                        string ViewAfter     = Convert.ToString(GetProperty(m, r["NiisFieldName"].ToString()));
                        string ValBefore     = Convert.ToString(GetProperty(c, r["NiisFieldName"].ToString()));
                        string ValAfter      = Convert.ToString(GetProperty(m, r["NiisFieldName"].ToString()));
                        string SystemCodeKey = r["SystemCodeKey"].ToString();

                        if (SystemCodeKey != "")
                        {
                            if (SystemCodeKey.Contains("County") || SystemCodeKey.Contains("Town") || SystemCodeKey.Contains("Village"))
                            {
                                ViewBefore = SystemAreaCode.GetName(Convert.ToInt32(Convert.ToString(GetProperty(c, r["NiisFieldName"].ToString()))));
                                ViewAfter  = SystemAreaCode.GetName(Convert.ToInt32(Convert.ToString(GetProperty(m, r["NiisFieldName"].ToString()))));
                            }
                            else
                            {
                                int iViewBefore = 0;
                                int.TryParse(Convert.ToString(GetProperty(c, r["NiisFieldName"].ToString())), out iViewBefore);
                                int iViewAfter = 0;
                                int.TryParse(Convert.ToString(GetProperty(m, r["NiisFieldName"].ToString())), out iViewAfter);

                                ViewBefore = SystemCode.GetName(r["SystemCodeKey"].ToString(), iViewBefore);
                                ViewAfter  = SystemCode.GetName(r["SystemCodeKey"].ToString(), iViewAfter);
                            }
                        }

                        CheckFieldVM cf = new CheckFieldVM();
                        cf.ID               = Convert.ToInt32(r["ID"]);
                        cf.FieldName        = r["NiisFieldName"].ToString();
                        cf.FieldDiscription = r["FieldDiscription"].ToString();
                        cf.ValBefore        = ValBefore;
                        cf.ValAfter         = ValAfter;
                        cf.ViewBefore       = ViewBefore;
                        cf.ViewAfter        = ViewAfter;
                        cf.FileCheck        = r["FileToCheck"].ToString();
                        CheckFieldVMList.Add(cf);
                        //變成一個list 之後好操作
                    }
                }
                #endregion
            }
        }


        if (Col == "" || CheckFieldVMList.Count == 0)
        {
            Response.Redirect("UserProfileList.aspx");
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        ViewPower   = base.GetPower(PowerList[0]);
        UpdatePower = base.GetPower(PowerList[1]);

        ElementarySchoolID = GetNumber <int>("i");

        if (ElementarySchoolID == 0)
        {
            IsValid = false;
            string script = "<script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }
        if (this.IsPostBack == false)
        {
            uc1.TableName = "O_OrgLog";
            uc1.WhereDict = new Dictionary <string, object>()
            {
                { "@OrgID", ID }
            };

            DataTable dt = GetDataTable("ConnDB", "dbo.usp_CodeM_xGetElementarySchoolByID"
                                        , new Dictionary <string, object>()
            {
                { "@ElementarySchoolID", ElementarySchoolID }
            });
            SchoolCodeVM VM = new SchoolCodeVM();
            EntityS.FillModel(VM, dt);

            tbName.Text    = VM.SchoolName;
            tbCode.Text    = VM.SchoolCode;
            tbTel.Text     = VM.SchoolPhoneNumber;
            tbAddress.Text = VM.SchoolAddress;

            County  = VM.SchoolCounty;
            Town    = VM.SchoolTown;
            Village = VM.SchoolVillage;

            CountyName  = SystemAreaCode.GetName(VM.SchoolCounty);
            TownName    = SystemAreaCode.GetName(VM.SchoolTown);
            VillageName = SystemAreaCode.GetName(VM.SchoolVillage);

            var codes = SystemCode.dict["CodeM_SchoolCode_EnableState"];

            ddEnState.Items.Add(new ListItem("請選擇", "0"));
            foreach (var item in codes)
            {
                ddEnState.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
            }

            ddEnState.SelectedValue = VM.EnableState.ToString();

            CountyJson  = JsonConvert.SerializeObject(SystemAreaCode.GetCountyList());
            TownJson    = JsonConvert.SerializeObject(SystemAreaCode.GetTownList(County));
            VillageJson = JsonConvert.SerializeObject(SystemAreaCode.GetVillageList(Town));
        }
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        ViewPower   = base.GetPower(PowerList[0]);
        UpdatePower = base.GetPower(PowerList[1]);

        //if (UpdatePower.HasPower)
        //{
        //    form1.DefaultButton = "btnSave";
        //}

        ID         = GetNumber <int>("i");
        ContractID = GetNumber <int>("i2");

        if (ID == 0)
        {
            IsValid = false;
            string script = "<script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        if (UpdatePower.HasPower == false)
        {
            tbAddress.Enabled  = false;
            tbTel.Enabled      = false;
            tbVaccine.Enabled  = false;
            ddlAgState.Enabled = false;
            //tbDepartment.Enabled = false;
        }
        if (this.IsPostBack == false)
        {
            uc1.TableName = "O_OrgLog";
            uc1.WhereDict = new Dictionary <string, object>()
            {
                { "@OrgID", ID }
            };

            DataSet ds = MSDB.GetDataSet("ConnDB", "dbo.usp_ParameterM_xGetAgencyByID"
                                         , new Dictionary <string, object>()
            {
                { "@AgencyInfoID", ID }
            });

            AgencyInfoVM        VM        = new AgencyInfoVM();
            List <AddVaccineVM> list      = new List <AddVaccineVM>();
            OrgContractVM       VM2       = new OrgContractVM();
            List <DayTimeVM>    ddListIn  = new List <DayTimeVM>();
            List <DayTimeVM>    ddListOut = new List <DayTimeVM>();
            EntityS.FillModel(VM, ds.Tables[0]);
            EntityS.FillModel(list, ds.Tables[1]);
            EntityS.FillModel(VM2, ds.Tables[2]);
            EntityS.FillModel(ddListIn, ds.Tables[3]);

            foreach (var item in ddListIn)
            {
                DayTimeVM inVM = new DayTimeVM();
                inVM.ID        = item.ID;
                inVM.Monday    = item.Monday;
                inVM.Tuesday   = item.Tuesday;
                inVM.Wednesday = item.Wednesday;
                inVM.Thursday  = item.Thursday;
                inVM.Friday    = item.Friday;
                inVM.Saturday  = item.Saturday;
                inVM.Sunday    = item.Sunday;
                inVM.TimeAry   = new List <Dictionary <string, string> >();
                foreach (DataRow dr in ds.Tables[4].Rows)
                {
                    if (item.ID == Convert.ToInt32(dr["BusinesssDayID"].ToString()))
                    {
                        Dictionary <string, string> ssee = new Dictionary <string, string>();
                        ssee.Add("ss", dr["StartTime"].ToString().Substring(0, 5));
                        ssee.Add("ee", dr["StartTime"].ToString().Substring(0, 5));
                        inVM.TimeAry.Add(ssee);
                    }
                }

                ddListOut.Add(inVM);
            }


            if (ddListOut.Count > 0)
            {
                ddListOutAry = JsonConvert.SerializeObject(ddListOut);
            }

            if (VM2.ID > 0)
            {
                ContractID       = VM2.ID;
                tbDateStart.Text = VM2.ContractStart.ToShortTaiwanDate();
                tbDateEnd.Text   = VM2.ContractEnd.ToShortTaiwanDate();
                tbDateStop.Text  = VM2.ContractStop.ToShortTaiwanDate();

                if (tbDateStart.Text.Length == 0)
                {
                    tbDateStart.Text = DateTime.Now.ToShortTaiwanDate();
                }
            }

            var dict = SystemCode.GetDict("LocationSettingM_Divisions");

            StateListAry = JsonConvert.SerializeObject(dict);

            var codes = SystemCode.dict["ParameterM_LocationSetting_AgencyState"];

            ddlAgState.Items.Add(new ListItem("請選擇", ""));
            foreach (var item in codes)
            {
                ddlAgState.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
            }

            ddlAgState.SelectedValue = VM.AgencyState.ToString();
            AgencyState = VM.AgencyState.ToString();

            lblBsState.Text = VM.BusinessStateString;
            //tbDepartment.Text = VM.Department;

            County  = VM.AgencyCounty;
            Town    = VM.AgencyTown;
            Village = VM.AgencyVillage;

            CountyName  = SystemAreaCode.GetName(VM.AgencyCounty);
            TownName    = SystemAreaCode.GetName(VM.AgencyTown);
            VillageName = SystemAreaCode.GetName(VM.AgencyVillage);

            tbAddress.Text              = VM.AgencyAddress;
            tbTelZone.Text              = VM.PhoneAreaCode;
            tbTel.Text                  = VM.AgencyPhoneNumber;
            tbSchedule.Text             = VM.InoculationSchedule;
            ddlAgencyCate.SelectedValue = VM.AgencyCate.ToString();

            lblName.Text  = VM.AgencyName;
            lblCode.Text  = VM.AgencyCode;
            tbOrg.Text    = VM.OrgName;
            hfOrgID.Value = VM.OrgID.ToString();
            //tbDepartment.Text = VM.Department;

            tbVaccine.Text = string.Join(",", list.Select(item => item.VaccineCName));
            tbOther        = VM.DepartmentOther;
            switch (VM.ReportingType)
            {
            case 1:
                rb1.Checked = true;
                break;

            case 2:
                rb2.Checked = true;
                break;

            case 3:
                rb3.Checked = true;
                break;

            case 4:
                rb4.Checked = true;
                break;
            }

            if (VM.IsSimpleFlu == false)
            {
                rbB1.Checked = true;
            }
            else
            {
                rbB2.Checked = true;
            }
            tbOtherIDs  = VM.DepartmentIDs;
            CountyJson  = JsonConvert.SerializeObject(SystemAreaCode.GetCountyList());
            TownJson    = JsonConvert.SerializeObject(SystemAreaCode.GetTownList(County));
            VillageJson = JsonConvert.SerializeObject(SystemAreaCode.GetVillageList(Town));
        }
    }
Example #5
0
    public CaseUserProfile(int CaseUserID) : base()
    {
        DataTable dt = (DataTable)DBUtil.DBOp("ConnDB",
                                              "dbo.usp_CaseUser_xGetCaseUserWithMother {0}",
                                              new string[] { CaseUserID.ToString() },
                                              NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);

        SystemCode.Update();
        SystemAreaCode.Update();

        if (dt.Rows.Count > 0)
        {
            CaseID       = CaseUserID;
            BirthDate    = dt.Rows[0]["BirthDateSimple"].ToString();
            IdNo         = dt.Rows[0]["IdNo"].ToString();
            PassportNo   = dt.Rows[0]["PassportNo"].ToString();
            ResNo        = dt.Rows[0]["ResNo"].ToString();
            OtherNo      = dt.Rows[0]["OtherNo"].ToString();
            Name         = dt.Rows[0]["ChName"].ToString();
            EngName      = dt.Rows[0]["EnName"].ToString();
            Gender       = dt.Rows[0]["Gender"].ToString();
            GenderName   = SystemCode.GetName("CaseUser_Gender", Convert.ToInt32(Gender));
            HouseNo      = dt.Rows[0]["HouseNo"].ToString();
            ONationality = dt.Rows[0]["ONationality"].ToString();

            Language = dt.Rows[0]["Language"].ToString().Split(',');
            foreach (string s in Language)
            {
                if (s != "")
                {
                    LanguageName += SystemCode.GetName("CaseUser_Language", Convert.ToInt32(s)) + ",";
                }
            }

            LanguageName = (LanguageName != null ? LanguageName.TrimEnd(',') :"");

            Capacity = dt.Rows[0]["Capacity"].ToString().Split(',');
            foreach (string s in Capacity)
            {
                if (s != "")
                {
                    CapacityName += SystemCode.GetName("CaseUser_Capacity", Convert.ToInt32(s)) + ",";
                }
            }
            CapacityName = (CapacityName != null ? CapacityName.TrimEnd(',') : "");

            ConCounty = dt.Rows[0]["ConCounty"].ToString();
            if (ConCounty != "")
            {
                ConCountyName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ConCounty"]));
            }

            ConTown = dt.Rows[0]["ConTown"].ToString();
            if (ConTown != "")
            {
                ConTownName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ConTown"]));
            }

            ConVillage = dt.Rows[0]["ConVillage"].ToString();
            if (ConVillage != "")
            {
                ConVillageName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ConVillage"]));
            }

            ConAddr = dt.Rows[0]["ConAddr"].ToString();

            ResCounty = dt.Rows[0]["ResCounty"].ToString();
            if (ResCounty != "")
            {
                ConCountyName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ResCounty"]));
            }

            ResTown = dt.Rows[0]["ResTown"].ToString();
            if (ResTown != "")
            {
                ResTownName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ResTown"]));
            }

            ResVillage = dt.Rows[0]["ResVillage"].ToString();
            if (ResVillage != "")
            {
                ResVillageName = SystemAreaCode.GetName(Convert.ToInt32(dt.Rows[0]["ResVillage"]));
            }

            ResAddr = dt.Rows[0]["ResAddr"].ToString();

            MotherName      = dt.Rows[0]["MotherName"].ToString();
            MotherIdNo      = dt.Rows[0]["MotherIdNo"].ToString();
            MotherBirthDate = dt.Rows[0]["MotherBirthDateSimple"].ToString();



            // PregWeek = dt.Rows[0]["PregWeek"].ToString();
            // BirthNum = dt.Rows[0]["BirthNum"].ToString();
            // BirthSeq = dt.Rows[0]["BirthSeq"].ToString();
            //BirthWeight  = dt.Rows[0]["BirthWeight"].ToString();
            //BirthPlace = dt.Rows[0]["BirthPlace"].ToString();
            // Deliver  = dt.Rows[0]["Deliver"].ToString();
            //  DeliverOrg = dt.Rows[0]["DeliverOrg"].ToString();
            //  MarryStatus  = dt.Rows[0]["MarryStatus"].ToString();

            //  EduLevel = dt.Rows[0]["EduLevel"].ToString();
            //  ElemSchool = dt.Rows[0]["ElemSchool"].ToString();
            //Occupation = dt.Rows[0]["Occupation"].ToString();
            // EduLevel = dt.Rows[0]["EduLevel"].ToString();
            //EduLevel = dt.Rows[0]["EduLevel"].ToString();

            //  ResAddr  = dt.Rows[0]["ResAddr"].ToString();

            //  BirthMulti = dt.Rows[0]["BirthMulti"].ToString();
        }
    }
Example #6
0
    protected void SetAttr(DataTable dt)
    {
        if (dt.Rows.Count > 0)
        {
            int iGender, iONationality, iImmiType
            , iConCounty, iConTown, iConVillage, iConNei
            , iResCounty, iResTown, iResVillage, iResNei
            , iPregWeek, iBirthNum, iBirthSeq, iBirthWeight
            , iBirthPlace, iDeliver, iBirthMulti
            , iRegionID, iMainContactCaseID;



            CaseID     = Convert.ToInt32(dt.Rows[0]["CaseID"]);
            BirthDate  = dt.Rows[0]["BirthDateSimple"].ToString();
            IdNo       = dt.Rows[0]["IdNo"].ToString();
            PassportNo = dt.Rows[0]["PassportNo"].ToString();
            ResNo      = dt.Rows[0]["ResNo"].ToString();
            OtherNo    = dt.Rows[0]["OtherNo"].ToString();
            ChName     = dt.Rows[0]["ChName"].ToString();
            EnName     = dt.Rows[0]["EnName"].ToString();
            HouseNo    = dt.Rows[0]["HouseNo"].ToString();
            Language   = dt.Rows[0]["Language"].ToString().Split(',');
            foreach (string s in Language)
            {
                if (s != "")
                {
                    LanguageName += SystemCode.GetName("CaseUser_Language", Convert.ToInt32(s)) + ",";
                }
            }

            LanguageName = (LanguageName != null ? LanguageName.TrimEnd(',') : "");

            Capacity = dt.Rows[0]["Capacity"].ToString().Split(',');
            foreach (string s in Capacity)
            {
                if (s != "")
                {
                    CapacityName += SystemCode.GetName("CaseUser_Capacity", Convert.ToInt32(s)) + ",";
                }
            }
            CapacityName = (CapacityName != null ? CapacityName.TrimEnd(',') : "");



            TelDayArea   = dt.Rows[0]["TelDayArea"].ToString();
            TelDayNo     = dt.Rows[0]["TelDayNo"].ToString();
            TelDayExt    = dt.Rows[0]["TelDayExt"].ToString();
            TelNightArea = dt.Rows[0]["TelNightArea"].ToString();
            TelNightNo   = dt.Rows[0]["TelNightNo"].ToString();
            TelNightExt  = dt.Rows[0]["TelNightExt"].ToString();
            ConAddr      = dt.Rows[0]["ConAddr"].ToString();
            ResAddr      = dt.Rows[0]["ResAddr"].ToString();

            DeliverOrg  = dt.Rows[0]["DeliverOrg"].ToString();
            MarryStatus = dt.Rows[0]["MarryStatus"].ToString();
            ElemSchool  = dt.Rows[0]["ElemSchool"].ToString();
            Occupation  = dt.Rows[0]["Occupation"].ToString();
            EduLevel    = dt.Rows[0]["EduLevel"].ToString();

            BirthPlaceOther = dt.Rows[0]["BirthPlaceOther"].ToString();

            int.TryParse(dt.Rows[0]["ONationality"].ToString(), out iONationality);
            int.TryParse(dt.Rows[0]["ImmiType"].ToString(), out iImmiType);
            int.TryParse(dt.Rows[0]["Gender"].ToString(), out iGender);

            int.TryParse(dt.Rows[0]["ConCounty"].ToString(), out iConCounty);
            int.TryParse(dt.Rows[0]["ConTown"].ToString(), out iConTown);
            int.TryParse(dt.Rows[0]["ConVillage"].ToString(), out iConVillage);
            int.TryParse(dt.Rows[0]["ConNei"].ToString(), out iConNei);

            int.TryParse(dt.Rows[0]["ResCounty"].ToString(), out iResCounty);
            int.TryParse(dt.Rows[0]["ResTown"].ToString(), out iResTown);
            int.TryParse(dt.Rows[0]["ResVillage"].ToString(), out iResVillage);
            int.TryParse(dt.Rows[0]["ResNei"].ToString(), out iResNei);

            int.TryParse(dt.Rows[0]["PregWeek"].ToString(), out iPregWeek);
            int.TryParse(dt.Rows[0]["BirthNum"].ToString(), out iBirthNum);
            int.TryParse(dt.Rows[0]["BirthSeq"].ToString(), out iBirthSeq);
            int.TryParse(dt.Rows[0]["BirthWeight"].ToString(), out iBirthWeight);
            int.TryParse(dt.Rows[0]["BirthPlace"].ToString(), out iBirthPlace);
            int.TryParse(dt.Rows[0]["Deliver"].ToString(), out iDeliver);
            int.TryParse(dt.Rows[0]["BirthMulti"].ToString(), out iBirthMulti);
            int.TryParse(dt.Rows[0]["RegionID"].ToString(), out iRegionID);
            int.TryParse(dt.Rows[0]["MainContactID"].ToString(), out iMainContactCaseID);


            ONationality = iONationality;
            ImmiType     = iImmiType;
            Gender       = iGender;

            ConCounty  = iConCounty;
            ConTown    = iConTown;
            ConVillage = iConVillage;
            ConNei     = iConNei;

            ResCounty  = iResCounty;
            ResTown    = iResTown;
            ResVillage = iResVillage;
            ResNei     = iResNei;


            PregWeek          = iPregWeek;
            BirthNum          = iBirthNum;
            BirthSeq          = iBirthSeq;
            BirthWeight       = iBirthWeight;
            BirthPlace        = iBirthPlace;
            Deliver           = iDeliver;
            BirthMulti        = iBirthMulti;
            RegionID          = iRegionID;
            MainContactCaseID = iMainContactCaseID;

            //    RegionName = dt.Rows[0]["RegionName"].ToString();
            // SystemRegion.Update();
            RegionName     = SystemRegion.GetName(RegionID);
            ImmiTypeName   = SystemCode.GetName("CaseUser_ImmiType", ImmiType);
            GenderName     = SystemCode.GetName("CaseUser_Gender", Gender);
            ConCountyName  = SystemAreaCode.GetName(ConCounty);
            ConTownName    = SystemAreaCode.GetName(ConTown);
            ConVillageName = SystemAreaCode.GetName(ConVillage);
            ResCountyName  = SystemAreaCode.GetName(ResCounty);
            ResTownName    = SystemAreaCode.GetName(ResTown);
            ResVillageName = SystemAreaCode.GetName(ResVillage);



            if (dt.Columns.Contains("CreateInfo"))
            {
                CreateInfo = dt.Rows[0]["CreateInfo"].ToString();
            }
            if (dt.Columns.Contains("ModifyInfo"))
            {
                ModifyInfo = dt.Rows[0]["ModifyInfo"].ToString();
            }



            if (dt.Columns.Contains("MotherName"))
            {
                MotherName = dt.Rows[0]["MotherName"].ToString();
            }
            if (dt.Columns.Contains("MotherIdNo"))
            {
                MotherIdNo = dt.Rows[0]["MotherIdNo"].ToString();
            }
            if (dt.Columns.Contains("MotherBirthDateSimple"))
            {
                MotherBirthDate = dt.Rows[0]["MotherBirthDateSimple"].ToString();
            }



            GetMobiles();
            GetEmails();



            try
            {
                AgeCalculatorT AgeCal = new AgeCalculatorT();
                DateTime       b      = new DateTime();
                DateTime.TryParse(dt.Rows[0]["BirthDate"].ToString(), out b);
                AgeTip = AgeCal.GetAge(b);
            }
            catch
            {
            }
        }
    }