Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override string DoIt()
        {
            mf = new X_C_MasterForecast(GetCtx(), GetRecord_ID(), null);
            if (mf.IsProcessed())
            {
                C_Period_ID = mf.GetC_Period_ID();
                sql         = "select * from c_masterforecast where c_period_id = " + C_Period_ID + " and ad_client_ID = " + GetCtx().GetAD_Client_ID();
                IDataReader idr = null;
                try
                {
                    //  bool opp = false;
                    idr = DB.ExecuteReader(sql, null, null);
                    while (idr.Read())
                    {
                        sql = "update c_masterforecast set currentversion = 'N' where ad_client_id = " + GetCtx().GetAD_Client_ID() + " and c_masterforecast_id = " + Util.GetValueOfInt(idr["C_MasterForecast_ID"]);
                        int res = Util.GetValueOfInt(DB.ExecuteQuery(sql, null, null));
                        //string check = Util.GetValueOfString(idr["IsIncludeOpp"]);
                        //if (check == "Y")
                        //{
                        //    opp = true;
                        //}
                    }
                    idr.Close();
                    if (_includeOpp)
                    {
                        CreateMasterForecast(_includeOpp);
                        GenerateLines();
                    }
                    else
                    {
                        CreateMasterForecast(_includeOpp);
                        GenerateLines();
                    }
                    msg = Msg.GetMsg(GetCtx(), "NewVersionIsCreatedSuccessfully");
                }
                catch
                {
                    if (idr != null)
                    {
                        idr.Close();
                    }
                }
                finally
                {
                    if (idr != null)
                    {
                        idr.Close();
                    }
                }
            }
            else
            {
                msg = Msg.GetMsg("ProcessRecordFirst", "ProcessRecordFirst");
            }

            return(msg);
        }