protected void Page_Load(object sender, EventArgs e) { string action = Request.Form["action"] ?? ""; JsonReply jr = new JsonReply(); jr.RetCode = 0; try { if (action == "DelVisitFile") { int VisitFileID; int.TryParse(Request.Form["VisitFileID"], out VisitFileID); if (Convert.ToInt32(DBUtil.DBOp("ConnDB", " UPDATE [dbo].[C_CaseVisitFile] SET [LogicDel] = 1 WHERE ID={0} ;select @@rowcount " , new string[] { VisitFileID.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar)) > 0) { jr.Content = "成功"; jr.RetCode = 1; } } } catch { jr.RetCode = 0; } Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(jr)); Response.End(); }
int action = 0; //0 add 2 del protected void Page_Load(object sender, EventArgs e) { int.TryParse(Request.Form["UserID"], out UserID); int.TryParse(Request.Form["YearMonth"].ToString().Split('-')[0], out Year); int.TryParse(Request.Form["YearMonth"].ToString().Split('-')[1], out Month); int.TryParse(Request.Form["SearchKind"], out SearchKind); int.TryParse(Request.Form["action"], out action); JsonReply r = new JsonReply(); if (UserID > 0 && Year > 0 && Month > 0 && SearchKind > 0) { DBUtil.DBOp("ConnDB", " exec [dbo].[usp_SearchCheck_xAddAudit] {0},{1},{2},{3},{4} " , new string[] { UserID.ToString(), (Year + 1911).ToString(), Month.ToString(), SearchKind.ToString(), action.ToString() } , NSDBUtil.CmdOpType.ExecuteNonQuery); } r.RetCode = 1; r.Content = "ok"; Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(r)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string action = Request.Form["action"] ?? ""; JsonReply jr = new JsonReply(); try { if (action == "IsRepeatNo") { jr.Content = "repeat"; jr.RetCode = 0; int CaseID; int.TryParse(Request.Form["CaseID"], out CaseID); string IdNo = Request.Form["IdNo"] ?? ""; if (Convert.ToInt32(DBUtil.DBOp("ConnDB", " SELECT count([CaseID]) FROM [dbo].[C_CaseUser] where [CaseID]!={0} and IdNo={1}" , new string[] { CaseID.ToString(), IdNo }, NSDBUtil.CmdOpType.ExecuteScalar)) == 0) { jr.Content = " not repeat"; jr.RetCode = 1; } } } catch { jr.RetCode = 0; } Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(jr)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { // ConnDB JsonReply r = new JsonReply(); DB.ExecuteNonQuery(new SqlCommand("exec dbo.usp_CaseUser_xUpdateMergeCheckList"), "ConnDB"); r.RetCode = 1; r.Content = "ok"; Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(r)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //base.AllowHttpMethod("POST"); int CaseID = 0; int.TryParse(Request["CaseID"], out CaseID); int ContactCaseID = 0; int.TryParse(Request["ContactCaseID"], out ContactCaseID); StringBuilder sb = new StringBuilder(""); JsonReply r = new JsonReply(); SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetCaseUserContact"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CaseID", CaseID); cmd.Parameters.AddWithValue("@ContactCaseID", ContactCaseID); r = new JsonReply(); DataTable dt = DB.GetDataTable(cmd, "ConnDB"); if (dt.Rows.Count > 0) { sb.Append("<table>"); sb.AppendFormat("<tr><td style='width:90px'>{0}</td><td>{1}</td></tr>", "電話(日):", dt.Rows[0]["TelDayArea"].ToString() + ' ' + dt.Rows[0]["TelDayNo"].ToString() + "分機" + dt.Rows[0]["TelDayExt"].ToString()); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(夜):", dt.Rows[0]["TelNightArea"].ToString() + ' ' + dt.Rows[0]["TelNightNo"].ToString() + "分機" + dt.Rows[0]["TelNightExt"].ToString()); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "行動電話:", BindMobile(ContactCaseID)); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電子郵件:", BindEmail(ContactCaseID)); sb.Append("</table>"); } r.RetCode = 1; r.Content = sb.ToString(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(r)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //base.AllowHttpMethod("POST"); int ContactID = 0; int.TryParse(Request["ContactID"], out ContactID); StringBuilder sb = new StringBuilder(""); JsonReply r = new JsonReply(); int ContactCaseID = 0; int CaseID = 0; //SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetCaseUserContact"); //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@ContactID", ContactID); //DataTable dt = DB.GetDataTable(cmd, "ConnDB"); //if (dt.Rows.Count > 0) //{ // sb.Append("<table>"); // sb.AppendFormat("<tr><td style='width:90px'>{0}</td><td>{1}</td></tr>", "電話(日):", dt.Rows[0]["TelDayArea"].ToString() + ' ' + dt.Rows[0]["TelDayNo"].ToString() + "分機" + dt.Rows[0]["TelDayExt"].ToString()); // sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(夜):", dt.Rows[0]["TelNightArea"].ToString() + ' ' + dt.Rows[0]["TelNightNo"].ToString() + "分機" + dt.Rows[0]["TelNightExt"].ToString()); // sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "行動電話:", BindMobile(ContactCaseID)); // sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電子郵件:", BindEmail(ContactCaseID)); // sb.Append("</table>"); //} r = new JsonReply(); if (ContactID != 0) { UserContact uc = new UserContact(ContactID); ContactCaseID = uc.ContactCaseID; CaseID = uc.CaseID; } CaseUserProfile c = new CaseUserProfile(ContactCaseID); if (c.CaseID != 0) { sb.Append("<table>"); sb.AppendFormat("<tr><td style='width:90px'>{0}</td><td>{1}</td></tr>", "姓名:", c.ChName); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(日):", c.TelDayArea + ' ' + c.TelDayNo + (c.TelDayExt != "" ? "分機" + c.TelDayExt :"")); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(夜):", c.TelNightArea + ' ' + c.TelNightNo + (c.TelNightExt != "" ? "分機" + c.TelNightExt : "")); sb.AppendFormat("<tr><td>{0}</td><td style='white-space: pre-wrap;'>{1}</td></tr>", "行動電話:", String.Join("\n", c.Mobiles.Select(m => m.Mobile).ToArray())); sb.AppendFormat("<tr><td>{0}</td><td style='white-space: pre-wrap;'>{1}</td></tr>", "電子郵件:", String.Join("\n", c.Emails.Select(m => m.Email).ToArray())); sb.Append("</table>"); //ltBirthDate.Text = c.BirthDate; //ltIdNo.Text = c.IdNo; //ltName.Text = c.ChName; ; } r.RetCode = 1; r.Content = sb.ToString(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(r)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //base.AllowHttpMethod("POST"); string action = Request.Form["action"] ?? ""; JsonReply jr = new JsonReply(); try { if (action == "GetList") { int CaseID = 0; int.TryParse(Request.Form["c"], out CaseID); StringBuilder sb = new StringBuilder(""); sb.Append("<table id=\"Reamrk_TB\">"); sb.Append("<tr><th style=\"width:200px\">類別</td><th>內容</th><th style=\"width:1%\">維護</th><th style=\"width:1%\">刪除</th></tr>"); if (CaseID != 0) { DataTable dt = (DataTable)DBUtil.DBOp("ConnDB", "EXECUTE [dbo].[usp_CaseUser_xGetRemarkList] {0} ", new string[] { CaseID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); foreach (DataRow r in dt.Rows) { sb.AppendFormat("<tr><td style=\"width:200px\">{0}</td><td>{1}</td><td><a href=\"javascript:void(0);\" id=\"ModifyRemark_{2}\" class=\"ModifyRemark\" ><img src=\"/images/icon_maintain.png\"></a></td><td> <a href=\"javascript:void(0);\" id=\"DeleteRemark_{2}\" class=\"DeleteRemark\"><img src=\"/images/icon_del01.gif\"></a></td></tr>", r["RemarkType"].ToString(), (Convert.ToInt32(r["FileID"]) > 0 ? "<a href=\"DownloadFileOP.aspx?i=" + r["FileID"].ToString() + "\">" + r["CaseRemark"].ToString() + "</a>" : r["CaseRemark"].ToString()), r["ID"].ToString()); } } sb.Append("</table>"); jr.Content = sb.ToString(); jr.RetCode = 1; } else if (action == "Delete") { int RemarkID = 0; int.TryParse(Request.Form["RemarkID"], out RemarkID); if (Convert.ToInt32(DBUtil.DBOp("ConnDB", " Update [C_CaseUserRemark] set LogicDel =1 where ID={0} ;select @@rowcount; ", new string[] { RemarkID.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar)) > 0) { ; } { jr.Content = "刪除成功"; jr.RetCode = 1; } } else if (action == "GetRemarkTr") { int RemarkID = 0; int.TryParse(Request.Form["RemarkID"], out RemarkID); UserRemark ur = new UserRemark(RemarkID); if (ur.RemarkID > 0) { jr.Content = string.Format("<tr><td style=\"width:200px\">{0}</td><td>{1}</td><td><a href=\"javascript:void(0);\" id=\"ModifyRemark_{2}\" class=\"ModifyRemark\" ><img src=\"/images/icon_maintain.png\"></a></td><td> <a href=\"javascript:void(0);\" id=\"DeleteRemark_{2}\" class=\"DeleteRemark\"><img src=\"/images/icon_del01.gif\"></a></td></tr>", ur.RemarkTypeName, (ur.FileID > 0 ? "<a href=\"DownloadFileOP.aspx?i=" + ur.FileID.ToString() + "\">" + ur.RemarkContent.ToString() + "</a>" : ur.RemarkContent.ToString()), ur.RemarkID.ToString()); } else { jr.Content = ""; } jr.RetCode = 1; } } catch (Exception ex) { jr.Content = "失敗" + ex.Message; jr.RetCode = 0; } Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(jr)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string action = Request.Form["action"] ?? ""; JsonReply jr = new JsonReply(); try { if (action == "GetContactTr") { int ContactID; int.TryParse(Request.Form["ContactID"], out ContactID); StringBuilder sb = new StringBuilder(""); UserContact uc = new UserContact(ContactID); CaseUserProfile c = new CaseUserProfile(uc.ContactCaseID); sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td><a href=\"javascript:void(0);\" id=\"ModifyContact_{5}\" class=\"ModifyContact\" ><img src=\"/images/icon_maintain.png\"></a></td><td> <a href=\"javascript:void(0);\" id=\"DeleteContact_{5}\" class=\"DeleteContact\"><img src=\"/images/icon_del01.gif\"></a></td></tr>", uc.RelationShipName, c.ChName, c.IdNo, c.BirthDate, (uc.IsMain ? "<img src=\"/images/icon_tick.png\" >" : ""), uc.ContactID); jr.Content = sb.ToString(); jr.RetCode = 1; } else if (action == "Delete") { int ContactID; int.TryParse(Request.Form["ContactID"], out ContactID); UserContact uc = new UserContact(ContactID); uc.Delete(); jr.Content = "成功"; jr.RetCode = 1; } else if (action == "LoadContactList") { int CaseID; int.TryParse(Request.Form["CaseID"], out CaseID); StringBuilder sb = new StringBuilder(""); sb.Append("<table id=\"Contact_TB\">"); sb.Append("<tr><th scope=\"col\">關係</th><th scope=\"col\">姓名</th><th scope=\"col\">身分證號</th><th scope=\"col\">出生日期</th><th scope=\"col\">主要聯絡人</th><th scope=\"col\" style=\"width:1%\">維護</th><th scope=\"col\" style=\"width:1%\">移除</th></tr>"); DataTable dt = new DataTable(); if (CaseID != 0) { dt = (DataTable)DBUtil.DBOp("ConnDB", " exec dbo.usp_CaseUser_xGetCaseUserContactList {0} " , new string[] { CaseID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); } else { //if (Session["NewCaseContacts"] != null) //{ // string NewCaseContacts = Session["NewCaseContacts"].ToString(); // dt = (DataTable)DBUtil.DBOp("ConnDB", " exec dbo.usp_CaseUser_xGetCaseUserContactList {0} " // , new string[] { CaseID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable); //} } foreach (DataRow r in dt.Rows) { sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td><a href=\"javascript:void(0);\" id=\"ModifyContact_{5}\" class=\"ModifyContact\" ><img src=\"/images/icon_maintain.png\"></a></td><td> <a href=\"javascript:void(0);\" id=\"DeleteContact_{5}\" class=\"DeleteContact\"><img src=\"/images/icon_del01.gif\"></a></td></tr>", r["RS"], r["ChName"], r["IdNo"], r["BirthDate"], (r["IsMain"].ToString() == "1" ? "<img src=\"/images/icon_tick.png\" >" : ""), r["ContactID"]); } sb.Append("</table>"); jr.Content = sb.ToString(); jr.RetCode = 1; } else if (action == "isHaveParent") { jr.Content = "無父母"; jr.RetCode = 0; int CaseID; int.TryParse(Request.Form["CaseID"], out CaseID); if (Convert.ToInt32(DBUtil.DBOp("ConnDB", " SELECT count([ContactID]) FROM [dbo].[C_CaseUserContact] where [CaseID]={0} and ([ContactRelationShip]=2 or [ContactRelationShip]=3) and LogicDel=0 " , new string[] { CaseID.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar)) > 0) { jr.Content = "有父或母"; jr.RetCode = 1; } } else if (action == "IsHaveParentWithContactIDs") { jr.Content = "無父母"; jr.RetCode = 0; string ContactIDs = Request.Form["ContactIDs"] ?? ""; if (ContactIDs != "" && Convert.ToInt32(DBUtil.DBOp("ConnDB", " SELECT count([ContactID]) FROM [dbo].[C_CaseUserContact] where exists ( select data from dbo.fn_slip_str({0},',') where data = [ContactID]) and ([ContactRelationShip]=2 or [ContactRelationShip]=3) and LogicDel=0 " , new string[] { ContactIDs }, NSDBUtil.CmdOpType.ExecuteScalar)) > 0) { jr.Content = "有父或母"; jr.RetCode = 1; } } } catch { jr.RetCode = 0; } Response.ContentType = "application/json; charset=utf-8"; Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(jr)); Response.End(); }