Пример #1
0
        public DataSet GetProductSequenceByDefault(int pintProductionLineID)
        {
            PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();
            DataSet dstData = dsMaster.GetProductSequenceByDefault(pintProductionLineID);
            DataSet dstNew  = dstData.Clone();

            dstNew.Tables[0].Columns.Add(new DataColumn("ProductProductionOrderID", typeof(int)));
            dstNew.Tables[0].Columns["ProductProductionOrderID"].AutoIncrement     = true;
            dstNew.Tables[0].Columns["ProductProductionOrderID"].AutoIncrementSeed = 1;
            dstNew.Tables[0].Columns["ProductProductionOrderID"].AutoIncrementStep = 1;
            int intSequence = 1;

            foreach (DataRow drowData in dstData.Tables[0].Rows)
            {
                DataRow drowNew = dstNew.Tables[0].NewRow();
                foreach (DataColumn dcolData in dstData.Tables[0].Columns)
                {
                    drowNew[dcolData.ColumnName] = drowData[dcolData.ColumnName];
                }
                drowNew["Seq"] = intSequence;
                dstNew.Tables[0].Rows.Add(drowNew);
                intSequence++;
            }
            return(dstData);
        }
Пример #2
0
        /// <summary>
        /// Insert a new record into database
        /// </summary>

        public int AddDCOption(object pobjMaster, DataSet pdtsDetail)
        {
            try
            {
                PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();
                int intMasterId = dsMaster.AddAndReturnID(pobjMaster);

                //reset master id of voObject
                ((PRO_DCOptionMasterVO)pobjMaster).DCOptionMasterID = intMasterId;

//				if(pdtsDetail != null)
//				{
//					foreach(DataRow row in pdtsDetail.Tables[0].Rows)
//					{
//						if(row.RowState == DataRowState.Deleted) continue;
//						row[PRO_DCOptionMasterTable.DCOPTIONMASTERID_FLD] = intMasterId;
//					}
//
//					PRO_DCOptionDetailDS dsDetail = new PRO_DCOptionDetailDS();
//
//					//Check dataset to call UpdateDataSet method
//					dsDetail.UpdateDataSet(pdtsDetail);
//				}

                return(intMasterId);
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Пример #3
0
        /// <summary>
        /// Update outside processing
        /// </summary>
        /// <param name="pobjMaster"></param>
        /// <param name="pdtsDetail"></param>

        public void UpdateDCOption(object pobjMaster, DataSet pdtsDetail)
        {
//			try
//			{
            PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();

            dsMaster.Update(pobjMaster);

//				//check and update master id for new added rows
//				if(pdtsDetail != null)
//				{
//					foreach (DataRow row in pdtsDetail.Tables[0].Rows)
//					{
//						if(row.RowState == DataRowState.Deleted) continue;
//						row[PRO_DCOptionDetailTable.DCOPTIONMASTERID_FLD] = ((PRO_DCOptionMasterVO)pobjMaster).DCOptionMasterID;
//					}
//				}
//				PRO_DCOptionDetailDS dsDetail = new PRO_DCOptionDetailDS();
//				//Check dataset to call UpdateDataSet method
//				dsDetail.UpdateDataSet(pdtsDetail);
//			}
//			catch (PCSDBException ex)
//			{
//				throw ex;
//			}
//			catch (Exception ex)
//			{
//				throw new Exception(ex.Message, ex);
//			}
        }
Пример #4
0
        /// <summary>
        /// Delete record by condition
        /// </summary>

        public void DeleteDCOption(int pintMasterID)
        {
            try
            {
                //First, delete data on detail table
                PRO_DCOptionDetailDS dsDetail = new PRO_DCOptionDetailDS();
                PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();

                DataSet dtsDetail = dsDetail.GetDetailByMaster(pintMasterID);
                foreach (DataRow drow in dtsDetail.Tables[0].Rows)
                {
                    drow.Delete();
                }
                dsDetail.UpdateDataSet(dtsDetail);

                //Second, select all DCPResult
                dsMaster.DeleteRelatedInforOfDCOption(pintMasterID);

                //Then delete data on master table
                dsMaster.Delete(pintMasterID);
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Пример #5
0
        /// <summary>
        /// CheckUniqueVersion
        /// </summary>
        /// <param name="pdtmPlanningPeriod"></param>
        /// <param name="pintVersion"></param>
        /// <returns></returns>
        /// <author>Trada</author>
        /// <date>Friday, Mar 17 2006</date>

        public bool CheckUniqueVersion(DateTime pdtmPlanningPeriod, int pintVersion)
        {
            PRO_DCOptionMasterDS dsPRO_DCOptionMaster = new PRO_DCOptionMasterDS();

            if (dsPRO_DCOptionMaster.CheckUniqueVersion(pdtmPlanningPeriod, pintVersion) != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public object GetCyclerMasterObject(int pintMasterID)
        {
            PRO_DCOptionMasterDS dsOption = new PRO_DCOptionMasterDS();
            DataRow drowData = dsOption.GetDCOptionMaster(pintMasterID);
            PRO_DCOptionMasterVO voOption = new PRO_DCOptionMasterVO();

            try
            {
                voOption.DCOptionMasterID = Convert.ToInt32(drowData[PRO_DCOptionMasterTable.DCOPTIONMASTERID_FLD]);
            }
            catch {}
            try
            {
                voOption.AsOfDate = Convert.ToDateTime(drowData[PRO_DCOptionMasterTable.ASOFDATE_FLD]);
            }
            catch {}
            try
            {
                voOption.UseCacheAsBegin = Convert.ToBoolean(drowData[PRO_DCOptionMasterTable.USECACHE_ASBEGIN_FLD]);
            }
            catch {}
            voOption.CCNID = Convert.ToInt32(drowData[PRO_DCOptionMasterTable.CCNID_FLD]);
            try
            {
                voOption.LastUpdate = Convert.ToDateTime(drowData[PRO_DCOptionMasterTable.LASTUPDATE_FLD]);
            }
            catch {}
            try
            {
                voOption.PlanHorizon = Convert.ToInt32(drowData[PRO_DCOptionMasterTable.PLANHORIZON_FLD]);
            }
            catch {}
            try
            {
                voOption.PlanningPeriod = Convert.ToDateTime(drowData[PRO_DCOptionMasterTable.PLANNINGPERIOD_FLD]);
            }
            catch {}
            try
            {
                voOption.Version = Convert.ToInt32(drowData[PRO_DCOptionMasterTable.VERSION_FLD]);
            }
            catch {}
            return(voOption);
        }
Пример #7
0
        public void UpdateProductSequence(DataSet pdstData)
        {
            PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();

            dsMaster.UpdateProductSequence(pdstData);
        }
Пример #8
0
        public DataSet GetProductSequence(int pintProductionLineID)
        {
            PRO_DCOptionMasterDS dsMaster = new PRO_DCOptionMasterDS();

            return(dsMaster.GetProductSequence(pintProductionLineID));
        }
Пример #9
0
        /// <summary>
        /// Get begin data of cycle
        /// </summary>
        /// <param name="pintCycleId"></param>
        /// <returns></returns>
        public DataTable GetBeginData(int pintCycleId)
        {
            PRO_DCOptionMasterDS dsDCOptionMaster = new PRO_DCOptionMasterDS();

            return(dsDCOptionMaster.GetBeginData(pintCycleId));
        }