using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using IPP.Info.Online;
using IPP.Info.Basic;
using IPP.Biz.Basic;
using IPP.Cmn;
using IPP.Biz.Online;
using IPP.Biz;
using IPP.Dac;
using System.Configuration;
namespace SetCustomerPoint
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
BindComboBox();
txtSqlScript.Text = @"select * from customer where SysNo in(select
CustomerSysNo from Ecommerce.dbo.Promotion_Acer)";
txtMemo.Text = "Test txtMemo";
txtNote.Text = "Test txtNote";
}
private void btnOK_Click(object sender, EventArgs e)
{
try
{
#region ----得到需要增加积分的客户的CustomerSysNo
SqlConnection con = new SqlConnection(
ConfigurationSettings.AppSettings["ConnectionString"].ToString());
SqlDataAdapter sda = new SqlDataAdapter(txtSqlScript.Text, con);
//DataTable dt= SqlHelper.ExecuteDataSet(txtSqlScript.Text.Trim()).Tables[0];
DataTable dt = new DataTable();
sda.Fill(dt);
#endregion
#region -----给筛选出来客户赠送积分
if (int.Parse(txtPointCount.Text.Trim()) <= 0)
{
label1.Text = "请输入赠送的积分数量,谢谢!";
return;
}
foreach (DataRow dr in dt.Rows)
{
CustomerManager.GetInstance().TransferPoint(
int.Parse(dr[0].ToString()),
int.Parse(txtPointCount.Text.Trim()),
txtMemo.Text.Trim(),
txtNote.Text.Trim(),
txtSystemAccount.Text.Trim(),
(PointLogType)ddlType.SelectedValue);
}
#endregion
label1.Text = "操作成功,影响的记录条数:" + dt.Rows.Count.ToString();
}
catch (Exception ex)
{
label1.Text = "您好,请检查您选择的积分操作类型是否正确";
return;
}
}
#region ---绑订客户获取积分的原因,数据从枚举中获取
private void BindComboBox()
{
ddlType.DisplayMember = "Value";
ddlType.ValueMember = "Key";
ddlType.DataSource = CommonFunctions.GetEnumItems(typeof(AppEnum.PointLogType), false);
ddlType.SelectedValue = 25;
}
#endregion
}
}