예제 #1
0
        private void LoadSalePrognosisList()
        {
            try
            {
                List <CSalePrognosis> objSalePrognosisList = CSalePrognosis.GetSalePrognosisList(m_objProfile, null);
                cboxSalePrognosis.Properties.Items.Clear();
                if (objSalePrognosisList != null)
                {
                    foreach (CSalePrognosis objSalePrognosis in objSalePrognosisList)
                    {
                        cboxSalePrognosis.Properties.Items.Add(objSalePrognosis);
                    }

                    objSalePrognosisList = null;
                }
            }
            catch (System.Exception f)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(
                    "Не удалось загрузить список прогнозов продаж.\n\nТекст ошибки: " + f.Message, "Ошибка",
                    System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
            return;
        }
예제 #2
0
 public CCalcOrder()
 {
     m_uuidID = System.Guid.Empty;
     m_strNum = "";
     m_dtCalcOrderDate = System.DateTime.Today;
     m_objCalcOrderItemList = null;
     m_objProductTradeMark = null;
     m_objSalePrognosis = null;
 }
예제 #3
0
 public CCalcOrder(System.Guid uuidID, System.String strNum, System.DateTime dtCalcOrderDate,
     CProductTradeMark objProductTradeMark)
 {
     m_uuidID = uuidID;
     m_strNum = strNum;
     m_dtCalcOrderDate = dtCalcOrderDate;
     m_objCalcOrderItemList = null;
     m_objProductTradeMark = objProductTradeMark;
     m_objSalePrognosis = null;
 }
예제 #4
0
        /// <summary>
        /// Запускает хранимую процедуру по расчету заказа для указанной товарной марки
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <param name="cmdSQL">SQL-команда</param>
        /// <param name="objProductOwner">товарная марка</param>
        /// <param name="strErr">сообщение об ошибке</param>
        /// <returns>true - успешное завершение операции; false - ошибка</returns>
        public static System.Boolean CalcOrder(UniXP.Common.CProfile objProfile,
            System.Data.SqlClient.SqlCommand cmdSQL, ERP_Mercury.Common.CProductOwner objProductOwner, CSalePrognosis objSalePrognosis, ref System.String strErr)
        {
            System.Boolean bRet = false;
            System.Int32 iCmdTimeOut = 600;
            if (objProductOwner == null)
            {
                strErr = "Не указана товарная марка.";
                return bRet;
            }
            System.Data.SqlClient.SqlConnection DBConnection = null;
            System.Data.SqlClient.SqlCommand cmd = null;
            try
            {
                if (cmdSQL == null)
                {
                    DBConnection = objProfile.GetDBSource();
                    if (DBConnection == null)
                    {
                        strErr = "Не удалось получить соединение с базой данных.";
                        return bRet;
                    }
                    cmd = new System.Data.SqlClient.SqlCommand();
                    cmd.Connection = DBConnection;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                }
                else
                {
                    cmd = cmdSQL;
                    cmd.Parameters.Clear();
                }
                cmd.CommandTimeout = iCmdTimeOut;
                cmd.CommandText = System.String.Format("[{0}].[dbo].[usp_CalcOrder]", objProfile.GetOptionsDllDBName());
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Owner_Guid", System.Data.SqlDbType.UniqueIdentifier));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ERROR_NUM", System.Data.SqlDbType.Int, 8, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ERROR_MES", System.Data.SqlDbType.NVarChar, 4000));
                if (objSalePrognosis != null)
                {
                    cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SALEPROGNOSIS_ID", System.Data.SqlDbType.Int));
                    cmd.Parameters["@SALEPROGNOSIS_ID"].Value = objSalePrognosis.ID;
                }
                cmd.Parameters["@Owner_Guid"].Value = objProductOwner.uuidID;
                cmd.Parameters["@ERROR_MES"].Direction = System.Data.ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                System.Int32 iRes = (System.Int32)cmd.Parameters["@ERROR_NUM"].Value;
                strErr = (System.String)cmd.Parameters["@ERROR_MES"].Value;
                bRet = (iRes == 0);

                if (cmdSQL == null)
                {
                    cmd.Dispose();
                    DBConnection.Close();
                }
            }
            catch (System.Exception f)
            {
                strErr = "Не удалось сформировать расчет.\n\nТекст ошибки : " + f.Message;
            }
            return bRet;
        }