init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
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;
|
||||
|
||||
|
||||
//DllBaseClass
|
||||
namespace EmployeeManager
|
||||
{
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
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 SqlDataAdapter 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;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
string subidstr = "|" + ERPInfo.Instance.SubSysId + "|";
|
||||
string sql = "select id,tagid,softmodule,tagname from P_BaseMixInfoTypeTab where charindex('" + subidstr + "',useed)>0 order by orderid ";
|
||||
da = SqlHelper.ExecuteAdapter(CommandType.Text,sql);
|
||||
ds.Tables.Clear();
|
||||
da.Fill(ds);
|
||||
gridControl2.DataSource = ds.Tables[0];
|
||||
|
||||
// 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(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);
|
||||
|
||||
}
|
||||
|
||||
private void BtnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Ls.dx.SaveXls(gridControl1);
|
||||
|
||||
}
|
||||
|
||||
private void gridView2_Click(object sender, EventArgs e)
|
||||
{
|
||||
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+" and ban=0 order by orderid ";
|
||||
da = SqlHelper.ExecuteAdapter(CommandType.Text, sql);
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
ds.Tables.Clear();
|
||||
da.Fill(ds);
|
||||
gridControl1.DataSource = ds.Tables[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PubUtil.WriteLog("基础数据模块错误:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
string Lid = gridView2.GetFocusedRowCellValue("tagid").ToString();
|
||||
int val = SqlHelper.ExecuteNonQuery(SqlHelper.conn, CommandType.Text, "insert P_BaseMixInfoTab(orderid,mix_no,Mix_apellation,Mix_Bak,Tag) " +
|
||||
" select " + (gridView1.RowCount+1)+ ",'输入编号','输入类别','输入备注'," + Lid + " ", null);
|
||||
LoadData();
|
||||
gridView1.MoveLast();
|
||||
//gridView1.IsLastRow=true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder(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 = SqlHelper.ExecuteNonQuery(SqlHelper.conn, CommandType.Text, "delete P_BaseMixInfoTab where Id=" + Lid + "", null);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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