派纳发送邮件功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
12 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. //using UFIDA.U9.SCM.SM.SOUIModel;
  6. using UFSoft.UBF.UI.WebControlAdapter;
  7. using UFSoft.UBF.UI.ControlModel;
  8. using UFSoft.UBF.UI.MD.Runtime;
  9. using UFSoft.UBF.UI.Engine.Builder;
  10. using System.Data;
  11. using UFSoft.UBF.Util.DataAccess;
  12. using UFSoft.UBF.Sys.Database;
  13. using UFSoft.UBF.UI.ActionProcess;
  14. using UFSoft.UBF.UI.WebControls.Association.Adapter;
  15. using UFSoft.UBF.UI.WebControls.Association;
  16. using UFSoft.UBF.UI.WebControls.ClientCallBack;
  17. using System.Collections;
  18. using System.Collections.Specialized;
  19. using UFSoft.UBF.UI.Controls;
  20. using UFSoft.UBF.UI.WebControls;
  21. using UFIDA.U9.UI.PDHelper;
  22. using UFSoft.UBF.Business;
  23. using UFSoft.UBF.View.Query;
  24. using UFSoft.UBF.UI.IView;
  25. using UFSoft.UBF.UI.FormProcess;
  26. //using UFIDA.U9.Cust.WC.PriceList.PlugUI;
  27. //using UFIDA.U9.PPR.PurPriceListUI;
  28. namespace UFIDA.U9.Cust.WC.POSendMail.PlugUI
  29. {
  30. //UFIDA.U9.SCM.PM.PurPriceListUI.WebPart.dll
  31. //UFIDA.U9.MFG.MO.DiscreteMOUIModel.MOStockMainUIFormWebPart
  32. //程序集:UFIDA.U9.MFG.MO.DiscreteMOUI.WebPart.dll
  33. public class PurchaseOrderMainUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase
  34. {
  35. //private UFIDA.U9.PPR.PurPriceListUI.PurPriceListMainUIFormWebPart part;
  36. private UFIDA.U9.PM.PurchaseOrderUIModel.PurchaseOrderMainUIFormWebPart part;
  37. //IUFDataGrid DataGrid4;
  38. //配置文件XX.config文件拷贝到portal下,dll文件放置到portal/UILib下
  39. //配置文件以WebPartExtend开头
  40. public override void AfterInit(UFSoft.UBF.UI.IView.IPart Part, EventArgs args)
  41. {
  42. //首先调用原来的事件
  43. base.AfterInit(Part, args);
  44. //part = Part as UFIDA.U9.MFG.MO.DiscreteMOUIModel.MOStockMainUIFormWebPart;
  45. part = Part as UFIDA.U9.PM.PurchaseOrderUIModel.PurchaseOrderMainUIFormWebPart;
  46. if (part == null)
  47. return;
  48. //DataGrid4 = (IUFDataGrid)part.GetUFControlByName(part.TopLevelContainer, "DataGrid4");
  49. #region 1.Toobar上添加按钮:页面扩展-加按钮
  50. // (1)、实例化按钮
  51. IUFButton btnPOSendMail = new UFWebButtonAdapter();
  52. //(2)、加入功能栏Card中
  53. IUFToolbar toolbar = (IUFToolbar)part.GetUFControlByName(part.TopLevelContainer, "Toolbar1");//Toolbar2 Toolbar1
  54. if (toolbar != null)
  55. {
  56. string guid = "435CE19A-4458-4700-8EEF-ABD7ED06D50A";// 在数据库生成下GUID,或者修改下这里的值。SELECT NEWID()
  57. btnPOSendMail = UIControlBuilder.BuilderToolbarButton(toolbar, "True", "btnPOSendMail", "True", "True", 70, 28, "22", "", true, false,
  58. guid, guid, guid);
  59. UIControlBuilder.SetButtonAccessKey(btnPOSendMail);
  60. btnPOSendMail.Text = "发送邮件";
  61. btnPOSendMail.ID = "BtnPOSendMail0";
  62. btnPOSendMail.AutoPostBack = true;
  63. btnPOSendMail.UIModel = part.Model.ElementID;
  64. ((UFWebToolbarAdapter)toolbar).Items.Add(btnPOSendMail as System.Web.UI.WebControls.WebControl);
  65. btnPOSendMail.Click += new EventHandler(btnPOSendMail_Click);
  66. }
  67. #endregion
  68. //2.Card里面增加按钮
  69. //设置按钮在容器中的位置
  70. #region 2.Card里面增加按钮
  71. //IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
  72. //IUFButton _btnPrice = new UFWebButtonAdapter();
  73. //_btnPrice.Text = "参考价格";
  74. //_btnPrice.ID = "BtnReferencePrice";
  75. //_btnPrice.AutoPostBack = true;
  76. //card.Controls.Add(_btnPrice);
  77. //CommonFunction.Layout(card, _btnPrice, 8, 0); //一般为从左往右按钮个数乘以2
  78. #endregion
  79. //3、Card的DropDownButton里面添加按钮
  80. #region Card的DropDownButton里面添加按钮
  81. //IUFMenu btnPRToPM1 = new UFWebMenuAdapter();
  82. //btnPRToPM1.Text = "参考价格";
  83. //btnPRToPM1.ID = "BtnReferencePrice2";
  84. //btnPRToPM1.AutoPostBack = true;
  85. //IUFDropDownButton menuButtion = (IUFDropDownButton)CommonFunction.FindControl(part, "Card0", "DDBtnOperation");
  86. //if (menuButtion != null)
  87. //{
  88. // //menuButtion.Click += new EventHandler(menuButtion_Click);
  89. // menuButtion.MenuItems.Add(btnPRToPM1);
  90. //}
  91. #endregion
  92. }
  93. void btnPRToPM_Click(object sender, EventArgs e)
  94. {
  95. }
  96. void btnPOSendMail_Click(object sender, EventArgs e)
  97. {
  98. UFSoft.UBF.UI.IView.IPart Part = this.part;
  99. //if (this.part.Model.PurPriceList.FocusedRecord.Supplier_Code == "")
  100. // throw new Exception("当前页面中没有供应商数据,请先维护");
  101. //if (this.part.Model.PurPriceList_PurPriceLines.RecordCount == 0)
  102. // throw new Exception("当前页面中没有行,请先维护");
  103. //int POState = part.Model.PurchaseOrder.FocusedRecord.Status.Value;//Status
  104. //if (POState == 2 || POState == 0)
  105. //{
  106. //this.part.Context.Request.QueryString["POCode"] = part.Model.PurchaseOrder.FocusedRecord.DocNo;
  107. Part.CurrentState["OrgID"] = this.part.Model.PurchaseOrder.FieldOrg.DefaultValue;
  108. Part.CurrentState["SupplierName"] = part.Model.PurchaseOrder.FocusedRecord.Supplier_Name;
  109. Part.CurrentState["SupplierCode"] = part.Model.PurchaseOrder.FocusedRecord.Supplier_Code;
  110. Part.CurrentState["POCode"] = part.Model.PurchaseOrder.FocusedRecord.DocNo;
  111. List<string> ItemCodeList = new List<string>();
  112. //foreach (PurPriceList_PurPriceLinesRecord item in this.part.Model.PurPriceList_PurPriceLines.Records)
  113. //{
  114. // //Part.CurrentState["ItemCode"] = item.FocusedRecord.ItemInfo_ItemCode;
  115. // ItemCodeList.Add(item.ItemInfo_ItemCode);
  116. //}
  117. //Part.CurrentState["ItemCode"] = ItemCodeList;
  118. Part.ShowAtlasModalDialog("0a1d23b5-171b-42eb-9296-7df200076bfc", "发送邮件", "725", "445", "", null, false, false, false);
  119. //Part.ShowAtlasModalDialog("c06f9588-1538-44dd-9adf-886c23727e54", "参考价格", "785", "515", "", null, false, false, false);
  120. //}
  121. }
  122. public override void AfterEventProcess(UFSoft.UBF.UI.IView.IPart Part, string eventName, object sender, EventArgs args)
  123. {
  124. //BaseWebForm webPart = _strongPart as BaseWebForm;
  125. //UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
  126. ////保存按钮
  127. //if (webButton != null)
  128. //{
  129. // if (webButton.ID == "BtnReferencePrice0")
  130. // {
  131. // //if (this.part.Model.PurPriceList.FocusedRecord.Supplier_Code== "")
  132. // // throw new Exception("当前页面中没有供应商数据,请先维护");
  133. // //if (this.part.Model.PurPriceList_PurPriceLines.RecordCount ==0)
  134. // // throw new Exception("当前页面中没有行,请先维护");
  135. // //Part.CurrentState["SupplierCode"] = part.Model.PurPriceList.FocusedRecord.Supplier_Code;
  136. // //foreach (PurPriceList_PurPriceLinesView item in this.part.Model.PurPriceList_PurPriceLines.Records)
  137. // //{
  138. // // Part.CurrentState["ItemCode"] = item.FocusedRecord.ItemInfo_ItemCode;
  139. // //}
  140. // //Part.ShowAtlasModalDialog("45d71a79-a9aa-4495-8793-9012f0e4ffc4", "参考价格", "424", "272","", null, false, false, false);
  141. // }
  142. //}
  143. base.AfterEventProcess(Part, eventName, sender, args);
  144. }
  145. public override void AfterRender(IPart Part, EventArgs args)
  146. {
  147. base.AfterRender(Part, args);
  148. }
  149. }
  150. }
  151. //namespace UFIDA.U9.Cust.Demo.PlugUI
  152. //{
  153. // public class SOMainUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase
  154. // {
  155. // private UFIDA.U9.SCM.SM.SOUIModel.StandardSOMainUIFormWebPart part;
  156. // IUFDataGrid DataGrid4;
  157. // //配置文件XX.config文件拷贝到portal下,dll文件放置到portal/UILib下
  158. // //配置文件以WebPartExtend开头
  159. // public override void AfterInit(UFSoft.UBF.UI.IView.IPart Part, EventArgs args)
  160. // {
  161. // //首先调用原来的事件
  162. // base.AfterInit(Part, args);
  163. // part = Part as UFIDA.U9.SCM.SM.SOUIModel.StandardSOMainUIFormWebPart;
  164. // if (part == null)
  165. // return;
  166. // DataGrid4 = (IUFDataGrid)part.GetUFControlByName(part.TopLevelContainer, "DataGrid4");
  167. // #region 1.Toobar上添加按钮:页面扩展-加按钮
  168. // // (1)、实例化按钮
  169. // IUFButton btnPRToPM = new UFWebButtonAdapter();
  170. // //(2)、加入功能栏Card中
  171. // IUFToolbar toolbar = (IUFToolbar)part.GetUFControlByName(part.TopLevelContainer, "Toolbar1");
  172. // if (toolbar != null)
  173. // {
  174. // string guid = "047FC9F5-46C0-449A-83C2-2822BCF24012";// 在数据库生成下GUID,或者修改下这里的值。SELECT NEWID()
  175. // btnPRToPM = UIControlBuilder.BuilderToolbarButton(toolbar, "True", "btnPRToPM", "True", "True", 70, 28, "7", "", true, false,
  176. // guid, guid, guid);
  177. // UIControlBuilder.SetButtonAccessKey(btnPRToPM);
  178. // btnPRToPM.Text = "查询促销订单";
  179. // btnPRToPM.ID = "BtnQuerySaleOrder";
  180. // btnPRToPM.AutoPostBack = true;
  181. // btnPRToPM.UIModel = part.Model.ElementID;
  182. // ((UFWebToolbarAdapter)toolbar).Items.Add(btnPRToPM as System.Web.UI.WebControls.WebControl);
  183. // btnPRToPM.Click += new EventHandler(btnPRToPM_Click);
  184. // }
  185. // #endregion
  186. // //2.Card里面增加按钮
  187. // //设置按钮在容器中的位置
  188. // #region 2.Card里面增加按钮
  189. // IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
  190. // IUFButton btnPRToPM2 = new UFWebButtonAdapter();
  191. // btnPRToPM2.Text = "查询促销主档";
  192. // btnPRToPM2.ID = "BtnQurySaleOrder1";
  193. // btnPRToPM2.AutoPostBack = true;
  194. // card.Controls.Add(btnPRToPM2);
  195. // CommonFunction.Layout(card, btnPRToPM2, 18, 0); //一般为从左往右按钮个数乘以2
  196. // #endregion
  197. // //3、Card的DropDownButton里面添加按钮
  198. // #region Card的DropDownButton里面添加按钮
  199. // IUFMenu btnPRToPM1 = new UFWebMenuAdapter();
  200. // btnPRToPM1.Text = "查询促销订单";
  201. // btnPRToPM1.ID = "BtnQurySaleOrder2";
  202. // btnPRToPM1.AutoPostBack = true;
  203. // IUFDropDownButton menuButtion = (IUFDropDownButton)CommonFunction.FindControl(part, "Card0", "DDBtnOperation");
  204. // if (menuButtion != null)
  205. // {
  206. // //menuButtion.Click += new EventHandler(menuButtion_Click);
  207. // menuButtion.MenuItems.Add(btnPRToPM1);
  208. // }
  209. // #endregion
  210. // }
  211. // void btnPRToPM_Click(object sender, EventArgs e)
  212. // {
  213. // }
  214. // public override void AfterEventProcess(UFSoft.UBF.UI.IView.IPart Part, string eventName, object sender, EventArgs args)
  215. // {
  216. // UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
  217. // //复制按钮
  218. // if (webButton != null && webButton.Action == "NewClick")
  219. // {
  220. // part.CurrentSessionState["XXX"] = "xxx";
  221. // }
  222. // base.AfterEventProcess(Part, eventName, sender, args);
  223. // }
  224. // public override void AfterRender(IPart Part, EventArgs args)
  225. // {
  226. // base.AfterRender(Part, args);
  227. // }
  228. // }
  229. //}