Пример #1
0
        public string GetConnectionString_Client()
        {
            try
            {
                CurrentInfo objCurInfo       = new CurrentInfo();
                string      connectionString = string.Empty;

                connectionString = objCurInfo.GetConnectionString();
                return(connectionString);
            }
            catch (Exception ex)
            {
                //System.Web.HttpContext.Current.Response.Write("Exception: " + ex.Message);
                _strError = "DCRMobile " + " Public_fn:GetConnectionString_Client " + " Stack Trace : " + ex.StackTrace + " Error msg " + ex.Message;
                throw ex;
            }
        }
        public DataTable GetTopTenProduct()
        {
            DataTable dt = new DataTable();

            try
            {
                CurrentInfo    _objCurrentInfo = new CurrentInfo();
                SqlDataAdapter da  = new SqlDataAdapter();
                SqlConnection  con = new SqlConnection();
                con.ConnectionString = _objCurrentInfo.GetConnectionString();
                con.Open();
                SqlCommand Command = new SqlCommand();
                Command.Parameters.Clear();
                Command.CommandType = CommandType.StoredProcedure;
                if (_adminDashboard.IsPS)
                {
                    Command.CommandText = "SP_HD_GetlstTopTenPrimarySalesProduct";
                }
                else
                {
                    Command.CommandText = "SP_HD_GetlstTopTenSecondarySalesProduct";
                }
                Command.Parameters.AddWithValue("@User_Code", _adminDashboard.UserCode);
                Command.Parameters.AddWithValue("@Company_Code", _adminDashboard.CompanyCode);
                Command.Parameters.AddWithValue("@Division_Code", _adminDashboard.DivisionCode);
                Command.Connection = con;

                da = new SqlDataAdapter(Command);

                da.Fill(dt);
                con.Close();
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicObj = new Dictionary <string, string>();
                dicObj.Add("userCode", _adminDashboard.UserCode);
                Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj);
                return(null);
            }
            return(dt);
        }