Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Data.SqlClient;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Configuration;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using WayneEntity;
  11. using System.Text;
  12.  
  13. public partial class CaseMaintain_CaseUserGetContactInfoOP : BasePage
  14. {
  15. public List<MyPowerVM> PowerList = new List<MyPowerVM>();
  16. public bool bAdd = false;
  17. public bool bEdit = false;
  18. public CaseMaintain_CaseUserGetContactInfoOP()
  19. {
  20. PowerList = base.AddPower("/CaseMaintain/UserProfileList.aspx"
  21. , MyPowerEnum.修改
  22. , MyPowerEnum.新增
  23. , MyPowerEnum.瀏覽
  24. );
  25.  
  26. }
  27.  
  28. protected void Page_Load(object sender, EventArgs e)
  29. {
  30. //base.AllowHttpMethod("POST");
  31.  
  32. int ContactID = 0;
  33. int.TryParse(Request["ContactID"], out ContactID);
  34. StringBuilder sb = new StringBuilder("");
  35.  
  36. JsonReply r = new JsonReply();
  37.  
  38. int ContactCaseID = 0;
  39. int CaseID = 0;
  40.  
  41.  
  42. //SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetCaseUserContact");
  43. //cmd.CommandType = CommandType.StoredProcedure;
  44. //cmd.Parameters.AddWithValue("@ContactID", ContactID);
  45.  
  46. //DataTable dt = DB.GetDataTable(cmd, "ConnDB");
  47. //if (dt.Rows.Count > 0)
  48. //{
  49. // sb.Append("<table>");
  50. // 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());
  51. // 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());
  52.  
  53. // sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "行動電話:", BindMobile(ContactCaseID));
  54. // sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電子郵件:", BindEmail(ContactCaseID));
  55.  
  56. // sb.Append("</table>");
  57. //}
  58. r = new JsonReply();
  59.  
  60.  
  61. if (ContactID != 0)
  62. {
  63.  
  64. UserContact uc = new UserContact(ContactID);
  65. ContactCaseID = uc.ContactCaseID;
  66. CaseID = uc.CaseID;
  67. }
  68.  
  69. CaseUserProfile c = new CaseUserProfile(ContactCaseID);
  70. if (c.CaseID != 0)
  71. {
  72.  
  73. sb.Append("<table>");
  74. sb.AppendFormat("<tr><td style='width:90px'>{0}</td><td>{1}</td></tr>", "姓名:", c.ChName);
  75.  
  76. sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(日):", c.TelDayArea + ' ' + c.TelDayNo + (c.TelDayExt!="" ? "分機" + c.TelDayExt :"" ));
  77.  
  78. sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", "電話(夜):", c.TelNightArea + ' ' + c.TelNightNo + (c.TelNightExt != "" ? "分機" + c.TelNightExt : "") );
  79.  
  80. 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()));
  81. 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()));
  82.  
  83. sb.Append("</table>");
  84.  
  85. //ltBirthDate.Text = c.BirthDate;
  86. //ltIdNo.Text = c.IdNo;
  87. //ltName.Text = c.ChName;
  88.  
  89. ;
  90.  
  91.  
  92. }
  93.  
  94. r.RetCode = 1;
  95. r.Content = sb.ToString();
  96.  
  97. Response.ContentType = "application/json; charset=utf-8";
  98. Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(r));
  99. Response.End();
  100. }
  101.  
  102.  
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement