示例#1
0
        public ActionResult Index()
        {
            // Enable security to redirect to login page if user is not logged in or we are not running in the VS IDE
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Account"));
            }
            // Save the report title to the ViewBag
            ViewBag.ReportTitle = reporttitle;

            var companies = GetList((short)Helpers.Helpers.ListType.company);

            ViewBag.companies = new MultiSelectList(companies, "id", "description");

            var properties = GetList((short)Helpers.Helpers.ListType.property);

            ViewBag.properties = new MultiSelectList(properties, "id", "description");

            var units = GetList((short)Helpers.Helpers.ListType.unit);

            ViewBag.units = new MultiSelectList(units, "id", "description");

            var bankAccounts = GetList((short)Helpers.Helpers.ListType.bankaccount);

            ViewBag.bankAccounts = new MultiSelectList(bankAccounts, "id", "description");

            var statusList = GetList((short)Helpers.Helpers.ListType.allStatus);

            ViewBag.intervalList = new MultiSelectList(statusList, "id", "description");

            var drilldownlevel = GetDropdownDrillDownLevel();

            ViewBag.DrillDownLevel = new MultiSelectList(drilldownlevel, "id", "description");

            dropdown_list dl = new dropdown_list();
            var           accountingBasisList = new List <dropdown_list>(2);

            dl             = new dropdown_list();
            dl.id          = 1;
            dl.description = "Cash";
            accountingBasisList.Add(dl);
            dl.id          = 2;
            dl.description = "Accrual";
            accountingBasisList.Add(dl);
            ViewBag.accountingBasisList = new MultiSelectList(accountingBasisList, "id", "description");


            //setup default value of the start date and end date
            DateTime oneMonth = DateTime.Now.AddMonths(-1);

            ViewBag.startDate = new DateTime(oneMonth.Year, oneMonth.Month, 1).ToString("MM/dd/yyyy");
            ViewBag.endDate   = DateTime.Now.ToString("MM/dd/yyyy");

            return(View());
        }
示例#2
0
        // Get the procedures from the DB for the drop-down listbox
        public List <dropdown_list> GetDropdownWarehouse()
        {
            List <dropdown_list> result = new List <dropdown_list>();

            foreach (Helpers.Helpers.WarehouseType enumValue in Enum.GetValues(typeof(Helpers.Helpers.WarehouseType)))
            {
                dropdown_list row0 = new dropdown_list();
                row0.id          = (int)enumValue;
                row0.description = enumValue.ToString();
                result.Add(row0);
            }
            return(result);
        }
示例#3
0
        public List <dropdown_list> GetDropdownDrillDownLevel()
        {
            List <dropdown_list> result = new List <dropdown_list>();

            foreach (Helpers.Helpers.DrilldownLevel enumValue in Enum.GetValues(typeof(Helpers.Helpers.DrilldownLevel)))
            {
                dropdown_list row0 = new dropdown_list();
                row0.id          = (int)enumValue;
                row0.description = enumValue.ToString();
                result.Add(row0);
            }
            return(result);
        }
示例#4
0
        //HONG added this function for the comparision report page
        public List <dropdown_list> GetList(short type, string[] ids)
        {
            List <dropdown_list> result = new List <dropdown_list>();
            string SQLString            = null;
            string connectionString     = null;

            switch (type)
            {
            case (short)Helpers.Helpers.ListType.allSku:
                SQLString        = "SELECT DISTINCT ID, SKU FROM cSKU where sku in ('" + String.Join("','", ids) + "') ORDER BY SKU";
                connectionString = Helpers.Helpers.GetAppConnectionString();
                break;

            case (short)Helpers.Helpers.ListType.allStore:
                SQLString        = "SELECT ReportID, ReportName from cCentralReports where ReportID in (" + String.Join(",", ids) + ") ORDER BY ReportName";
                connectionString = Helpers.Helpers.GetAppConnectionString();
                break;

            case (short)Helpers.Helpers.ListType.allState:
                List <dropdown_list> list    = GetDropdownStates();
                List <dropdown_list> newList = new List <dropdown_list>();
                for (int i = 0; i < ids.Length; i++)
                {
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j].abbre.Equals(ids[i]))
                        {
                            newList.Add(list[j]);
                            break;
                        }
                    }
                }
                return(newList);
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(SQLString, connection); // Create the Command and Parameter objects
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read()) // Read each result row and extract the data
                {
                    dropdown_list row = new dropdown_list();
                    row.id          = long.Parse(reader[0].ToString());
                    row.description = reader[1].ToString();
                    result.Add(row);
                }
                reader.Close();
                connection.Close();
            }
            return(result);
        }
示例#5
0
        // Get the procedures from the DB for the drop-down listbox
        public List <dropdown_list> GetDropdownAccount()
        {
            List <dropdown_list> result = new List <dropdown_list>();
            string        SQLString     = "SELECT p.id, p.description, p.code FROM procedures as p ORDER BY p.description";
            SqlDataReader reader        = ExecuteSQLQuery(SQLString);

            while (reader.Read()) // Read each result row and extract the data
            {
                dropdown_list row = new dropdown_list();
                row.id          = long.Parse(reader[0].ToString());
                row.description = reader[1].ToString() + " [" + reader[2].ToString() + "]";
                result.Add(row);
            }
            reader.Close();
            return(result);
        }
示例#6
0
        // Get the procedures from the DB for the drop-down listbox
        public List <dropdown_list> GetDropdownSKU()
        {
            List <dropdown_list> result = new List <dropdown_list>();
            string        SQLString     = "SELECT sku FROM cSku where Active = 1 ORDER BY sku ";
            SqlDataReader reader        = ExecuteSQLQuery(SQLString);

            while (reader.Read()) // Read each result row and extract the data
            {
                dropdown_list row = new dropdown_list();
                string        sku = reader[0].ToString();
                row.abbre       = sku;
                row.description = sku;
                result.Add(row);
            }
            reader.Close();
            return(result);
        }
示例#7
0
        private List <dropdown_list> QueryList(string queryString)
        {
            List <dropdown_list> result = new List <dropdown_list>();

            using (SqlConnection connection = new SqlConnection(Helpers.Helpers.GetAppConnectionString()))
            {
                SqlCommand command = new SqlCommand(queryString, connection); // Create the Command and Parameter objects
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read()) // Read each result row and extract the data
                {
                    dropdown_list row = new dropdown_list();
                    row.id          = long.Parse(reader[0].ToString());
                    row.description = reader[1].ToString();
                    result.Add(row);
                }
                reader.Close();
                connection.Close();
            }
            return(result);
        }
示例#8
0
        private List <dropdown_list> QueryECommerceList(string queryString)
        {
            List <dropdown_list> result = new List <dropdown_list>();

            using (MySqlDataAdapter adapter = new MySqlDataAdapter(queryString, new MySqlConnection(Helpers.Helpers.GetERPConnectionString())))
            {
                DataSet ds = new DataSet();
                adapter.Fill(ds);
                DataTable tb = (DataTable)ds.Tables[0];
                if (tb != null && tb.Rows.Count > 0)
                {
                    for (int i = 0; i < tb.Rows.Count; i++)
                    {
                        dropdown_list row = new dropdown_list();
                        row.id          = long.Parse(tb.Rows[i][0].ToString());
                        row.description = tb.Rows[i][1].ToString();
                        result.Add(row);
                    }
                }
            }
            return(result);
        }