private void ShowFiles(int VisitID, bool bDownload) { DataTable dt = (DataTable)DBUtil.DBOp("ConnDB", "SELECT isnull(C_CaseVisitFile.Filetype,0) Filetype,C_CaseVisitFile.ID,[FileID] ,F_FileInfo.DisplayFileName FROM [dbo].[C_CaseVisitFile] inner join F_FileInfo on F_FileInfo.ID = [C_CaseVisitFile].FileID and [C_CaseVisitFile].VisitID={0} and C_CaseVisitFile.LogicDel=0", new string[] { VisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); foreach (DataRow r in dt.Rows) { string filetype = SystemCode.GetName("CaseVisit_VisitFileType", Convert.ToInt32(r["Filetype"])); if (bDownload) { ltFiles.Text += string.Format("<div id=\"FileDIV_{2}\"><a href=\"DownloadFileOP.aspx?i={1}\">{3} : {0}</a> <img src=\"/images/icon_del01.gif\" class=\"delFile\" id=\"img_del_{2}\" />;</div>", Server.HtmlEncode(r["DisplayFileName"].ToString()), Server.HtmlEncode(r["FileID"].ToString()), Server.HtmlEncode(r["ID"].ToString()), filetype); } else { ltFiles.Text += filetype + ":" + Server.HtmlEncode(r["DisplayFileName"].ToString()) + ";"; } } }
private string ShowFiles(int VisitID, bool bDownload) { StringBuilder sb = new StringBuilder(""); DataTable dt = (DataTable)DBUtil.DBOp("ConnDB", "SELECT isnull(C_CaseVisitFile.Filetype,0) Filetype,C_CaseVisitFile.ID,[FileID] ,F_FileInfo.DisplayFileName FROM [dbo].[C_CaseVisitFile] inner join F_FileInfo on F_FileInfo.ID = [C_CaseVisitFile].FileID and [C_CaseVisitFile].VisitID={0} and C_CaseVisitFile.LogicDel=0", new string[] { VisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); foreach (DataRow r in dt.Rows) { string filetype = SystemCode.GetName("CaseVisit_VisitFileType", Convert.ToInt32(r["Filetype"])); if (bDownload) { sb.AppendFormat("<div id=\"FileDIV_{2}\"><a href=\"DownloadFileOP.aspx?i={1}\">{3} : {0}</a> ;</div>", Server.HtmlEncode(r["DisplayFileName"].ToString()), Server.HtmlEncode(r["FileID"].ToString()), Server.HtmlEncode(r["ID"].ToString()), filetype); } else { sb.Append(filetype + ":" + Server.HtmlEncode(r["DisplayFileName"].ToString()) + ";"); } } return(sb.ToString()); }
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"); } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid == false) { return; } int Chk = 0; int StoolCard = 0; string ScreeningLocation = PureString(tbLocation.Text); string script = ""; RadioButton selected = MyForm.Controls.OfType <RadioButton>().FirstOrDefault(rb => rb.Checked); if (selected != null) { switch (selected.ID) { case "rb1": StoolCard = 1; break; case "rb2": StoolCard = 2; break; case "rb3": StoolCard = 3; break; } } DateTime CheckDate = default(DateTime); DateTime.TryParseExact(PureString(tbDate.Text).RepublicToAD(), "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out CheckDate); Dictionary <string, object> OutDict = new Dictionary <string, object>() { { "@Chk", Chk } }; if (StoolCardID != 0) { MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xUpdateStoolCard" , ref OutDict , new Dictionary <string, object>() { { "@StoolCardID", StoolCardID }, { "@CheckDate", CheckDate }, { "@StoolCard", StoolCard }, { "@ScreeningLocation", ScreeningLocation } }); } else { var user = AuthServer.GetLoginUser(); MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xAddStoolCard" , ref OutDict , new Dictionary <string, object>() { { "@CaseUserID", ID }, { "@CheckDate", CheckDate }, { "@StoolCard", StoolCard }, { "@ScreeningLocation", ScreeningLocation }, { "@CreatedUserID", user.ID }, { "@OrgID", user.OrgID } }); } Chk = (int)OutDict["@Chk"]; if (Chk > 0) { Dictionary <string, object> dict = new Dictionary <string, object>(); dict["I"] = StoolCardID; dict["CD"] = CheckDate; dict["SC"] = SystemCode.GetName("RecordM_RegisterData_Detail_StoolCard", StoolCard); if (StoolCardID != 0) { dict["Add"] = 0; } else { dict["Add"] = 1; } script = "<style>body{display:none;}</style><script>alert('儲存成功');window.opener.changeStoolCard(" + JsonConvert.SerializeObject(dict) + ");window.close();</script>"; } else { script = "<script>alert('儲存失敗');</script>"; } Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); }
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(); } }
protected void BindData() { DataSet ds = new DataSet(); using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString())) { using (SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetCaseUser", sc)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CaseID", CaseID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { sc.Open(); da.Fill(ds); } } } DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { BirthDate.Text = dt.Rows[0]["BirthDateSimple"].ToString(); tbIdNo.Text = dt.Rows[0]["IdNo"].ToString(); tbPassportNo.Text = dt.Rows[0]["PassportNo"].ToString(); tbResNo.Text = dt.Rows[0]["ResNo"].ToString(); tbOtherNo.Text = dt.Rows[0]["OtherNo"].ToString(); tbName.Text = dt.Rows[0]["ChName"].ToString(); tbEngName.Text = dt.Rows[0]["EnName"].ToString(); ddlGender.SelectedValue = dt.Rows[0]["Gender"].ToString(); tbHouseNo.Text = dt.Rows[0]["HouseNo"].ToString(); ddlONationality.SelectedValue = dt.Rows[0]["ONationality"].ToString(); foreach (string s in dt.Rows[0]["Language"].ToString().Split(',')) { foreach (ListItem i in cblLang.Items) { if (i.Value == s) { i.Selected = true; } } } ; foreach (string s in dt.Rows[0]["Capacity"].ToString().Split(',')) { foreach (ListItem i in cblCapacity.Items) { if (i.Value == s) { i.Selected = true; } } } ; CountyInival = dt.Rows[0]["ConCounty"].ToString(); TownAry = Newtonsoft.Json.JsonConvert.SerializeObject(SystemAreaCode.GetTownList(Convert.ToInt32(dt.Rows[0]["ConCounty"]))); TownInival = dt.Rows[0]["ConTown"].ToString(); VillageAry = Newtonsoft.Json.JsonConvert.SerializeObject(SystemAreaCode.GetVillageList(Convert.ToInt32(dt.Rows[0]["ConTown"]))); VillageInival = dt.Rows[0]["ConVillage"].ToString(); ResCountyInival = dt.Rows[0]["ResCounty"].ToString(); ResTownAry = Newtonsoft.Json.JsonConvert.SerializeObject(SystemAreaCode.GetTownList(Convert.ToInt32(dt.Rows[0]["ConCounty"]))); ResTownInival = dt.Rows[0]["ResTown"].ToString(); ResVillageAry = Newtonsoft.Json.JsonConvert.SerializeObject(SystemAreaCode.GetVillageList(Convert.ToInt32(dt.Rows[0]["ConTown"]))); ResVillageInival = dt.Rows[0]["ResVillage"].ToString(); //if (SystemAreaCode.dict.ContainsKey("County")) //{ // List<SystemAreaCodeVM> SystemAreaCodeList = SystemAreaCode.dict["County"]; // ddlResCounty.Items.Clear(); // ddlResCounty.Items.Add(new ListItem("縣市", "")); // foreach (SystemAreaCodeVM sc in SystemAreaCodeList) // ddlResCounty.Items.Add(new ListItem(sc.AreaName, sc.ID.ToString())); // ddlResCounty.SelectedValue = dt.Rows[0]["ResCounty"].ToString(); //} //if (SystemAreaCode.dict.ContainsKey("Town")) //{ // List<SystemAreaCodeVM> SystemAreaCodeList = SystemAreaCode.dict["Town"]; // ddlResTown.Items.Clear(); // ddlResTown.Items.Add(new ListItem("鄉鎮市區", "")); // foreach (SystemAreaCodeVM sc in SystemAreaCodeList) // ddlResTown.Items.Add(new ListItem(sc.AreaName, sc.ID.ToString())); // ddlResTown.SelectedValue = dt.Rows[0]["ResTown"].ToString(); //} tbArea.Text = ""; tbPregWeek.Text = dt.Rows[0]["PregWeek"].ToString(); tbBirthNum.Text = dt.Rows[0]["BirthNum"].ToString(); tbBirthSeq.Text = dt.Rows[0]["BirthSeq"].ToString(); tbBirthWeight.Text = dt.Rows[0]["BirthWeight"].ToString(); ddlBirthPlace.SelectedValue = dt.Rows[0]["BirthPlace"].ToString(); ddlDeliver.SelectedValue = dt.Rows[0]["Deliver"].ToString(); tbDeliverOrg.Text = dt.Rows[0]["DeliverOrg"].ToString(); ddlMarryStatus.SelectedValue = dt.Rows[0]["MarryStatus"].ToString(); tbEduLevel.Text = dt.Rows[0]["EduLevel"].ToString(); tbElemSchool.Text = dt.Rows[0]["ElemSchool"].ToString(); tbOccupation.Text = dt.Rows[0]["Occupation"].ToString(); tbEduLevel.Text = dt.Rows[0]["EduLevel"].ToString(); tbEduLevel.Text = dt.Rows[0]["EduLevel"].ToString(); //cmd.Parameters.AddWithValue("@TelDayArea", "03"); //cmd.Parameters.AddWithValue("@TelDayNo", "12345678"); //cmd.Parameters.AddWithValue("@TelDayExt", "90"); //cmd.Parameters.AddWithValue("@TelNightArea", "03"); //cmd.Parameters.AddWithValue("@TelNightNo", "12345678"); //cmd.Parameters.AddWithValue("@TelNightExt", "90"); tbResAddr.Text = dt.Rows[0]["ResAddr"].ToString(); tbConAddr.Text = dt.Rows[0]["ConAddr"].ToString(); tbBirthMulti.Text = dt.Rows[0]["BirthMulti"].ToString(); tbTelDayArea.Text = dt.Rows[0]["TelDayArea"].ToString(); tbTelDayNo.Text = dt.Rows[0]["TelDayNo"].ToString(); tbTelDayExt.Text = dt.Rows[0]["TelDayExt"].ToString(); tbTelNightArea.Text = dt.Rows[0]["TelNightArea"].ToString(); tbTelNightNo.Text = dt.Rows[0]["TelNightNo"].ToString(); tbTelNightExt.Text = dt.Rows[0]["TelNightExt"].ToString(); tbImmiType.Text = SystemCode.GetName("CaseUser_ImmiType", Convert.ToInt32(dt.Rows[0]["ImmiType"])); ltBirthDate.Text = dt.Rows[0]["BirthDateSimple"].ToString(); ltIdNo.Text = dt.Rows[0]["IdNo"].ToString(); ltName.Text = dt.Rows[0]["ChName"].ToString(); ltGender.Text = ddlGender.SelectedItem.Text; MainContactInival = Convert.ToString(DBUtil.DBOp("ConnDB", " select isnull((SELECT top 1 [ContactID] FROM [dbo].[C_CaseUserContact] where [LogicDel]=0 and [CaseID]={0} and [IsMain]=1),0) ", new string[] { CaseID.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar)); CaseIDdiv.Controls.Add(GetControlFromTag(CaseID.ToString())); BindComment(); BindContact(); BindMobile(); BindEmail(); } }
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 { } } }
protected void BindData() {//<table> //<tbody><tr> //<th scope="col">疫苗別</th> //<th scope="col">訪查日期</th> //<th scope="col">訪查單位(人員)</th> //<th scope="col">訪查方式</th> //<th scope="col">訪查原因</th> //<th scope="col">訪查紀錄</th> //<th scope="col">附件</th> //<th scope="col">刪除</th> //</tr> //</tbody> //</table> int ViewOrgID = AuthServer.GetLoginUser().OrgID; CaseVisitTb.Controls.Clear(); Table tb = new Table(); TableRow thr = new TableRow(); TableHeaderCell th1 = new TableHeaderCell(); th1.Text = "疫苗別"; thr.Cells.Add(th1); TableHeaderCell th2 = new TableHeaderCell(); th2.Text = "訪查日期"; thr.Cells.Add(th2); TableHeaderCell th3 = new TableHeaderCell(); th3.Text = "訪查單位(人員)"; thr.Cells.Add(th3); TableHeaderCell th4 = new TableHeaderCell(); th4.Text = "訪查方式"; thr.Cells.Add(th4); TableHeaderCell th5 = new TableHeaderCell(); th5.Text = "訪查原因"; thr.Cells.Add(th5); TableHeaderCell th6 = new TableHeaderCell(); th6.Text = "訪查結果"; thr.Cells.Add(th6); TableHeaderCell th7 = new TableHeaderCell(); th7.Text = "附件"; thr.Cells.Add(th7); tb.Controls.Add(thr); DataTable dt = (DataTable) DBUtil.DBOp("ConnDB", @"exec [dbo].[usp_CaseVist_xCaseVisitListByDoseID] {0},{1} " , new string[] { CaseID.ToString() , DoseID }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); foreach (DataRow r in dt.Rows) { TableRow thd = new TableRow(); TableCell td1 = new TableCell(); td1.Text = r["疫苗別"].ToString(); thd.Cells.Add(td1); TableCell td2 = new TableCell(); td2.Text = r["訪查日期"].ToString(); thd.Cells.Add(td2); TableCell td3 = new TableCell(); td3.Text = r["訪查單位(人員)"].ToString(); thd.Cells.Add(td3); TableCell td4 = new TableCell(); td4.Text = SystemCode.GetName("CaseVisit_VisitType", Convert.ToInt32(r["訪查方式"])); thd.Cells.Add(td4); TableCell td5 = new TableCell(); td5.Text = SystemCode.GetName("CaseVisit_VisitReason", Convert.ToInt32(r["訪查原因"])); thd.Cells.Add(td5); TableCell td6 = new TableCell(); td6.Text = SystemCode.GetName("CaseVisit_VisitResult_Reason_" + r["訪查原因"], Convert.ToInt32(r["訪查結果"])); thd.Cells.Add(td6); TableCell td7 = new TableCell(); int VisitOrg; int.TryParse(r["VisitOrg"].ToString(), out VisitOrg); td7.Text = ShowFiles(Convert.ToInt32(r["VisitID"]), (VisitOrg == ViewOrgID)); thd.Cells.Add(td7); tb.Controls.Add(thd); } CaseVisitTb.Controls.Add(tb); }
protected new void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("POST"); base.DisableTop(false); CaseUserID = GetNumber <int>("i"); if (CaseUserID == 0) { string script = "<style>body{disply:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>"; Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false); return; } ucCaseRemark1.CaseID = CaseUserID; var user = AuthServer.GetLoginUser(); OrgName = user.OrgName; DataTable dt = new DataTable(); int YCardMainID = 0; int DeltaDays = 0; Dictionary <string, object> OutDict = new Dictionary <string, object>() { { "@YCardMainID", YCardMainID }, { "@DeltaDays", DeltaDays } }; DataSet ds = MSDB.GetDataSet("ConnDB", "dbo.usp_RecordM_xGetCaseUserByIDAndGetOrAddYCardMain" , ref OutDict , new Dictionary <string, object>() { { "@CaseUserID", CaseUserID } }); YCardMainID = (int)OutDict["@YCardMainID"]; DeltaDays = (int)OutDict["@DeltaDays"]; List <RegisterStoolCardVM> scList = new List <RegisterStoolCardVM>(); List <RegisterFluNotesVM> fnList = new List <RegisterFluNotesVM>(); string CapacityIDs = ""; EntityS.FillModel(VM, ds.Tables[0]); if (ds.Tables[2].Rows.Count > 0) { EntityS.FillModel(VM, ds.Tables[2]); VM.HasYellowCardMessage = true; } EntityS.FillModel(scList, ds.Tables[3]); EntityS.FillModel(fnList, ds.Tables[4]); if (ds.Tables[1].Rows.Count > 0) { CapacityIDs = ds.Tables[1].Rows[0][0].ToString(); } if (scList.Count > 0) { scAry = JsonConvert.SerializeObject(scList); } if (fnList.Count > 0) { fnAry = JsonConvert.SerializeObject(fnList); } List <string> CapacityList = new List <string>(); foreach (var item in CapacityIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { CapacityList.Add(SystemCode.GetName("CaseUser_Capacity", int.Parse(item))); } CapacityString = string.Join(",", CapacityList.ToArray()); //if(ds.Tables[1].Rows.Count>0) // YCardMainID = (int)ds.Tables[1].Rows[0][0]; uJson = JsonConvert.SerializeObject(VM); AgeCalculatorT AT = new AgeCalculatorT(); AgeString = AT.GetYearMonthAge(VM.BirthDate); DateTime birthDate = VM.BirthDate; dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetRecordDataByCaseUserID" , new Dictionary <string, object>() { { "@CaseUserID", CaseUserID } }); List <RecordDataVM> list = new List <RecordDataVM>(); //List<RecordYellowDataVM> yellowList = new List<RecordYellowDataVM>(); var yellowList = SystemYCard.GetDict(YCardMainID).Where(item => item.YCardDataType == 1); //var x = SystemYCard.dict; List <RecordUserDataVM> userList = new List <RecordUserDataVM>(); //List<RecordYellowDataVM> yellowRemoveList = new List<RecordYellowDataVM>(); List <RecordUserDataVM> userRemoveList = new List <RecordUserDataVM>(); EntityS.FillModel(userList, dt); //EntityS.FillModel(yellowList, ds.Tables[0]); //EntityS.FillModel(userList, ds.Tables[1]); //var userVaccineCodes =userList.Select(item => item.SystemRecordVaccineCode).ToList(); //var DoseIDs = yellowList.Select(item => item.DoseID).ToList(); foreach (var yellow in yellowList) { var queryList = userList.FindAll(item => item.SystemRecordVaccineCode.Equals(yellow.DoseID)); if (queryList.Count > 0) { foreach (var q in queryList) { //yellowRemoveList.Add(yellow); userRemoveList.Add(q); RecordDataVM rVM = new RecordDataVM(birthDate); rVM.InoculationDate = q.InoculationDate; rVM.IsRule = true; rVM.OrgID = q.OrgID; rVM.VaccineBatchID = q.VaccineBatchID; rVM.SystemRecordVaccineID = q.SystemRecordVaccineID; rVM.AgeEngilsh = yellow.AgeEngilsh; rVM.DoseID = yellow.DoseID; rVM.Period = yellow.Period; rVM.CreatedDate = q.CreatedDate; rVM.CreateType = q.CreateType; //rVM.ColorType = 1; rVM.RecordDataID = q.RecordDataID; //if (rVM.InoculationDate == null || DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0))) //{ // rVM.OrgID = 0; // rVM.ColorType = 0; // rVM.CreatedDate = null; //} //else if(rVM.AppointmentDate!=null && DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0))==false) //{ // if(DateTime.Compare(rVM.InoculationDate.Value, rVM.AppointmentDate.Value.AddDays(90))>0) // { // rVM.ColorType = 1; // } //} list.Add(rVM); } } else { RecordDataVM rVM = new RecordDataVM(birthDate); rVM.IsRule = true; rVM.AgeEngilsh = yellow.AgeEngilsh; rVM.DoseID = yellow.DoseID; //rVM.SystemRecordVaccineID = SystemRecordVaccine.GetID(yellow.DoseID); rVM.Period = yellow.Period; //rVM.ColorType = 0; list.Add(rVM); } } //yellowList.RemoveAll(item => yellowRemoveList.Contains(item)); userList.RemoveAll(item => userRemoveList.Contains(item)); list.OrderBy(item => item.AppointmentDate).ThenBy(item => item.Period).ThenBy(item => item.DoseID); foreach (var u in userList) { RecordDataVM rVM = new RecordDataVM(birthDate); rVM.InoculationDate = u.InoculationDate; rVM.IsRule = false; rVM.OrgID = u.OrgID; rVM.VaccineBatchID = u.VaccineBatchID; rVM.SystemRecordVaccineID = u.SystemRecordVaccineID; rVM.RecordDataID = u.RecordDataID; if (rVM.InoculationDate == null || DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0))) { rVM.OrgID = 0; rVM.CreatedDate = null; } //list.Add(VM); //find last InoculationDate var index = list.FindLastIndex(item => item.InoculationDateOut != null); if (index >= 0) { if (index + 1 <= list.Count) { list.Insert(index + 1, rVM); } else { list.Add(rVM); } } else { list.Insert(0, rVM); } } var LastInoculationDateIndex = list.FindLastIndex(item => item.InoculationDateOut != null); for (int i = LastInoculationDateIndex + 1; i <= list.Count - 1; i++) { list[i].DeltaDays = DeltaDays; } if (list.Count > 0) { tbAry = JsonConvert.SerializeObject(list); } }