init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,270 @@
|
||||
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;
|
||||
using CommonLib;
|
||||
using DevExpress.XtraPrinting;
|
||||
using DevExpress.XtraPrinting.Preview;
|
||||
using System.IO;
|
||||
using Lskj.DBUtility.Helper;
|
||||
using System.Data.Common;
|
||||
|
||||
|
||||
//DllBaseClass
|
||||
namespace EmployeeManager
|
||||
{
|
||||
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
public string ModuleId { set; get; }
|
||||
public FrmMain()
|
||||
{
|
||||
// this.textBox1=PubUtil.
|
||||
//DevExpress.XtraGrid.Localization.GridResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraGridCHS();
|
||||
//DevExpress.XtraEditors.Controls.Localizer.Active = new Dxper.LocalizationCHS.Win.XtraEditorsCHS();
|
||||
//DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraLayoutCHS();
|
||||
//DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraPrintingCHS();
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
private DbHelper dbHelper = Lskj.DBUtility.DbHelperFactory.GetDbHelper();
|
||||
private DbDataAdapter da;
|
||||
private DataSet ds = new DataSet();
|
||||
|
||||
|
||||
private void FrmMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
Ls.dx.SelectRow(gridView2);
|
||||
|
||||
if (Ls.sysstr.str3 == "2")
|
||||
{
|
||||
Ls.dx.SelectRow(gridView1);
|
||||
BtnDel.Enabled = false;
|
||||
BtnAdd.Enabled = false;
|
||||
btnSave.Enabled = false;
|
||||
}
|
||||
|
||||
dbHelper.ConnectionString = SqlHelper.conn.ConnectionString;
|
||||
try
|
||||
{
|
||||
string subidstr = "|" + ERPInfo.Instance.SubSysId + "|";
|
||||
string sql = "select id,tagid,trim(softmodule) as softmodule ,tagname from P_BaseMixInfoTypeTab where charindex('" + subidstr + "',useed)>0 order by orderid ";
|
||||
sql = @"select id,tagid,rtrim(softmodule) as softmodule,tagname
|
||||
from P_BaseMixInfoTypeTab
|
||||
where SoftModule in ('公用信息','人员档案','客户信息','供应商管理','采购申请单','采购订单')
|
||||
order by SoftModule,tagid ";
|
||||
da = dbHelper.CreateDataAdapter2(sql);
|
||||
ds.Tables.Clear();
|
||||
da.Fill(ds);
|
||||
gridControl2.DataSource = ds.Tables[0];
|
||||
LoadData();
|
||||
|
||||
// gridControl2.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PubUtil.WriteLog("基础数据模块错误:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void btnSave_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder((SqlDataAdapter)da);
|
||||
da.Update(ds);
|
||||
MessageBox.Show("修改成功");
|
||||
//MessageBox("修改成功", "朗速科技");
|
||||
}
|
||||
|
||||
private void button2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Qbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
FrmTest f = new FrmTest();
|
||||
f.ShowDialog();
|
||||
f.Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
gridView1.OptionsFind.AlwaysVisible = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void btnClose_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
private void BtnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
Ls.dx.Preview(gridControl1, gridView1.ViewCaption);
|
||||
|
||||
}
|
||||
|
||||
private void BtnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Ls.dx.SaveXls(gridControl1);
|
||||
|
||||
}
|
||||
|
||||
private void gridView2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
LoadData();
|
||||
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
string ID = gridView2.GetFocusedRowCellValue("tagid").ToString();
|
||||
|
||||
string sql = "select Id,Mix_apellation,Mix_Bak,Tag,Ban,tmp1,tmp2,orderid,bases1,bases2 from dbo.P_BaseMixInfoTab " +
|
||||
" where tag=" + ID + " order by orderid ";
|
||||
da = dbHelper.CreateDataAdapter2(sql);
|
||||
|
||||
ds.Tables.Clear();
|
||||
da.Fill(ds);
|
||||
gridControl1.DataSource = ds.Tables[0];
|
||||
|
||||
string cap = gridView2.GetFocusedRowCellValue("softmodule").ToString() + "." + gridView2.GetFocusedRowCellValue("tagname").ToString();
|
||||
gridView1.ViewCaption = cap;
|
||||
lblFLTXT.Text = cap;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PubUtil.WriteLog("基础数据模块错误:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
string Lid = gridView2.GetFocusedRowCellValue("tagid").ToString();
|
||||
int val = dbHelper.ExecuteSql("insert P_BaseMixInfoTab(orderid,mix_no,Mix_apellation,Mix_Bak,Tag) " +
|
||||
" select " + (gridView1.RowCount+1)+ ",'输入编号','输入类别','输入备注'," + Lid + " ");
|
||||
|
||||
LoadData();
|
||||
gridView1.MoveLast();
|
||||
//gridView1.IsLastRow=true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder((SqlDataAdapter) da);
|
||||
da.Update(ds);
|
||||
MessageBox.Show("修改成功");
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
|
||||
DialogResult dr = MessageBox.Show("确定删除数据吗?", "朗速科技", messButton);
|
||||
if (dr == DialogResult.OK)//如果点击“确定”按钮
|
||||
{
|
||||
string Lid = gridView1.GetFocusedRowCellValue("Id").ToString();
|
||||
int val = dbHelper.ExecuteSql("delete P_BaseMixInfoTab where Id=" + Lid + "");
|
||||
gridView1.DeleteSelectedRows();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Clipboard.SetText(this.gridView1.GetCli
|
||||
// Clipboard.SetText(gridView1.GetSelectedRows);
|
||||
//.GetClipboardContent().GetData(DataFormats.Text).ToString());
|
||||
// gridControl1.
|
||||
// gridView1.GetSelectedRows
|
||||
Ls.dx.CopyTitle(gridView1);
|
||||
}
|
||||
|
||||
private void gridControl2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toolStripMenuItem2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region 窗体关闭事件
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (PubUtil.ModuleForms.ContainsKey(ModuleId))
|
||||
{
|
||||
DllModule dm = PubUtil.ModuleForms[ModuleId];
|
||||
if (dm != null)
|
||||
{
|
||||
dm.ModuleForm = null;
|
||||
dm.ModuleInPtr = IntPtr.Zero;
|
||||
PubUtil.ModuleForms.Remove(ModuleId);
|
||||
}
|
||||
}
|
||||
this.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SqlConnection connection = new SqlConnection(connectionString);
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
SqlDataAdapter da = new SqlDataAdapter(cmd);
|
||||
da.DeleteCommand = new SqlCommand("", connection);
|
||||
da.InsertCommand = new SqlCommand("", connection);
|
||||
da.UpdateCommand = new SqlCommand("", connection);
|
||||
|
||||
|
||||
SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(da);
|
||||
da.DeleteCommand = myCommandBuilder.GetDeleteCommand();
|
||||
da.InsertCommand = myCommandBuilder.GetInsertCommand();
|
||||
da.UpdateCommand = myCommandBuilder.GetUpdateCommand();
|
||||
|
||||
DataTable tb=(DataTable)datagridview1.DataSource;
|
||||
da.Update(tb);
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user