public int AddAndReturnID(object pobjObjectMaster, DataSet pdstData) { //add master and get id PRO_WorkOrderMasterVO voWOMaster = (PRO_WorkOrderMasterVO)pobjObjectMaster; dsWorkOrderMaster = new PRO_WorkOrderMasterDS(); voWOMaster.WorkOrderMasterID = dsWorkOrderMaster.AddAndReturnID(pobjObjectMaster); foreach (DataRow drow in pdstData.Tables[0].Rows) { // 19-04-2006 dungla: fix bug for NgaHT: refine start date-time and due date-time DateTime dtmStartTime = (DateTime)drow[PRO_WorkOrderDetailTable.STARTDATE_FLD]; dtmStartTime = new DateTime(dtmStartTime.Year, dtmStartTime.Month, dtmStartTime.Day, dtmStartTime.Hour, dtmStartTime.Minute, 0); DateTime dtmToTime = (DateTime)drow[PRO_WorkOrderDetailTable.DUEDATE_FLD]; dtmToTime = new DateTime(dtmToTime.Year, dtmToTime.Month, dtmToTime.Day, dtmToTime.Hour, dtmToTime.Minute, 0); // update new date time drow[PRO_WorkOrderDetailTable.STARTDATE_FLD] = dtmStartTime; drow[PRO_WorkOrderDetailTable.DUEDATE_FLD] = dtmToTime; // 19-04-2006 dungla: fix bug for NgaHT: refine start date-time and due date-time drow[PRO_WorkOrderMasterTable.WORKORDERMASTERID_FLD] = voWOMaster.WorkOrderMasterID; } //update detail dsWorkOrderDetail = new PRO_WorkOrderDetailDS(); dsWorkOrderDetail.UpdateDataSet(pdstData); //copy BOM and Routing //DataSet dsNewDataSetForBOM = GetWODetailByMaster(voWOMaster.WorkOrderMasterID); //CopyBOMData(dsNewDataSetForBOM, voWOMaster.CCNID, voWOMaster.MasterLocationID); //CopyRoutingDataToConvertWO(voWOMaster.WorkOrderMasterID); //return ID return(voWOMaster.WorkOrderMasterID); }
/// <summary> /// GetWorkOrderNo /// </summary> /// <param name="pstrQuery"></param> /// <returns></returns> /// <author>Trada</author> /// <date>Friday, Mar 24 2006</date> public DataSet GetWorkOrderNo(string pstrQuery) { DataSet dstReturn = new DataSet(); PRO_WorkOrderMasterDS dsWorkOrderMaster = new PRO_WorkOrderMasterDS(); dstReturn = dsWorkOrderMaster.GetWorkOrderNo(pstrQuery); return(dstReturn); }
public void DeleteWOAndWOLines(object pObjectVO, DataSet pdstData, ArrayList parlWOLineDeleted) { PRO_WorkOrderMasterVO voWOMaster = (PRO_WorkOrderMasterVO)pObjectVO; dsWorkOrderDetail = new PRO_WorkOrderDetailDS(); dsWorkOrderMaster = new PRO_WorkOrderMasterDS(); //delete detail dsWorkOrderDetail.DeleteByWOMasterID(voWOMaster.WorkOrderMasterID); }
public object GetObjectWOMasterVO(int pintWOMasterID) { // try // { dsWorkOrderMaster = new PRO_WorkOrderMasterDS(); return(dsWorkOrderMaster.GetObjectVO(pintWOMasterID)); // } // catch (PCSDBException ex) // { // throw ex; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } }
public void UpdateWOAndWOLines(object pObjectDetail, DataSet pdstData, ArrayList parlWOLineDeleted) { //update Master dsWorkOrderMaster = new PRO_WorkOrderMasterDS(); dsWorkOrderDetail = new PRO_WorkOrderDetailDS(); dsWorkOrderMaster.Update(pObjectDetail); PRO_WorkOrderMasterVO voWOMaster = (PRO_WorkOrderMasterVO)pObjectDetail; //update Detail foreach (DataRow drow in pdstData.Tables[0].Rows) { //set WOMasterID for all added row if (drow.RowState == DataRowState.Added) { drow[PRO_WorkOrderDetailTable.WORKORDERMASTERID_FLD] = voWOMaster.WorkOrderMasterID; } } DataSet dstTemp = new DataSet(); dstTemp.Tables.Add(pdstData.Tables[0].Copy()); dstTemp.Tables[0].Clear(); foreach (DataRow drow in pdstData.Tables[0].Rows) { if (drow.RowState != DataRowState.Deleted) { dstTemp.Tables[0].ImportRow(drow); } } dsWorkOrderDetail.UpdateDataSet(pdstData); //create dataset for all WO which was added DataSet dsNewDataSetForBOM = GetWODetailByMaster(((PRO_WorkOrderMasterVO)pObjectDetail).WorkOrderMasterID); DataSet dsNewDataSetForNewWOLine = dsNewDataSetForBOM.Copy(); dsNewDataSetForNewWOLine.Tables[0].Rows.Clear(); for (int i = 0; i < dstTemp.Tables[0].Rows.Count; i++) { if (dstTemp.Tables[0].Rows[i][PRO_WorkOrderDetailTable.WORKORDERDETAILID_FLD].ToString() == string.Empty) { dstTemp.Tables[0].Rows[i][PRO_WorkOrderDetailTable.WORKORDERDETAILID_FLD] = dsNewDataSetForBOM.Tables[0].Rows[i][PRO_WorkOrderDetailTable.WORKORDERDETAILID_FLD]; dsNewDataSetForNewWOLine.Tables[0].ImportRow(dstTemp.Tables[0].Rows[i]); } } }