public bool UpdateWOresponse(int wrsp_RespNum, int wrsp_WOnum, string wrsp_Proj, int?wrsp_StatNum, string wrsp_Status, int?wrsp_statFlag, int?wrsp_EstMnths, int?wrsp_EstHrs, string wrsp_Results, string wrsp_Consider, string wrsp_Risks) { WorkOrder.WOresponseDataTable Responses = WOrespAdapter.GetWorkOrderResponseByResponseNum(wrsp_RespNum, wrsp_WOnum, wrsp_Proj); // new WorkOrder.WOresponseDataTable(); if (Responses.Count == 0) { return(false); } WorkOrder.WOresponseRow response = Responses[0]; //.Rows.NewWOresponseRow(); int MaxrespNum = Convert.ToInt32(WOrespAdapter.MaxResponseNum(wrsp_WOnum, wrsp_Proj)); //if (MaxrespNum == null) MaxrespNum = 0; response.wrsp_RespNum = MaxrespNum + 1; response.wrsp_WOnum = wrsp_WOnum; response.wrsp_Proj = wrsp_Proj; if (wrsp_StatNum == null) { response.Setwrsp_StatNumNull(); } else { response.wrsp_StatNum = wrsp_StatNum.Value; } if (wrsp_Status == null) { response.Setwrsp_StatusNull(); } else { response.wrsp_Status = wrsp_Status; } if (wrsp_statFlag == null) { response.Setwrsp_statFlagNull(); } else { response.wrsp_statFlag = wrsp_statFlag.Value; } if (wrsp_EstMnths == null) { response.Setwrsp_EstMnthsNull(); } else { response.wrsp_EstMnths = wrsp_EstMnths.Value; } if (wrsp_EstHrs == null) { response.Setwrsp_EstHrsNull(); } else { response.wrsp_EstHrs = wrsp_EstHrs.Value; } if (wrsp_Results == null) { response.Setwrsp_ResultsNull(); } else { response.wrsp_Results = wrsp_Results; } if (wrsp_Consider == null) { response.Setwrsp_ConsiderNull(); } else { response.wrsp_Consider = wrsp_Consider; } if (wrsp_Risks == null) { response.Setwrsp_RisksNull(); } else { response.wrsp_Risks = wrsp_Risks; } //Responses.AddWOresponseRow(response); int rowsAffected = WOrespAdapter.Update(Responses); return(rowsAffected == 1); }
public bool InsertNewWOresponse(int wrsp_RespNum, int wrsp_WOnum, string wrsp_Proj, int?wrsp_StatNum, string wrsp_Status, int?wrsp_statFlag, int?wrsp_EstMnths, int?wrsp_EstHrs, string wrsp_Results, string wrsp_Consider, string wrsp_Risks, int?wrsp_uid, DateTime wrsp_datetime) { WorkOrder.WOresponseDataTable Responses = new WorkOrder.WOresponseDataTable(); WorkOrder.WOresponseRow response = Responses.NewWOresponseRow(); WOresponseTableAdapter respAdapter = new WOresponseTableAdapter(); int MaxrespNum = Convert.ToInt32(respAdapter.MaxResponseNum(wrsp_WOnum, wrsp_Proj)); response.wrsp_RespNum = MaxrespNum + 1; response.wrsp_WOnum = wrsp_WOnum; response.wrsp_Proj = wrsp_Proj; if (wrsp_StatNum == null) { response.Setwrsp_StatNumNull(); } else { response.wrsp_StatNum = wrsp_StatNum.Value; } if (wrsp_Status == null) { response.Setwrsp_StatusNull(); } else { response.wrsp_Status = wrsp_Status; } if (wrsp_statFlag == null) { response.Setwrsp_statFlagNull(); } else { response.wrsp_statFlag = wrsp_statFlag.Value; } if (wrsp_EstMnths == null) { response.Setwrsp_EstMnthsNull(); } else { response.wrsp_EstMnths = wrsp_EstMnths.Value; } if (wrsp_EstHrs == null) { response.Setwrsp_EstHrsNull(); } else { response.wrsp_EstHrs = wrsp_EstHrs.Value; } if (wrsp_Results == null) { response.Setwrsp_ResultsNull(); } else { response.wrsp_Results = wrsp_Results; } if (wrsp_Consider == null) { response.Setwrsp_ConsiderNull(); } else { response.wrsp_Consider = wrsp_Consider; } if (wrsp_Risks == null) { response.Setwrsp_RisksNull(); } else { response.wrsp_Risks = wrsp_Risks; } if (wrsp_uid == null) { response.Setwrsp_uidNull(); } else { response.wrsp_uid = wrsp_uid.Value; } if (wrsp_datetime == null || wrsp_datetime.CompareTo(Convert.ToDateTime("1/1/0001")) == 0) { response.Setwrsp_datetimeNull(); } else { response.wrsp_datetime = wrsp_datetime; } Responses.AddWOresponseRow(response); int rowsAffected = WOrespAdapter.Update(Responses); return(rowsAffected == 1); }