PageRenderTime 83ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/v1.0/YxShop/YXShop.TemplateAction/Lable/LabelParse_SendGroupBuyInfo.cs

http://acexpo.codeplex.com
C# | 211 lines | 199 code | 8 blank | 4 comment | 46 complexity | b2073baf86860d753976741a5892bbb9 MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, LGPL-2.1
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. namespace YXShop.TemplateAction
  7. {
  8. public partial class LabelParse
  9. {
  10. /// <summary>
  11. /// FS:LabelType=Other??????
  12. /// </summary>
  13. /// <returns></returns>
  14. public string SendGroupBuyInfo()
  15. {
  16. string reStr = string.Empty;
  17. string mystyle = this.Label_Inserted;
  18. string str_ShowType = this.GetParamValue("YX:ShowType");
  19. string str_ShowMode = this.GetParamValue("YX:ShowMode");
  20. string str_CompositorType = this.GetParamValue("YX:CompositorType");
  21. string str_CompositorField = this.GetParamValue("YX:CompositorField");
  22. string str_ShowRows = this.GetParamValue("YX:ShowRows");
  23. string str_ShowColumns = this.GetParamValue("YX:ShowColumns");
  24. string str_WhetherOmit=this.GetParamValue("YX:WhetherOmit");
  25. string str_NameCharacter = this.GetParamValue("YX:NameCharacter");
  26. string str_WhetherPagination = this.GetParamValue("YX:WhetherPagination");
  27. string str_TempletLayout = this.GetParamValue("YX:TempletLayout");
  28. string str_BewriteCharacter = this.GetParamValue("YX:BewriteCharacter");
  29. string cond = string.Empty;
  30. StringBuilder shtml = new StringBuilder();
  31. YXShop.Common.SysParameter sp = new YXShop.Common.SysParameter();
  32. int ShowRows = 1;//???
  33. if (!string.IsNullOrEmpty(str_ShowRows))
  34. {
  35. if (ChangeHope.Common.ValidateHelper.IsNumber(str_ShowRows))
  36. {
  37. ShowRows = Convert.ToInt32(str_ShowRows);//???
  38. }
  39. }
  40. int ShoeColumns = 1;//???
  41. if (!string.IsNullOrEmpty(str_ShowColumns))
  42. {
  43. if (ChangeHope.Common.ValidateHelper.IsNumber(str_ShowColumns))
  44. {
  45. ShoeColumns = Convert.ToInt32(str_ShowColumns);
  46. }
  47. }
  48. int pagesize=ShowRows*ShoeColumns;
  49. int NameCharacter = 20;//?????????
  50. if (!string.IsNullOrEmpty(str_NameCharacter))
  51. {
  52. if (ChangeHope.Common.ValidateHelper.IsNumber(str_NameCharacter))
  53. {
  54. NameCharacter = Convert.ToInt32(str_NameCharacter);//?????????
  55. }
  56. }
  57. int BewriteCharacter = 40;//?????????
  58. if (!string.IsNullOrEmpty(str_BewriteCharacter))
  59. {
  60. if (ChangeHope.Common.ValidateHelper.IsNumber(str_BewriteCharacter))
  61. {
  62. BewriteCharacter = Convert.ToInt32(str_BewriteCharacter);//?????????
  63. }
  64. }
  65. if (ChangeHope.Common.ValidateHelper.IsNumber(str_ShowMode))
  66. {
  67. if (str_ShowMode == "1")
  68. {
  69. int productid = ChangeHope.WebPage.PageRequest.GetQueryInt("q_productid");
  70. if (productid > 0)
  71. {
  72. cond += " and productid=" + productid + "";
  73. }
  74. }
  75. }
  76. if (!string.IsNullOrEmpty(str_ShowType))
  77. {
  78. if (str_ShowType == "1")
  79. {
  80. cond += " and state<>0";
  81. }
  82. }
  83. string OrderField=string.Empty;
  84. if(!string.IsNullOrEmpty(str_CompositorType))
  85. {
  86. if(str_CompositorField=="desc")
  87. {
  88. OrderField+=" [order by] id desc";
  89. }
  90. else
  91. {
  92. OrderField+=" [order by] id asc";
  93. }
  94. }
  95. string WhetherOmit = "";
  96. if (str_WhetherOmit == "true")
  97. {
  98. WhetherOmit = "...";
  99. }
  100. if (!string.IsNullOrEmpty(mystyle))
  101. {
  102. YXShop.BLL.Product.Product_SendGroupBuyInfo bll = new YXShop.BLL.Product.Product_SendGroupBuyInfo();
  103. YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo osubll = new YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo();
  104. ChangeHope.DataBase.DataByPage dataPage = bll.GetList(OrderField, pagesize, cond);
  105. if (dataPage.DataReader != null)
  106. {
  107. while (dataPage.DataReader.Read())
  108. {
  109. int SignUpNumber = 0;
  110. DataTable dt=osubll.GetActivityList(dataPage.DataReader["id"].ToString());
  111. if (dt.Rows.Count > 0)
  112. {
  113. for (int i = 0; i < dt.Rows.Count; i++)
  114. {
  115. SignUpNumber += Convert.ToInt32(dt.Rows[i]["signupcount"].ToString());
  116. }
  117. }
  118. string strContent = mystyle;
  119. if (strContent.IndexOf("[#ActivityNO]") > -1)
  120. {
  121. strContent = strContent.Replace("[#ActivityNO]", "No."+dataPage.DataReader["id"].ToString());
  122. }
  123. if (strContent.IndexOf("[#Title]") > -1)
  124. {
  125. strContent = strContent.Replace("[#Title]", ChangeHope.Common.StringHelper.SubStringAndAppend(dataPage.DataReader["title"].ToString(), NameCharacter, WhetherOmit));
  126. }
  127. if (strContent.IndexOf("[#Synopsis]") > -1)
  128. {
  129. strContent = strContent.Replace("[#Synopsis]", ChangeHope.Common.StringHelper.SubStringAndAppend(dataPage.DataReader["synopsis"].ToString(), BewriteCharacter, WhetherOmit));
  130. }
  131. if (strContent.IndexOf("[#Images]") > -1)
  132. {
  133. string ImagesUrl = string.Empty;
  134. if (dataPage.DataReader["images"].ToString() != string.Empty && dataPage.DataReader["images"].ToString() != "")
  135. {
  136. ImagesUrl = dataPage.DataReader["images"].ToString();
  137. }
  138. else
  139. {
  140. ImagesUrl = "images/NaughtImages.gif";
  141. }
  142. strContent = strContent.Replace("[#Images]", sp.DummyPaht + ImagesUrl);
  143. }
  144. if (strContent.IndexOf("[#Starte]") > -1)
  145. {
  146. string strStarte = string.Empty;
  147. if (dataPage.DataReader["state"].ToString() == "1")
  148. {
  149. strStarte = "????";
  150. }
  151. strContent = strContent.Replace("[#Starte]", strStarte);
  152. }
  153. if (strContent.IndexOf("[#SignUpNumber]") > -1)
  154. {
  155. strContent = strContent.Replace("[#SignUpNumber]", SignUpNumber.ToString());
  156. }
  157. if (strContent.IndexOf("[#GroupBuyQQ]") > -1)
  158. {
  159. strContent = strContent.Replace("[#GroupBuyQQ]", dataPage.DataReader["activityqq"].ToString());
  160. }
  161. if (strContent.IndexOf("[#ActivityAddress]") > -1)
  162. {
  163. strContent = strContent.Replace("[#ActivityAddress]", dataPage.DataReader["address"].ToString());
  164. }
  165. if (strContent.IndexOf("[#SignUpUrl]") > -1)
  166. {
  167. string LinkName=string.Empty;
  168. string AddressURL = Common.UrlStr("product_onlinesignup_form", "q_activityid=" + dataPage.DataReader["id"].ToString() + ";q_productid=" + dataPage.DataReader["productid"].ToString() + "", "product/");
  169. if(Convert.ToDateTime(dataPage.DataReader["activityendtime"].ToString())<System.DateTime.Now)
  170. {
  171. LinkName="<span color='#ccc'>?????</span>";
  172. AddressURL="#";
  173. }
  174. else
  175. {
  176. LinkName = "????";
  177. }
  178. strContent = strContent.Replace("[#SignUpUrl]", AddressURL);
  179. }
  180. if (strContent.IndexOf("[#ActivityStarteTime]") > -1)
  181. {
  182. strContent = strContent.Replace("[#ActivityStarteTime]", dataPage.DataReader["activitystarttime"].ToString());
  183. }
  184. if (strContent.IndexOf("[#ActivityEndTime]") > -1)
  185. {
  186. strContent = strContent.Replace("[#ActivityEndTime]", dataPage.DataReader["activityendtime"].ToString());
  187. }
  188. if (strContent.IndexOf("[#AcitvityInfoURL]") > -1)
  189. {
  190. strContent = strContent.Replace("[#AcitvityInfoURL]", Common.UrlStr("acivityinfocontent", "q_activityid=" + dataPage.DataReader["id"].ToString() + "", "product/"));
  191. }
  192. shtml.Append(strContent);
  193. }
  194. }
  195. if (str_WhetherPagination == "true")
  196. {
  197. shtml.Append(dataPage.ReceptionToolBar);
  198. }
  199. }
  200. return shtml.ToString();
  201. }
  202. }
  203. }