派纳发送邮件功能
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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using UFIDA.U9.SCM.SM.SOUIModel;
using UFSoft.UBF.UI.WebControlAdapter;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.Engine.Builder;
using System.Data;
using UFSoft.UBF.Util.DataAccess;
using UFSoft.UBF.Sys.Database;
using UFSoft.UBF.UI.ActionProcess;
using UFSoft.UBF.UI.WebControls.Association.Adapter;
using UFSoft.UBF.UI.WebControls.Association;
using UFSoft.UBF.UI.WebControls.ClientCallBack;
using System.Collections;
using System.Collections.Specialized;
using UFSoft.UBF.UI.Controls;
using UFSoft.UBF.UI.WebControls;
using UFIDA.U9.UI.PDHelper;
using UFSoft.UBF.Business;
using UFSoft.UBF.View.Query;
using UFSoft.UBF.UI.IView;
using UFSoft.UBF.UI.FormProcess;
//using UFIDA.U9.Cust.WC.PriceList.PlugUI;
//using UFIDA.U9.PPR.PurPriceListUI;
namespace UFIDA.U9.Cust.WC.POSendMail.PlugUI
{
//UFIDA.U9.SCM.PM.PurPriceListUI.WebPart.dll
//UFIDA.U9.MFG.MO.DiscreteMOUIModel.MOStockMainUIFormWebPart
//程序集:UFIDA.U9.MFG.MO.DiscreteMOUI.WebPart.dll
public class PurchaseOrderMainUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase
{
//private UFIDA.U9.PPR.PurPriceListUI.PurPriceListMainUIFormWebPart part;
private UFIDA.U9.PM.PurchaseOrderUIModel.PurchaseOrderMainUIFormWebPart part;
//IUFDataGrid DataGrid4;
//配置文件XX.config文件拷贝到portal下,dll文件放置到portal/UILib下
//配置文件以WebPartExtend开头
public override void AfterInit(UFSoft.UBF.UI.IView.IPart Part, EventArgs args)
{
//首先调用原来的事件
base.AfterInit(Part, args);
//part = Part as UFIDA.U9.MFG.MO.DiscreteMOUIModel.MOStockMainUIFormWebPart;
part = Part as UFIDA.U9.PM.PurchaseOrderUIModel.PurchaseOrderMainUIFormWebPart;
if (part == null)
return;
//DataGrid4 = (IUFDataGrid)part.GetUFControlByName(part.TopLevelContainer, "DataGrid4");
#region 1.Toobar上添加按钮:页面扩展-加按钮
// (1)、实例化按钮
IUFButton btnPOSendMail = new UFWebButtonAdapter();
//(2)、加入功能栏Card中
IUFToolbar toolbar = (IUFToolbar)part.GetUFControlByName(part.TopLevelContainer, "Toolbar1");//Toolbar2 Toolbar1
if (toolbar != null)
{
string guid = "435CE19A-4458-4700-8EEF-ABD7ED06D50A";// 在数据库生成下GUID,或者修改下这里的值。SELECT NEWID()
btnPOSendMail = UIControlBuilder.BuilderToolbarButton(toolbar, "True", "btnPOSendMail", "True", "True", 70, 28, "22", "", true, false,
guid, guid, guid);
UIControlBuilder.SetButtonAccessKey(btnPOSendMail);
btnPOSendMail.Text = "发送邮件";
btnPOSendMail.ID = "BtnPOSendMail0";
btnPOSendMail.AutoPostBack = true;
btnPOSendMail.UIModel = part.Model.ElementID;
((UFWebToolbarAdapter)toolbar).Items.Add(btnPOSendMail as System.Web.UI.WebControls.WebControl);
btnPOSendMail.Click += new EventHandler(btnPOSendMail_Click);
}
#endregion
//2.Card里面增加按钮
//设置按钮在容器中的位置
#region 2.Card里面增加按钮
//IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
//IUFButton _btnPrice = new UFWebButtonAdapter();
//_btnPrice.Text = "参考价格";
//_btnPrice.ID = "BtnReferencePrice";
//_btnPrice.AutoPostBack = true;
//card.Controls.Add(_btnPrice);
//CommonFunction.Layout(card, _btnPrice, 8, 0); //一般为从左往右按钮个数乘以2
#endregion
//3、Card的DropDownButton里面添加按钮
#region Card的DropDownButton里面添加按钮
//IUFMenu btnPRToPM1 = new UFWebMenuAdapter();
//btnPRToPM1.Text = "参考价格";
//btnPRToPM1.ID = "BtnReferencePrice2";
//btnPRToPM1.AutoPostBack = true;
//IUFDropDownButton menuButtion = (IUFDropDownButton)CommonFunction.FindControl(part, "Card0", "DDBtnOperation");
//if (menuButtion != null)
//{
// //menuButtion.Click += new EventHandler(menuButtion_Click);
// menuButtion.MenuItems.Add(btnPRToPM1);
//}
#endregion
}
void btnPRToPM_Click(object sender, EventArgs e)
{
}
void btnPOSendMail_Click(object sender, EventArgs e)
{
UFSoft.UBF.UI.IView.IPart Part = this.part;
//if (this.part.Model.PurPriceList.FocusedRecord.Supplier_Code == "")
// throw new Exception("当前页面中没有供应商数据,请先维护");
//if (this.part.Model.PurPriceList_PurPriceLines.RecordCount == 0)
// throw new Exception("当前页面中没有行,请先维护");
//int POState = part.Model.PurchaseOrder.FocusedRecord.Status.Value;//Status
//if (POState == 2 || POState == 0)
//{
//this.part.Context.Request.QueryString["POCode"] = part.Model.PurchaseOrder.FocusedRecord.DocNo;
Part.CurrentState["OrgID"] = this.part.Model.PurchaseOrder.FieldOrg.DefaultValue;
Part.CurrentState["SupplierName"] = part.Model.PurchaseOrder.FocusedRecord.Supplier_Name;
Part.CurrentState["SupplierCode"] = part.Model.PurchaseOrder.FocusedRecord.Supplier_Code;
Part.CurrentState["POCode"] = part.Model.PurchaseOrder.FocusedRecord.DocNo;
List<string> ItemCodeList = new List<string>();
//foreach (PurPriceList_PurPriceLinesRecord item in this.part.Model.PurPriceList_PurPriceLines.Records)
//{
// //Part.CurrentState["ItemCode"] = item.FocusedRecord.ItemInfo_ItemCode;
// ItemCodeList.Add(item.ItemInfo_ItemCode);
//}
//Part.CurrentState["ItemCode"] = ItemCodeList;
Part.ShowAtlasModalDialog("0a1d23b5-171b-42eb-9296-7df200076bfc", "发送邮件", "725", "445", "", null, false, false, false);
//Part.ShowAtlasModalDialog("c06f9588-1538-44dd-9adf-886c23727e54", "参考价格", "785", "515", "", null, false, false, false);
//}
}
public override void AfterEventProcess(UFSoft.UBF.UI.IView.IPart Part, string eventName, object sender, EventArgs args)
{
//BaseWebForm webPart = _strongPart as BaseWebForm;
//UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
////保存按钮
//if (webButton != null)
//{
// if (webButton.ID == "BtnReferencePrice0")
// {
// //if (this.part.Model.PurPriceList.FocusedRecord.Supplier_Code== "")
// // throw new Exception("当前页面中没有供应商数据,请先维护");
// //if (this.part.Model.PurPriceList_PurPriceLines.RecordCount ==0)
// // throw new Exception("当前页面中没有行,请先维护");
// //Part.CurrentState["SupplierCode"] = part.Model.PurPriceList.FocusedRecord.Supplier_Code;
// //foreach (PurPriceList_PurPriceLinesView item in this.part.Model.PurPriceList_PurPriceLines.Records)
// //{
// // Part.CurrentState["ItemCode"] = item.FocusedRecord.ItemInfo_ItemCode;
// //}
// //Part.ShowAtlasModalDialog("45d71a79-a9aa-4495-8793-9012f0e4ffc4", "参考价格", "424", "272","", null, false, false, false);
// }
//}
base.AfterEventProcess(Part, eventName, sender, args);
}
public override void AfterRender(IPart Part, EventArgs args)
{
base.AfterRender(Part, args);
}
}
}
//namespace UFIDA.U9.Cust.Demo.PlugUI
//{
// public class SOMainUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase
// {
// private UFIDA.U9.SCM.SM.SOUIModel.StandardSOMainUIFormWebPart part;
// IUFDataGrid DataGrid4;
// //配置文件XX.config文件拷贝到portal下,dll文件放置到portal/UILib下
// //配置文件以WebPartExtend开头
// public override void AfterInit(UFSoft.UBF.UI.IView.IPart Part, EventArgs args)
// {
// //首先调用原来的事件
// base.AfterInit(Part, args);
// part = Part as UFIDA.U9.SCM.SM.SOUIModel.StandardSOMainUIFormWebPart;
// if (part == null)
// return;
// DataGrid4 = (IUFDataGrid)part.GetUFControlByName(part.TopLevelContainer, "DataGrid4");
// #region 1.Toobar上添加按钮:页面扩展-加按钮
// // (1)、实例化按钮
// IUFButton btnPRToPM = new UFWebButtonAdapter();
// //(2)、加入功能栏Card中
// IUFToolbar toolbar = (IUFToolbar)part.GetUFControlByName(part.TopLevelContainer, "Toolbar1");
// if (toolbar != null)
// {
// string guid = "047FC9F5-46C0-449A-83C2-2822BCF24012";// 在数据库生成下GUID,或者修改下这里的值。SELECT NEWID()
// btnPRToPM = UIControlBuilder.BuilderToolbarButton(toolbar, "True", "btnPRToPM", "True", "True", 70, 28, "7", "", true, false,
// guid, guid, guid);
// UIControlBuilder.SetButtonAccessKey(btnPRToPM);
// btnPRToPM.Text = "查询促销订单";
// btnPRToPM.ID = "BtnQuerySaleOrder";
// btnPRToPM.AutoPostBack = true;
// btnPRToPM.UIModel = part.Model.ElementID;
// ((UFWebToolbarAdapter)toolbar).Items.Add(btnPRToPM as System.Web.UI.WebControls.WebControl);
// btnPRToPM.Click += new EventHandler(btnPRToPM_Click);
// }
// #endregion
// //2.Card里面增加按钮
// //设置按钮在容器中的位置
// #region 2.Card里面增加按钮
// IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
// IUFButton btnPRToPM2 = new UFWebButtonAdapter();
// btnPRToPM2.Text = "查询促销主档";
// btnPRToPM2.ID = "BtnQurySaleOrder1";
// btnPRToPM2.AutoPostBack = true;
// card.Controls.Add(btnPRToPM2);
// CommonFunction.Layout(card, btnPRToPM2, 18, 0); //一般为从左往右按钮个数乘以2
// #endregion
// //3、Card的DropDownButton里面添加按钮
// #region Card的DropDownButton里面添加按钮
// IUFMenu btnPRToPM1 = new UFWebMenuAdapter();
// btnPRToPM1.Text = "查询促销订单";
// btnPRToPM1.ID = "BtnQurySaleOrder2";
// btnPRToPM1.AutoPostBack = true;
// IUFDropDownButton menuButtion = (IUFDropDownButton)CommonFunction.FindControl(part, "Card0", "DDBtnOperation");
// if (menuButtion != null)
// {
// //menuButtion.Click += new EventHandler(menuButtion_Click);
// menuButtion.MenuItems.Add(btnPRToPM1);
// }
// #endregion
// }
// void btnPRToPM_Click(object sender, EventArgs e)
// {
// }
// public override void AfterEventProcess(UFSoft.UBF.UI.IView.IPart Part, string eventName, object sender, EventArgs args)
// {
// UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
// //复制按钮
// if (webButton != null && webButton.Action == "NewClick")
// {
// part.CurrentSessionState["XXX"] = "xxx";
// }
// base.AfterEventProcess(Part, eventName, sender, args);
// }
// public override void AfterRender(IPart Part, EventArgs args)
// {
// base.AfterRender(Part, args);
// }
// }
//}