private SqlCommand parametersValue(SqlCommand cmd, WorkReportData wrd) { cmd.Parameters["@tCod"].Value = wrd.TaskCode; cmd.Parameters["@publ"].Value = wrd.Publisher; cmd.Parameters["@mCod"].Value = wrd.MemberCode; cmd.Parameters["@rDat"].Value = wrd.ReportDate; cmd.Parameters["@wCon"].Value = wrd.WorkCont; cmd.Parameters["@wDtl"].Value = wrd.WorkDetail; cmd.Parameters["@mCCd"].Value = wrd.MCostCode; cmd.Parameters["@mNH"].Value = wrd.MemberNH; cmd.Parameters["@mOH"].Value = wrd.MemberOH; cmd.Parameters["@wCCd"].Value = wrd.WCostCode; cmd.Parameters["@wNH"].Value = wrd.WorkingNH; cmd.Parameters["@wOH"].Value = wrd.WorkingOH; cmd.Parameters["@note"].Value = wrd.Note; cmd.Parameters["@slip"].Value = wrd.SlipNo; cmd.Parameters["@mNID"].Value = wrd.MemNHCostReportID; cmd.Parameters["@mOID"].Value = wrd.MemOHCostReportID; cmd.Parameters["@wNID"].Value = wrd.WorkNHCostReportID; cmd.Parameters["@wOID"].Value = wrd.WorkOHCostReportID; cmd.Parameters["@wCID"].Value = wrd.WorkContCostReportID; cmd.Parameters["@mOCd"].Value = wrd.MOfficeCode; cmd.Parameters["@mDep"].Value = wrd.MDepartment; cmd.Parameters["@wOCd"].Value = wrd.WOfficeCode; cmd.Parameters["@wDep"].Value = wrd.WDepartment; cmd.Parameters["@uChk"].Value = wrd.UserCheck; return(cmd); }
public bool UpdateWorkReport(WorkReportData wrd) { using (TransactionScope tran = new TransactionScope()) using (SqlConnection conn = new SqlConnection(ConnectionString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand(updSql, conn); cmd = parametersSqlDbType(cmd); cmd = parametersValue(cmd, wrd); if (TryExecute(conn, cmd) < 0) { return(false); } } catch (SqlException sqle) { MessageBox.Show("SQLエラー errorno " + Convert.ToString(sqle.Number) + " " + sqle.Message); conn.Close(); return(false); } conn.Close(); tran.Complete(); } return(true); }
public bool UpdatePartWorkReport(int slipNo, int crID, decimal qty) { WorkReportData wrd = loadWorkReport(slipNo); if (wrd.MemNHCostReportID == crID) { wrd.MemberNH = qty; } if (wrd.MemOHCostReportID == crID) { wrd.MemberOH = qty; } if (wrd.WorkNHCostReportID == crID) { wrd.WorkingNH = qty; } if (wrd.WorkOHCostReportID == crID) { wrd.WorkingOH = qty; } return(UpdateWorkReport(wrd)); }
//--------------------------------------------------------// // Method //--------------------------------------------------------// public object Clone() { WorkReportData cloneData = new WorkReportData(); cloneData.WorkReportID = this.WorkReportID; cloneData.TaskCode = this.TaskCode; cloneData.Publisher = this.Publisher; cloneData.MemberCode = this.MemberCode; cloneData.ReportDate = this.ReportDate; cloneData.WorkCont = this.WorkCont; cloneData.WorkDetail = this.WorkDetail; cloneData.MCostCode = this.MCostCode; cloneData.MemberNH = this.MemberNH; cloneData.MemberOH = this.MemberOH; cloneData.WCostCode = this.WCostCode; cloneData.WorkingNH = this.WorkingNH; cloneData.WorkingOH = this.WorkingOH; cloneData.Note = this.Note; cloneData.SlipNo = this.SlipNo; cloneData.MemNHCostReportID = this.MemNHCostReportID; cloneData.MemOHCostReportID = this.MemOHCostReportID; cloneData.WorkNHCostReportID = this.WorkNHCostReportID; cloneData.WorkOHCostReportID = this.WorkOHCostReportID; cloneData.WorkContCostReportID = this.WorkContCostReportID; cloneData.MOfficeCode = this.MOfficeCode; cloneData.MDepartment = this.MDepartment; cloneData.WOfficeCode = this.WOfficeCode; cloneData.WDepartment = this.WDepartment; cloneData.UserCheck = this.UserCheck; cloneData.OfficeCode = this.OfficeCode; cloneData.Department = this.Department; return(cloneData); }
public bool ClearPartWorkReport(int slipNo, int crID) { WorkReportData wrd = loadWorkReport(slipNo); if (wrd.MemNHCostReportID == crID) { wrd.MemberNH = 0; wrd.MemNHCostReportID = 0; } if (wrd.MemOHCostReportID == crID) { wrd.MemberOH = 0; wrd.MemOHCostReportID = 0; } if (wrd.WorkNHCostReportID == crID) { wrd.WorkingNH = 0; wrd.WorkNHCostReportID = 0; } if (wrd.WorkOHCostReportID == crID) { wrd.WorkingOH = 0; wrd.WorkOHCostReportID = 0; } if (wrd.WorkContCostReportID == crID) { wrd.WorkCont = ""; wrd.WorkContCostReportID = 0; } if (wrd.MemberNH == 0 && wrd.MemberOH == 0) { wrd.MCostCode = ""; } if (wrd.WorkingNH == 0 && wrd.WorkingOH == 0) { wrd.WCostCode = ""; wrd.WOfficeCode = ""; wrd.WDepartment = ""; } if (wrd.MemNHCostReportID == 0 && wrd.MemOHCostReportID == 0 && wrd.WorkNHCostReportID == 0 && wrd.WorkOHCostReportID == 0 && wrd.WorkContCostReportID == 0) { return(DeleteWorkReport(slipNo)); } return(UpdateWorkReport(wrd)); }
private WorkReportData loadWorkReport(int slipNo) { SqlHandling sh = new SqlHandling("D_WorkReport"); DataTable dt = sh.SelectAllData("WHERE SlipNo = " + slipNo); if (dt == null || dt.Rows.Count < 1) { return(null); } WorkReportData wrd = new WorkReportData(dt.Rows[0]); return(wrd); }