ab56a9bcf7
SVN-Revision: r240
118 lines
4.0 KiB
C#
118 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace NewMyFormDesigner
|
|
{
|
|
public partial class FrmGroup : Form
|
|
{
|
|
private string DllCoid = string.Empty;
|
|
private List<DataRow> SelectRows;
|
|
public FrmGroup(string dllCoid,List<DataRow> selectRows)
|
|
{
|
|
InitializeComponent();
|
|
this.SelectRows = selectRows;
|
|
this.DllCoid = dllCoid;
|
|
this.IniComBoxControl();
|
|
}
|
|
/// <summary>
|
|
/// 初始化绑定下拉框
|
|
/// </summary>
|
|
public void IniComBoxControl()
|
|
{
|
|
DataTable table = new DataTable();
|
|
table.Columns.Add("dm");
|
|
table.Columns.Add("mc");
|
|
table.Rows.Add("1", "先列后行");
|
|
table.Rows.Add("2", "先行后列");
|
|
txt_layoutMethod.DisplayMember = "mc";
|
|
txt_layoutMethod.ValueMember = "dm";
|
|
txt_layoutMethod.DataSource = table;
|
|
}
|
|
/// <summary>
|
|
/// 确定分组布局
|
|
/// </summary>
|
|
private void OnbtnOkClick(object sender, EventArgs e)
|
|
{
|
|
string msg=string.Empty;
|
|
string rpname = txt_GroupName.Text; int ListId = Convert.ToInt32(txt_MaxColumnCount.Text); int bakid = check_Bak.Checked ? 1 : 0; int Operateway = Convert.ToInt32(txt_layoutMethod.SelectedValue);
|
|
if (SelectRows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in SelectRows)
|
|
{
|
|
SqlHelper.ExecuteNonQuery(string.Format("update p_systemwordbooktab set rpname='{0}' where id='{1}'", rpname, dr["fieldid"] + ""));
|
|
}
|
|
|
|
int rValue= savedata(DllCoid, rpname, ListId, bakid, Operateway, out msg);
|
|
if (rValue == 1)
|
|
{
|
|
MessageBox.Show("分组成功!");
|
|
this.Close();
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
}
|
|
else {
|
|
MessageBox.Show(msg);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 执行保存时候的存储过程
|
|
/// </summary>
|
|
/// <param name="modid"></param>
|
|
/// <param name="tagid"></param>
|
|
/// <param name="mid"></param>
|
|
/// <returns></returns>
|
|
public int savedata(string modid, string rpname, int ListId, int bakid, int Operateway, out string msg)
|
|
{
|
|
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@modid",SqlDbType.VarChar,100),
|
|
new SqlParameter("@rpname",SqlDbType.VarChar,500),
|
|
new SqlParameter("@ListId",SqlDbType.Int),
|
|
new SqlParameter("@bakid",SqlDbType.Int),
|
|
new SqlParameter("@Operateway",SqlDbType.Int),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
param[0].Value = modid;
|
|
param[1].Value = rpname;
|
|
param[2].Value = ListId;
|
|
param[3].Value = bakid;
|
|
param[4].Value = Operateway;
|
|
SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "[p_systemwordbookTools]", param);
|
|
msg = pMsg.Value + "";
|
|
return Convert.ToInt32(returnValue.Value.ToString());
|
|
}
|
|
|
|
private void btn_close_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void FrmGroup_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txt_MaxColumnCount_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txt_layoutMethod_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|