Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            saveButton.Click   += new EventHandler(saveButton_Click);
            cancelButton.Click += new EventHandler(cancelButton_Click);


            int stationId = GetValueFromQueryString("station_id");

            if (stationId == 0)
            {
                RedirectToSuperAdminHome();
            }

            DollarSaverDB.StationDataTable stationTable = stationAdapter.GetStation(stationId);

            if (stationTable.Count == 0)
            {
                RedirectToSuperAdminHome();
            }

            Station = stationTable[0];

            if (!Page.IsPostBack)
            {
                nameLabel.Text      = Station.Name;
                codeBox.Text        = Station.Code;
                isActiveBox.Checked = Station.IsActive;

                if (!Station.IsSubdomainNull())
                {
                    subdomainBox.Text = Station.Subdomain;
                }
            }
        }
Example #2
0
        void stationGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DollarSaverDB.StationRow station = (DollarSaverDB.StationRow)e.Row.DataItem;

                HyperLink stationLink = (HyperLink)e.Row.FindControl("stationLink");


                String stationUrl = "http://";

                String EnvDomain;
                if (IsDev)
                {
                    EnvDomain = "localhost" + (Request.Url.Port != 80 ? ":" + Request.Url.Port : String.Empty);
                }
                else
                {
                    EnvDomain = "dollarsavershow.com";
                }

                if (station != null && !station.IsSubdomainNull() && station.Subdomain != String.Empty)
                {
                    stationUrl += station.Subdomain + "." + EnvDomain + ResolveUrl("~/Default.aspx");
                }
                else
                {
                    stationUrl += EnvDomain + ResolveUrl("~/Default.aspx?station_id=" + station.StationId);
                }

                stationLink.NavigateUrl = stationUrl;

                OrderTableAdapter orderAdapter = new OrderTableAdapter();

                Label total1Label = (Label)e.Row.FindControl("total1Label");
                Label total2Label = (Label)e.Row.FindControl("total2Label");
                Label total3Label = (Label)e.Row.FindControl("total3Label");

                // total 1
                DateTime end1Date   = now;
                DateTime start1Date = new DateTime(end1Date.Year, end1Date.Month, end1Date.Day, 0, 0, 0, 0);

                decimal total1 = Convert.ToDecimal(orderAdapter.GetSumTotal(station.StationId, start1Date, end1Date));
                sumTotal1       += total1;
                total1Label.Text = total1.ToString("c");

                // total 2
                DateTime end2Date   = now;
                DateTime start2Date = new DateTime(end2Date.Year, end2Date.Month, 1, 0, 0, 0);

                decimal total2 = Convert.ToDecimal(orderAdapter.GetSumTotal(station.StationId, start2Date, end2Date));
                sumTotal2       += total2;
                total2Label.Text = total2.ToString("c");

                // total 3
                DateTime end3Date   = now;
                DateTime start3Date = new DateTime(end3Date.Year, 1, 1, 0, 0, 0);

                decimal total3 = Convert.ToDecimal(orderAdapter.GetSumTotal(station.StationId, start3Date, end3Date));
                sumTotal3       += total3;
                total3Label.Text = total3.ToString("c");
            }
            else if (e.Row.RowType == DataControlRowType.Footer)
            {
                Label sumTotal1Label = (Label)e.Row.FindControl("sumTotal1Label");
                Label sumTotal2Label = (Label)e.Row.FindControl("sumTotal2Label");
                Label sumTotal3Label = (Label)e.Row.FindControl("sumTotal3Label");

                sumTotal1Label.Text = sumTotal1.ToString("c");
                sumTotal2Label.Text = sumTotal2.ToString("c");
                sumTotal3Label.Text = sumTotal3.ToString("c");
            }
        }