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 CoreFS.CA06; using Common; namespace Core.LZMes.Client.UIF { public partial class UIF041040 : CoreFS.CA06.FrmBase { public UIF041040() { InitializeComponent(); } #region "ToolBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { try { switch (ToolbarKey) { case "Query": Query(); break; case "Add": Commit_RollLen("Add"); break; case "Edit": Commit_RollLen("Edit"); break; case "Delete": Commit_RollLen("Delete"); break; case "Exit": this.Close(); break; } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Query() { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF04.UIF041040"; ccp.MethodName = "Query_Roll_Len"; //ccp.ServerParams = new object[] { this.cmb_GrpType.Value.ToString() }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["TBF02_ROLL_STD"].Clear(); System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_STD"]); tab0.TableName = "TBF02_ROLL_STD"; this.dataSet1.Tables["TBF02_ROLL_STD"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void Commit_RollLen(string Type_) { try { string sql = ""; switch (Type_) { case "Add": if (!CheckValue()) return; sql = "INSERT INTO TBF02_ROLL_STD(PLT,MINI,MAXI,REG_DTIME,REG_ID) VALUES(" + "'" + this.cmb_PLTName.Value.ToString() + "'," + Common.FixDBManager.CheckNullStr(this.txt_Mini.Text) + "," + Common.FixDBManager.CheckNullStr(this.txt_Maxi.Text) + "," + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')," + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "'" +")"; break; case "Edit": if (this.ugrd_RollLen.ActiveRow == null) { MessageBox.Show("请选择您要修改的记录行"); return; } if (!CheckValue()) return; sql = "UPDATE TBF02_ROLL_STD SET PLT='" + this.cmb_PLTName.Value.ToString() + "'," + "MINI=" + Common.FixDBManager.CheckNullStr(this.txt_Mini.Text) + "," + "MAXI=" + Common.FixDBManager.CheckNullStr(this.txt_Maxi.Text) + "," + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')," + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' " + "WHERE PLT='" + Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value) + "'"; break; case "Delete": if (this.ugrd_RollLen.ActiveRow == null) { MessageBox.Show("请选择您要删除的记录行"); return; } sql = "DELETE FROM TBF02_ROLL_STD WHERE PLT='" + Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value) + "'"; break; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF04.UIF041040"; ccp.MethodName = "Commit_Roll_Len"; ccp.ServerParams = new object[] { sql }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnInfo.Length == 0) Query(); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private bool CheckValue() { if (this.cmb_PLTName.Text.Trim().Length == 0) { MessageBox.Show("请您确认生产单位"); return false; } return true; } #endregion #region "Init" private void UIF041040_Load(object sender, EventArgs e) { try { GetBindData(); Common.FixDBManager.Init_ComboControl(this.cmb_PLTName, "TBZ00_COMMCD", "SM_CFNM", "SM_CD", ref this.dataSet1); Common.FixDBManager.SetGridDropDownList("PLT", "TBF02_ROLL_STD", 114, this.ugrd_RollLen, this.dataSet1.Tables["TBZ00_COMMCD"], "SM_CD", "SM_CFNM"); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void GetBindData() { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIF.UIF04.UIF041040"; ccp.MethodName = "Query_InitData"; //ccp.ServerParams = new object[] { "PL/TCM" }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { this.dataSet1.Tables["TBZ00_COMMCD"].Clear(); System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBZ00_COMMCD"]); tab0.TableName = "TBZ00_COMMCD"; this.dataSet1.Tables["TBZ00_COMMCD"].Merge(tab0); this.dataSet1.AcceptChanges(); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion #region "Grid Event" private void ugrd_RollLen_AfterRowActivate(object sender, EventArgs e) { try { this.cmb_PLTName.Value = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value); this.txt_Mini.Text = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["MINI"].Value); this.txt_Maxi.Text = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["MAXI"].Value); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion } }