266 lines
13 KiB
C#
266 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Drawing;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Configuration;
|
|
using SuperMap.RealEstate.CoreFrameWork;
|
|
using SuperMap.RealEstate.ServiceModel;
|
|
using SuperMap.RealEstate.Utility;
|
|
using SuperMap.RealEstate.Web.UI;
|
|
using SuperMap.RealEstate.Web.UI.WebControls;
|
|
using SuperMap.RealEstate.Web.Utility;
|
|
using SuperMap.RealEstate.CoreFrameWork.Dictionary.Business;
|
|
using Business = SuperMap.RealEstate.HighWay.Storage.Business;
|
|
using MSPB = SuperMap.RealEstate.MobileServicePlatform.Business;
|
|
using HZQR.Common;
|
|
|
|
namespace SuperMap.RealEstate.HighWay.CloudModule.Commodity
|
|
{
|
|
public partial class MessageSend : BasePage
|
|
{
|
|
protected string SERVERPARTID = ConfigurationManager.AppSettings["UmiformCommodity"].ToString().Split('|')[0];
|
|
|
|
#region 方法 -> 页面加载
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
|
|
//if (string.IsNullOrEmpty(access_token.Text.Trim()))
|
|
//{
|
|
// MSPB.WECHATPUBLICSIGN _WECHATPUBLICSIGN = new MSPB.WECHATPUBLICSIGN(Transaction);
|
|
// _WECHATPUBLICSIGN.WECHATPUBLICSIGN_ID = 3;
|
|
// if (_WECHATPUBLICSIGN.Select())
|
|
// {
|
|
// AppID.Text = _WECHATPUBLICSIGN.WECHAT_APPID;
|
|
// AppSecret.Text = _WECHATPUBLICSIGN.WECHAT_APPSECRET;
|
|
|
|
// MSPB.PUSHMODULE _PUSHMODULE = new MSPB.PUSHMODULE(Transaction);
|
|
// _PUSHMODULE.AddSearchParameter("WECHATPUBLICSIGN_ID", _WECHATPUBLICSIGN.WECHATPUBLICSIGN_ID);
|
|
// _PUSHMODULE.AddSearchParameter("PUSHMODULE_NUM", "SalePriceChange");
|
|
// if (_PUSHMODULE.Search())
|
|
// {
|
|
// PUSH_MODULE.Text = _PUSHMODULE.PUSHMODULE_CODE;
|
|
// }
|
|
// }
|
|
|
|
// access_token.Text = MSPB.CommonHelper.GetAccess(RefreshTime, AppID.Text, AppSecret.Text);
|
|
//}
|
|
STARTDATE.Text = DateTime.Now.ToShortDateString();
|
|
//重置状态
|
|
BindDropDownList_SERVERPART();
|
|
//初始化并加载列表
|
|
GridViewEx1.SelectingWithInit<Business.COMMODITY>(ObjectDataSource1, GridPageEx1,
|
|
DictionaryHelper.GetDictionary(Transaction, "BUSINESSTYPE"),
|
|
DictionaryHelper.GetDictionary(Transaction, "COMMODITYGRADE").AsNewKeys("COMMODITY_GRADE"),
|
|
DictionaryHelper.GetDictionary(Transaction, "COMMODITYSTATE").AsNewKeys("COMMODITY_STATE"));
|
|
//设置回车焦点按钮
|
|
SetControlClientAction(ButtonSearch);
|
|
//注册遮罩式窗口关闭脚本
|
|
SetControlClosePopDialog(ButtonClose);
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 列表事件
|
|
//查询
|
|
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(TextBox_Search.Text))
|
|
{
|
|
Session["TextBox_Search_VALUE"] = TextBox_Search.Text;
|
|
}
|
|
GridViewEx1.Selecting<Business.COMMODITY>(ObjectDataSource1, GridPageEx1);
|
|
//设置UI变化
|
|
e.SetValue(GridViewEx1);
|
|
e.SetValue(GridPageEx1);
|
|
}
|
|
|
|
//翻页事件
|
|
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
|
|
{
|
|
GridViewEx1.Pagging<Business.COMMODITY>(ObjectDataSource1, GridPageEx1);
|
|
//设置UI变化
|
|
e.SetValue(GridViewEx1);
|
|
}
|
|
|
|
//查询SQL设置
|
|
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(TextBox_Search.Text))
|
|
{
|
|
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
|
|
}
|
|
e.AddAndParams("1", 1);
|
|
|
|
if (SERVERPART_ID.SelectedValue != "" && SERVERPART_ID.SelectedValue != "1=1")
|
|
{
|
|
e.AddAndParams("SERVERPART_ID", SERVERPART_ID.SelectedValue);
|
|
}
|
|
else
|
|
{
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") + "SERVERPART_ID IN (" +
|
|
new Business.SERVERPART(Transaction).GetPassportServerPartID(this.PassportInfo.CityAuthority) + ")";
|
|
}
|
|
if (!string.IsNullOrEmpty(STARTDATE.Text.Trim()))
|
|
{
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
"OPERATE_DATE >= TO_DATE('" + STARTDATE.Text.Trim() + "','YYYY/MM/DD HH24:MI:SS')";
|
|
}
|
|
if (!string.IsNullOrEmpty(ENDDATE.Text.Trim()))
|
|
{
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
"OPERATE_DATE < TO_DATE('" + ENDDATE.Text.Trim() + "','YYYY/MM/DD HH24:MI:SS')";
|
|
}
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
"COMMODITY_ID NOT IN (SELECT Field_Value FROM HIGHWAY_STORAGE.T_MODIFYFROMSTORAGE WHERE HIGHWAYPROINST_ID = " +
|
|
Request["ID"].ToDecrypt() + " AND Table_Name = 'T_COMMODITY' AND Field_Name = 'COMMODITY_ID')";
|
|
//排序
|
|
e.AddOrderByParams(GridViewOrderBy1);
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 加载服务区下拉框【根据用户信息】
|
|
public void BindDropDownList_SERVERPART()
|
|
{
|
|
SERVERPART_ID.Items.Clear();
|
|
ListItemEx _ListItemFirst = new ListItemEx();
|
|
_ListItemFirst.Text = "全部";
|
|
_ListItemFirst.Value = "1=1";
|
|
SERVERPART_ID.Items.Insert(0, _ListItemFirst);
|
|
foreach (Business.SERVERPART _SERVERPART in new Business.SERVERPART(Transaction).GetPassportServerPart(PassportInfo.CityAuthority))
|
|
{
|
|
ListItemEx _ListItemEx = new ListItemEx();
|
|
_ListItemEx.Value = _SERVERPART.SERVERPART_ID.ToString();
|
|
_ListItemEx.Text = _SERVERPART.SERVERPART_NAME;
|
|
SERVERPART_ID.Items.Add(_ListItemEx);
|
|
}
|
|
SERVERPART_ID.SelectedValue = SERVERPARTID;
|
|
}
|
|
#endregion
|
|
|
|
protected void SERVERPART_ID_CallBackSetControl(object sender, ClientSetEventArgs e)
|
|
{
|
|
Session["SERVERPART_ID_SELECT_VALUE"] = e.Argument;
|
|
ButtonSearch_CallBackClick(null, e);
|
|
}
|
|
|
|
#region 方法 -> 消息推送
|
|
protected void BtnSend_Click(object sender, EventArgs e)
|
|
{
|
|
string _COMMODITY_ID = "";
|
|
foreach (GridViewRow _GridViewRow in GridViewEx1.Rows)
|
|
{
|
|
if (_GridViewRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
CheckBoxEx _CheckBox = _GridViewRow.Cells[1].FindControl("CheckBox_Select") as CheckBoxEx;
|
|
|
|
if (_CheckBox.Checked)
|
|
{
|
|
_COMMODITY_ID += (string.IsNullOrEmpty(_COMMODITY_ID) ? "" : ",") +
|
|
GridViewEx1.DataKeys[_GridViewRow.RowIndex]["COMMODITY_ID"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(_COMMODITY_ID))
|
|
{
|
|
Alert("请勾选商品后推送调价信息!");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Business.HIGHWAYPROINST _HIGHWAYPROINST = new Business.HIGHWAYPROINST(Transaction);
|
|
_HIGHWAYPROINST.Dept_ID = int.Parse(SERVERPARTID);
|
|
_HIGHWAYPROINST.Dept_Name = "统一定价商品调整";
|
|
_HIGHWAYPROINST.HIGHWAYPROINST_CREATEDATE = DateTime.Now;
|
|
_HIGHWAYPROINST.HIGHWAYPROINST_ENDDATE = DateTime.Now;
|
|
_HIGHWAYPROINST.Staff_Id = PassportInfo.ID;
|
|
_HIGHWAYPROINST.Staff_Name = PassportInfo.Name;
|
|
_HIGHWAYPROINST.HIGHWAYPROINST_DESC = "统一定价商品调价推送";
|
|
_HIGHWAYPROINST.Insert();
|
|
|
|
foreach (string str in _COMMODITY_ID.Split(','))
|
|
{
|
|
Business.MODIFYFROMSTORAGE _MODIFYFROMSTORAGE = new Business.MODIFYFROMSTORAGE(Transaction);
|
|
_MODIFYFROMSTORAGE.HIGHWAYPROINST_ID = _HIGHWAYPROINST.HIGHWAYPROINST_ID;
|
|
_MODIFYFROMSTORAGE.Table_Name = "T_COMMODITY";
|
|
_MODIFYFROMSTORAGE.Field_Name = "COMMODITY_ID";
|
|
_MODIFYFROMSTORAGE.Field_Value = str;
|
|
_MODIFYFROMSTORAGE.Insert();
|
|
}
|
|
string ErrorString = "";
|
|
MSPB.GROUPPUSHDETAIL _GROUPPUSHDETAIL = new MSPB.GROUPPUSHDETAIL(Transaction);
|
|
_GROUPPUSHDETAIL.PUSH_TITLE = "您的店铺有" + _COMMODITY_ID.Split(',').Length + "件商品发生价格变动,请点击详情查看信息!";
|
|
_GROUPPUSHDETAIL.PUSH_FIRSTCONTENT = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
_GROUPPUSHDETAIL.PUSH_SECONDCONTENT = _HIGHWAYPROINST.HIGHWAYPROINST_ENDDATE.ToString();
|
|
foreach (MSPB.RTWECHATPUSH _RTWECHATPUSH in new MSPB.RTWECHATPUSH(Transaction).FillCollection(
|
|
"WHERE RTWECHATPUSH_ID IN (SELECT RTWECHATPUSH_ID FROM T_RTWECAHTPUSHDTAIL WHERE PUSH_MODULE LIKE '%" +
|
|
PUSH_MODULE.Text + "%')"))
|
|
{
|
|
if (!MSPB.CommonHelper.StartToSend(PUSH_MODULE.Text, access_token, _RTWECHATPUSH,
|
|
_GROUPPUSHDETAIL, 2, RefreshTime, AppID.Text, AppSecret.Text,
|
|
"http://eshangtech.com:8000/GoodsApproval/Business/index.html?HIGHWAYPROINST_ID=" +
|
|
_HIGHWAYPROINST.HIGHWAYPROINST_ID_Encrypt))
|
|
{
|
|
ErrorString += (string.IsNullOrEmpty(ErrorString) ? "" : ",") + _RTWECHATPUSH.USER_NAME;
|
|
}
|
|
}
|
|
|
|
Alert("发送完成!" + (string.IsNullOrEmpty(ErrorString) ? "" : "其中" + ErrorString + "发送失败!"));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 选择推送商品
|
|
protected void ButtonNew_Click(object sender, EventArgs e)
|
|
{
|
|
int AddCount = 0;
|
|
foreach (GridViewRow _GVR in GridViewEx1.Rows)
|
|
{
|
|
if (_GVR.RowType == DataControlRowType.DataRow)
|
|
{
|
|
CheckBoxEx _CheckBox = _GVR.Cells[1].FindControl("CheckBox_Select") as CheckBoxEx;
|
|
if (_CheckBox.Checked)
|
|
{
|
|
string _COMMODITY_ID = GridViewEx1.DataKeys[_GVR.RowIndex]["COMMODITY_ID"].ToString();
|
|
|
|
Business.MODIFYFROMSTORAGE _MODIFYFROMSTORAGE = new Business.MODIFYFROMSTORAGE(Transaction);
|
|
if (_MODIFYFROMSTORAGE.GetCount("WHERE Field_Value = " + _COMMODITY_ID + " AND HIGHWAYPROINST_ID = " +
|
|
Request["ID"].ToDecrypt() + " AND Table_Name = 'T_COMMODITY' AND Field_Name = 'COMMODITY_ID'") == 0)
|
|
{
|
|
_MODIFYFROMSTORAGE.ResetProperty();
|
|
_MODIFYFROMSTORAGE.HIGHWAYPROINST_ID = Request["ID"].ToDecryptInt32();
|
|
_MODIFYFROMSTORAGE.Table_Name = "T_COMMODITY";
|
|
_MODIFYFROMSTORAGE.Field_Name = "COMMODITY_ID";
|
|
_MODIFYFROMSTORAGE.Field_Value = _COMMODITY_ID;
|
|
_MODIFYFROMSTORAGE.Insert();
|
|
AddCount++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (AddCount == 0)
|
|
{
|
|
Alert("请勾选商品进行添加!");
|
|
}
|
|
else
|
|
{
|
|
Alert("选择成功 !", 3);
|
|
}
|
|
//初始化并加载列表
|
|
GridViewEx1.SelectingWithInit<Business.RTSUPPLIER>(ObjectDataSource1, GridPageEx1,
|
|
DictionaryHelper.GetDictionary(Transaction, "BUSINESSTYPE"),
|
|
DictionaryHelper.GetDictionary(Transaction, "COMMODITYGRADE").AsNewKeys("COMMODITY_GRADE"),
|
|
DictionaryHelper.GetDictionary(Transaction, "COMMODITYSTATE").AsNewKeys("COMMODITY_STATE"));
|
|
//选取完成关闭
|
|
//RefreshOpenerGridPage(RefreshGridPageType.Insert, AddCount);
|
|
ExecClientScript("$('#pop-dialog-frame-HighWayProinstPage',parent.parent.document).attr('src', " +
|
|
"'/HighWay/Modules/Commodity/HighWayProinstPage.aspx?ID=" + Request["ID"] +
|
|
"&PopDialogPageName=F_R_GridPageEx1&PopDialogName=HighWayProinstPage&r=0.7170074964121915')");
|
|
}
|
|
#endregion
|
|
}
|
|
} |