| using System; | 
| using System.Collections.Generic; | 
| using System.ComponentModel; | 
| using System.Data; | 
| using System.Drawing; | 
| using System.Text; | 
| using System.Windows.Forms; | 
|   | 
| namespace APSM | 
| { | 
|     public partial class Sc_ICMOSortBillDlg_Remark : Form | 
|     { | 
|         public Sc_ICMOSortBillDlg_Remark() | 
|         { | 
|             InitializeComponent(); | 
|         } | 
|         public long HICMOInterID; | 
|         public long HSourceID; | 
|         public string HSplitNO; | 
|         public DateTime HDate; | 
|   | 
|         private void cmdCancel_Click(object sender, EventArgs e) | 
|         { | 
|             this.Visible = false; | 
|         } | 
|   | 
|         private void cmdOK_Click(object sender, EventArgs e) | 
|         { | 
|             if (!Sub_Save()) | 
|             { | 
|                 return; | 
|             } | 
|             // | 
|             this.Visible = false; | 
|         } | 
|   | 
|         private void Sub_Show() | 
|         { | 
|             DAL.ClsGy_Source_View oSource =new DAL.ClsGy_Source_View(); | 
|             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|             DataSet Ds = new DataSet(); | 
|             Ds = oCn.RunProcReturn("select * from h_v_Sc_ICMOSortBillSource where HMainID=" + HICMOInterID.ToString(), "h_v_Sc_ICMOSortBillSource"); | 
|             if (Ds.Tables[0].Rows.Count == 0) | 
|                 return; | 
|             txtHICMOBillNo.Tag = Ds.Tables[0].Rows[0]["HMainID"].ToString(); | 
|             txtHICMOBillNo.Text = Ds.Tables[0].Rows[0]["HBillNo"].ToString(); | 
|             txtHSplitNO.Text = HSplitNO; | 
|             txtHMaterNumber.Tag = Ds.Tables[0].Rows[0]["HMaterID"].ToString(); | 
|             txtHMaterNumber.Text = Ds.Tables[0].Rows[0]["HMaterNumber"].ToString(); | 
|             txtHMaterName.Text = Ds.Tables[0].Rows[0]["HMaterName"].ToString(); | 
|             txtHMaterModel.Text = Ds.Tables[0].Rows[0]["HMaterModel"].ToString(); | 
|             if (oSource.GetInfoByID(HSourceID)) | 
|             { | 
|                 txtHSourceNumber.Tag = oSource.omodel.HItemID; | 
|                 txtHSourceNumber.Text = oSource.omodel.HNumber; | 
|                 txtHSourceName.Text = oSource.omodel.HName; | 
|             } | 
|             else | 
|             { | 
|                 txtHSourceNumber.Tag = 0; | 
|                 txtHSourceNumber.Text = ""; | 
|                 txtHSourceName.Text = ""; | 
|             } | 
|             dtpHDate.Value = HDate; | 
|             // | 
|             Ds = null; | 
|             Ds = oCn.RunProcReturn("select * from Sc_ICMOSortBill_Remark where HICMOInterID=" + HICMOInterID.ToString() + " and HSplitNO='" + HSplitNO + "' and HSourceID=" + HSourceID.ToString() + " and HDate='" + HDate.ToShortDateString() + "'", "Sc_ICMOSortBill_Remark"); | 
|             if (Ds.Tables[0].Rows.Count == 0) | 
|                 return; | 
|             txtHRemark.Text = Ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
|             // | 
|             Ds = null; | 
|         } | 
|   | 
|         private bool Sub_Save() | 
|         { | 
|             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|             try | 
|             { | 
|                 oCn.BeginTran(); | 
|                 oCn.RunProc("Delete From Sc_ICMOSortBill_Remark where HICMOInterID=" + txtHICMOBillNo.Tag.ToString() + " and HSplitNO='" + txtHSplitNO.Text.Trim() + "' and HSourceID=" + txtHSourceNumber.Tag.ToString() + " and HDate='" + dtpHDate.Value.ToShortDateString() + "'"); | 
|                 // | 
|                 oCn.RunProc("Insert Into Sc_ICMOSortBill_Remark (HICMOInterID,HSplitNO,HMaterID,HSourceID,HDate,HRemark) values (" + | 
|                     txtHICMOBillNo.Tag.ToString() + ",'" + txtHSplitNO.Text.Trim() + "'," + txtHMaterNumber.Tag.ToString() + "," + txtHSourceNumber.Tag.ToString() + ",'" + dtpHDate.Value.ToShortDateString() + "','" + txtHRemark.Text.Trim() + "')"); | 
|                 // | 
|                 oCn.Commit(); | 
|                 return true; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 MessageBox.Show("ÉèÖñ¸×¢Ê§°Ü£¡ÔÒò£º" + e.Message, "Ìáʾ"); | 
|                 oCn.RollBack(); | 
|                 return false; | 
|             } | 
|         } | 
|   | 
|         private void Sc_ICMOSortBillDlg_Remark_Load(object sender, EventArgs e) | 
|         { | 
|             Sub_Show(); | 
|         } | 
|   | 
|     } | 
| } |