private void ServiceReport() { string Command = @"select followby,item,qty,submitby,starttime,endtime,otstarttime,otendtime,posttime,solution from carpark.dbo.SRtable where linkid=@linkid"; DataSet ds = null; try { ds = SqlHelper.ExecuteDataset(fr2.constr, CommandType.Text, Command, new SqlParameter("@linkid", id)); //execute } catch (SqlException sqle) { MessageBox.Show("Can't get data from SRdb" + sqle.ToString()); return; } try { DataTable SR = ds.Tables[0]; if (SR.Rows.Count <= 0) { MessageBox.Show("Nobody has submit service report for your case yet!!!"); } else { ServiceReport sr = new ServiceReport(); sr.Followby = SR.Rows[0][0].ToString(); sr.Item = SR.Rows[0][1].ToString(); sr.Itemqty = SR.Rows[0][2].ToString(); sr.Submitby = SR.Rows[0][3].ToString(); sr.Starttime = SR.Rows[0][4].ToString().Substring(0, 19); sr.Endtime = SR.Rows[0][5].ToString().Substring(0, 19); sr.Otstarttime = SR.Rows[0][6].ToString().Substring(0, 19); sr.Otendtime = SR.Rows[0][7].ToString().Substring(0, 19); sr.Reportsubmittime = SR.Rows[0][8].ToString().Substring(0, 19); sr.Solution = SR.Rows[0][9].ToString(); // MessageBox.Show(sr.Starttime); ServiceReportForm srf = new ServiceReportForm(sr); srf.Show(); } } catch (SqlException e) { LogClass.WirteLine("Read service report error:" + e.ToString()); } }
//public ServiceReportForm() //{ // this.sr = sr1; //} public ServiceReportForm(ServiceReport sr) { InitializeComponent(); this.sr = sr; }