Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void UpdateOver(DataTable pdtbData, DataTable pdtbOverData, ArrayList parrResultMasterID, StringBuilder psbResultMasterID, object pobjCycle)
        {
            PRO_DCPResultDetailDS dsDCPDetail = new PRO_DCPResultDetailDS();
            PRO_DCOptionMasterVO  voCycle     = (PRO_DCOptionMasterVO)pobjCycle;
            string strResultMasterIDs         = "0";

            #region check result master id in order to delete master data

            // get the list of master id which will not be deleted
            DataTable dtbNotDeleteID = dsDCPDetail.GetNotDeleteMasterID(psbResultMasterID.ToString(), voCycle.DCOptionMasterID);
            foreach (DataRow drowData in dtbNotDeleteID.Rows)
            {
                parrResultMasterID.Remove(drowData[PRO_DCPResultMasterTable.DCPRESULTMASTERID_FLD].ToString());
            }

            foreach (string strMasterID in parrResultMasterID)
            {
                if (pdtbData.Select(PRO_DCPResultDetailTable.DCPRESULTMASTERID_FLD + "=" + strMasterID).Length == 0 &&
                    pdtbOverData.Select(PRO_DCPResultDetailTable.DCPRESULTMASTERID_FLD + "=" + strMasterID).Length == 0)
                {
                    strResultMasterIDs += "," + strMasterID;
                }
            }

            #endregion

            StringBuilder sbOverID = new StringBuilder();
            foreach (DataRow drowOver in pdtbOverData.Rows)
            {
                sbOverID.Append(drowOver[PRO_DCPResultDetailTable.DCPRESULTDETAILID_FLD].ToString()).Append(",");
            }
            sbOverID.Append("0");             // avoid exception
            // delete over data first
            dsDCPDetail.DeleteOverData(psbResultMasterID.ToString(), strResultMasterIDs, sbOverID.ToString());
            // update quantity of over item
            dsDCPDetail.UpdateOver(pdtbOverData);
            // update new data to dcp table
            DataSet dstData = new DataSet();
            dstData.Tables.Add(pdtbData);
            dsDCPDetail.UpdateDataSet(dstData);
        }