private async Task GetFieldsAsync()
        {
            ReportFields.Clear();
            SelectedFields.Clear();
            if (SelectedLayer == null)
            {
                return;
            }

            await QueuedTask.Run((Action)(() =>
            {
                foreach (FieldDescription fd in SelectedLayer?.GetFieldDescriptions())
                {
                    string shapeField = SelectedLayer.GetFeatureClass().GetDefinition().GetShapeField();
                    if (fd.Name == shapeField)
                    {
                        continue;                        //filter out the shape field.
                    }
                    var defFieldAction = (Action)(() =>
                    {
                        var field = new ReportField {
                            IsSelected = false, DisplayName = fd.Alias, Name = fd.Name
                        };
                        ReportFields.Add(field);
                        field.FieldSelectionChanged += this.Field_FieldSelectionChanged;
                        //field.IsSelected = true;
                    });
                    ActionOnGuiThread(defFieldAction);
                }
            }));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a column model for a report
        /// </summary>
        /// <param name="fields">The visible columns</param>
        public static ColumnModel CreateColumnModel(ReportFields fields)
        {
            ImageColumn    reportTypeImageColumn   = CreateImageColumn(string.Empty, 20, "");
            ImageColumn    reportStatusImageColumn = CreateImageColumn(string.Empty, 20, "");
            TextColumn     reportVillageColumn     = CreateTextColumn("Village", 50);
            TextColumn     reportPlayerColumn      = CreateTextColumn("Player", 100);
            DateTimeColumn reportDateColumn        = CreateDateTimeColumn("Date", 70);
            ImageColumn    reportFlagImageColumn   = CreateImageColumn(string.Empty, 20, "");

            reportTypeImageColumn.Visible   = (fields & ReportFields.Type) != 0;
            reportStatusImageColumn.Visible = (fields & ReportFields.Status) != 0;
            reportVillageColumn.Visible     = (fields & ReportFields.Village) != 0;
            reportPlayerColumn.Visible      = (fields & ReportFields.Player) != 0;
            reportDateColumn.Visible        = (fields & ReportFields.Date) != 0;
            reportFlagImageColumn.Visible   = (fields & ReportFields.Flag) != 0;

            return(new ColumnModel(new Column[] {
                reportTypeImageColumn,
                reportStatusImageColumn,
                reportVillageColumn,
                reportPlayerColumn,
                reportDateColumn,
                reportFlagImageColumn
            }));
        }
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle      = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblAvgOrder   = e.Item.FindControl("lblAvgOrder") as Label;
                Label lblTotalRev   = e.Item.FindControl("lblTotalRev") as Label;

                ReportFields item = e.Item.DataItem as ReportFields;
                lblTitle.Text      = item.ShortName;
                lblTotalOrder.Text = item.TotalOrders.ToString();
                lblAvgOrder.Text   = String.Format("${0:0.##}", item.AverageOrder);
                lblTotalRev.Text   = String.Format("${0:0.##}", item.TotalRevenue);
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label        lblSumTotalOrder = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label        lblSumAvgOrder   = e.Item.FindControl("lblSumAvgOrder") as Label;
                Label        lblSumTotalRev   = e.Item.FindControl("lblSumTotalRev") as Label;
                ReportFields foundItem        = dtCollectionList[0].Find(y => y.CatgoryId == CategoryId);
                if (foundItem != null)
                {
                    lblSumTotalOrder.Text = foundItem.TotalOrders.ToString();
                    lblSumAvgOrder.Text   = String.Format("${0:0.##}", foundItem.AverageOrder);
                    lblSumTotalRev.Text   = String.Format("${0:0.##}", foundItem.TotalRevenue);
                }
            }
        }
        /// <summary>
        /// Creates the report
        /// </summary>
        /// <returns></returns>
        private async Task CreateReport()
        {
            ReportDataSource reportDataSource = null;
            Report           report           = null;

            _isCreateReport = false;
            var reportTemplate = await GetReportTemplate(SelectedReportTemplate);

            await QueuedTask.Run(() =>
            {
                //Adding all fields to the report
                List <CIMReportField> reportFields = new List <CIMReportField>();
                var selectedReportFields           = ReportFields.Where((fld) => fld.IsSelected);
                foreach (var rfld in selectedReportFields)
                {
                    var cimReportField = new CIMReportField()
                    {
                        Name = rfld.Name
                    };
                    reportFields.Add(cimReportField);
                    //Defining grouping field
                    if (rfld.Name == SelectedGroupField?.Name)
                    {
                        cimReportField.Group = true;
                    }
                    //To DO: Do sort info here.
                }

                //Report field statistics
                List <ReportFieldStatistic> reportFieldStats = new List <ReportFieldStatistic>();

                if (SelectedStatsField != null)
                {
                    ReportFieldStatistic reportStat = new ReportFieldStatistic();
                    reportStat.Field     = SelectedStatsField.Name;
                    reportStat.Statistic = (FieldStatisticsFlag)Enum.Parse(typeof(FieldStatisticsFlag), SelectedStatsOption);
                    reportFieldStats.Add(reportStat);
                }

                //Set Datasource
                reportDataSource = new ReportDataSource(SelectedLayer, "", IsUseSelection, reportFields);

                try
                {
                    report          = ReportFactory.Instance.CreateReport(ReportName, reportDataSource, null, reportFieldStats, reportTemplate, SelectedReportStyle);
                    _isCreateReport = true;
                }
                catch (System.InvalidOperationException e)
                {
                    if (e.Message.Contains("Group field defined for a non-grouping template"))
                    {
                        MessageBox.Show("A group field cannot be defined for a non-grouping template.");
                    }
                    else if (e.Message.Contains("Grouping template specified but no group field defined"))
                    {
                        MessageBox.Show("A group field should be defined for a grouping template.");
                    }
                }
            });
        }
Ejemplo n.º 5
0
        private bool IsDuplicateColumnName()
        {
            var query = ReportFields.GroupBy(x => x.FieldName.ToString())
                        .Where(g => g.Count() > 1)
                        .Select(y => y.Key)
                        .ToList();

            return(query.Count > 0);
        }
Ejemplo n.º 6
0
 private void ReportFields_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e)
 {
     if (e.PropertyName != "IsChecked")
     {
         CheckValidation();
         isdirty = true;
         ReportFields[e.CollectionIndex].IsSelected = true;
     }
     IsSelected = ReportFields.Where(x => x.IsChecked).Count() > 0;
 }
        public static string GetReportField(RestCommand command, int reportFieldID)
        {
            ReportField reportField = ReportFields.GetReportField(command.LoginUser, reportFieldID);

            if (reportField.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(reportField.GetXml("ReportField", true));
        }
Ejemplo n.º 8
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle         = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder    = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblTotalRev      = e.Item.FindControl("lblTotalRev") as Label;
                Label lbHitLinkVisitor = e.Item.FindControl("lbHitLinkVisitor") as Label;
                Label lblConversion    = e.Item.FindControl("lblConversion") as Label;

                ReportFields item = e.Item.DataItem as ReportFields;

                lblTitle.Text      = item.Title;
                lblTotalOrder.Text = item.TotalOrders.ToString();
                if (item.UniqueVisitors > 0)
                {
                    lbHitLinkVisitor.Text = string.Format("{0:##,##}", item.UniqueVisitors);
                }
                else
                {
                    lbHitLinkVisitor.Text = "0";
                }

                lblConversion.Text = String.Format("{0}", item.Conversion);

                lblTotalRev.Text = String.Format("{0:0.##}", Math.Round(item.TotalRevenue, 2).ToString("n2"));

                CategoryUniqueVistiors += item.UniqueVisitors;
                totalOrders            += item.TotalOrders;
                totalRevenue           += item.TotalRevenue;
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblSumTotalOrder      = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label lblSumTotalRev        = e.Item.FindControl("lblSumTotalRev") as Label;
                Label lblSumHitLinkVisitor  = e.Item.FindControl("lblSumHitLinkVisitor") as Label;
                Label lblSumTotalConversion = e.Item.FindControl("lblSumTotalConversion") as Label;


                if (CategoryUniqueVistiors > 0)
                {
                    lblSumTotalConversion.Text = String.Format("{0}", Math.Round((totalOrders * 100) / CategoryUniqueVistiors, 2));
                    lblSumHitLinkVisitor.Text  = string.Format("{0:##,##}", CategoryUniqueVistiors);
                }
                else
                {
                    lblSumTotalConversion.Text = "0";
                    lblSumHitLinkVisitor.Text  = "0";
                }

                lblSumTotalOrder.Text = totalOrders.ToString();
                lblSumTotalRev.Text   = String.Format("{0:C}", totalRevenue);
            }
        }
        public static string GetReportFields(RestCommand command)
        {
            ReportFields reportFields = new ReportFields(command.LoginUser);

            reportFields.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(reportFields.GetXml("ReportFields", "ReportField", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
Ejemplo n.º 10
0
        protected void dlUrlList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle           = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder      = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblAvgOrder        = e.Item.FindControl("lblAvgOrder") as Label;
                Label lblTotalRev        = e.Item.FindControl("lblTotalRev") as Label;
                Label lbHitLinkVisitor   = e.Item.FindControl("lbHitLinkVisitor") as Label;
                Label lblConversion      = e.Item.FindControl("lblConversion") as Label;
                Label lblRevenuePerVisit = e.Item.FindControl("lblRevenuePerVisit") as Label;

                ReportFields item = e.Item.DataItem as ReportFields;

                lblTitle.Text = item.ShortName;
                try
                {
                    lblTitle.Text = "&nbsp;&nbsp;&nbsp;" + item.ShortName.Split('-')[0];
                }
                catch
                {
                }
                if (item.TotalOrders > 0)
                {
                    lblTotalOrder.Text = string.Format("{0:##,##}", item.TotalOrders);
                }
                else
                {
                    lblTotalOrder.Text = "0";
                }

                if (item.UniqueVisitors > 0)
                {
                    lbHitLinkVisitor.Text = string.Format("{0:##,##}", item.UniqueVisitors);
                }
                else
                {
                    lbHitLinkVisitor.Text = "0";
                }


                lblConversion.Text      = String.Format("{0}%", item.Conversion);
                lblRevenuePerVisit.Text = String.Format("{0:C}", item.RevenuePerVisit);
                lblAvgOrder.Text        = String.Format("{0:C}", item.AverageOrder);
                lblTotalRev.Text        = String.Format("{0:C}", item.TotalRevenue);
            }
        }
Ejemplo n.º 11
0
        protected void dlTransactionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            ReportFields item = e.Item.DataItem as ReportFields;

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblOrderNo         = e.Item.FindControl("lblOrderNo") as Label;
                Label lblOrderStatus     = e.Item.FindControl("lblOrderStatus") as Label;
                Label lblAmount          = e.Item.FindControl("lblAmount") as Label;
                Label lblAuthCode        = e.Item.FindControl("lblAuthCode") as Label;
                Label lblTransaction     = e.Item.FindControl("lblTransaction") as Label;
                Label lblTransactionDate = e.Item.FindControl("lblTransactionDate") as Label;
                Label lblAffiliate       = e.Item.FindControl("lblAffiliate") as Label;



                lblOrderNo.Text     = item.orderId.ToString();
                lblOrderStatus.Text = item.OrderStatus;
                lblAmount.Text      = String.Format("{0:C}", item.TotalRevenue);
                if (item.AuthorizationCode != null)
                {
                    lblAuthCode.Text = item.AuthorizationCode;
                }
                else
                {
                    lblAuthCode.Text = String.Empty;
                }

                if (item.TransactionCode != null)
                {
                    lblTransaction.Text = item.TransactionCode;
                }
                else
                {
                    lblTransaction.Text = String.Empty;
                }

                if (item.TransactionDate.Length > 0)
                {
                    lblTransactionDate.Text = Convert.ToDateTime(item.TransactionDate).AddHours(3).ToString();
                }
                else
                {
                    lblTransactionDate.Text = String.Empty;
                }
            }
        }
Ejemplo n.º 12
0
        private void ExecuteAddNew(object parameter)
        {
            ReportFields.Add(new ReportFields()
            {
                ID         = 0,
                Name       = SelectedReportName.Name,
                Caption    = string.Empty,
                Alignment  = string.Empty,
                DataTypeID = 0,
                FieldName  = string.Empty,
                System     = false,
                FieldType  = -999,
                IsChecked  = false,
                IsEnabled  = true
            });

            ScrollToIndex = ReportFields.Count() - 1;
            CheckValidation();
        }
Ejemplo n.º 13
0
        private void ExecuteDelete(object parameter)
        {
            IMessageBoxService msg        = new MessageBoxService();
            string             title      = "Deleting Report Field";
            string             confirmtxt = "Do you want to delete the selected item";

            if (ReportFields.Where(x => x.IsChecked).Count() > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }

            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (ReportFields si in ReportFields)
                {
                    if (si.IsSelected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteReportField(si.ID);
                        }
                        deleteditems.Add(si);
                        si.IsSelected = false;
                    }
                }

                foreach (ReportFields pm in deleteditems)
                {
                    ReportFields.Remove(pm);
                }
                deleteditems.Clear();
                CheckValidation();
            }
            msg = null;
        }
Ejemplo n.º 14
0
        private bool IsAlignmentMissing()
        {
            int nummissing = ReportFields.Where(x => string.IsNullOrEmpty(x.Alignment)).Count();

            return(nummissing > 0);
        }
Ejemplo n.º 15
0
        protected void BindData(DateTime?startDate, DateTime?endDate)
        {
            DateTime?timezoneStartDate = new DateTime();
            DateTime?timezoneEndDate   = new DateTime();

            if (OrderHelper.IsReportEST())
            {
                timezoneStartDate = DateTimeUtil.GetEastCoastStartDate(rangeDateControlCriteria.StartDateValueLocal);
                timezoneEndDate   = DateTimeUtil.GetEastCoastDate(rangeDateControlCriteria.EndDateValueLocal);
            }
            else//PST
            {
                timezoneStartDate = rangeDateControlCriteria.StartDateValueLocal;
                timezoneEndDate   = DateTimeUtil.GetEndDate(rangeDateControlCriteria.EndDateValueLocal);
                //liSubHeader.Text = DateTime.Now.DayOfWeek + " " + DateTime.Now.ToShortTimeString() + " (PST)";
            }
            //Passsing custom field value as 1000 which is combination of mid and sid. Special case for dermwand.com only
            List <ReportFields> ItemList = new OrderManager().GetOrderCustomFieldReport(timezoneStartDate, timezoneEndDate, 1, false);

            try
            {
                Data rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.eCommerceActivitySummary, TimeFrameEnum.Daily, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate), 100000000, 0, 0);
                for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++)
                {
                    HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[3].Value);
                }
            }
            catch (Exception ex)
            { }

            List <string> keysAdded = new List <string>();

            //Update Version List information
            foreach (ReportFields item in ItemList)
            {
                if (HitLinkVisitor.ContainsKey(item.Title))
                {
                    keysAdded.Add(item.Title);

                    decimal visitor = Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                    visitor             = Math.Abs(visitor);
                    item.UniqueVisitors = visitor;
                    if (visitor > 0)
                    {
                        item.Conversion      = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1);
                        item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor;
                    }
                    else
                    {
                        item.UniqueVisitors  = 0;
                        item.Conversion      = 0;
                        item.RevenuePerVisit = 0;
                    }
                }
                else
                {
                    item.UniqueVisitors  = 0;
                    item.Conversion      = 0;
                    item.RevenuePerVisit = 0;
                }

                if (string.IsNullOrEmpty(item.Title))
                {
                    item.Title = "(none)";
                }
            }

            // add keys not already list (visits but no orders)
            foreach (string key in HitLinkVisitor.Keys)
            {
                if (!keysAdded.Contains(key))
                {
                    ReportFields item = new ReportFields();

                    item.Title = key;
                    decimal visitor = Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                    visitor              = Math.Abs(visitor);
                    item.UniqueVisitors  = visitor;
                    item.Conversion      = 0;
                    item.RevenuePerVisit = 0;

                    ItemList.Add(item);
                }
            }


            dlVersionList.DataSource = ItemList;
            dlVersionList.DataBind();

            //FCLiteral.Text = CreateCharts(dtCollectionList[1dtCollectionList
        }
Ejemplo n.º 16
0
        public Dictionary <int, List <ReportFields> > GetVersionSummary(DateTime?startDate, DateTime?endDate, bool includeArchiveData)
        {
            Dictionary <int, List <ReportFields> > item = new Dictionary <int, List <ReportFields> >();

            dtCollectionList = new OrderManager().GetVersionSummary(startDate, endDate, false);

            using (SqlDataReader reader = GetVersionSummaryData(startDate, endDate, includeArchiveData))
            {
                List <ReportFields> CategorySummary = new List <ReportFields>();
                while (reader.Read())
                {
                    ReportFields rowitem = new ReportFields();
                    rowitem.CatgoryId    = Int32.Parse(reader["CategoryId"].ToString());
                    rowitem.TotalOrders  = Int32.Parse(reader["TotalOrders"].ToString());
                    rowitem.TotalRevenue = Convert.ToDecimal(reader["TotalRevenue"]);
                    rowitem.AverageOrder = Convert.ToDecimal(reader["AverageOrder"]);
                    CategorySummary.Add(rowitem);
                }

                item.Add(0, CategorySummary);

                reader.NextResult();

                List <ReportFields> VersionSummary = new List <ReportFields>();
                while (reader.Read())
                {
                    ReportFields rowitem = new ReportFields();
                    rowitem.VersionId    = Int32.Parse(reader["VersionId"].ToString());
                    rowitem.CatgoryId    = Int32.Parse(reader["CategoryId"].ToString());
                    rowitem.Title        = reader["Title"].ToString().ToLower();
                    rowitem.ShortName    = reader["ShortName"].ToString();
                    rowitem.TotalOrders  = Int32.Parse(reader["TotalOrders"].ToString());
                    rowitem.TotalRevenue = Convert.ToDecimal(reader["TotalRevenue"]);
                    rowitem.AverageOrder = Convert.ToDecimal(reader["AverageOrder"]);
                    VersionSummary.Add(rowitem);
                }

                item.Add(1, VersionSummary);

                reader.NextResult();

                //while (reader.Read())
                //{
                //    ReportFields rowitem = new ReportFields();
                //    rowitem.VersionId = Int32.Parse(reader["VersionId"].ToString());
                //    rowitem.Title = reader["URL"].ToString().ToLower();
                //    rowitem.ShortName = reader["URL"].ToString();
                //    rowitem.TotalOrders = Int32.Parse(reader["TotalOrders"].ToString());
                //    rowitem.TotalRevenue = Convert.ToDecimal(reader["TotalRevenue"]);
                //    rowitem.AverageOrder = Convert.ToDecimal(reader["AverageOrder"]);
                //    UrlSummary.Add(rowitem);
                //}
                //reader.NextResult();
            }
            using (SqlDataReader reader = GetURLSummaryData(startDate, endDate, includeArchiveData))
            {
                List <ReportFields> UrlSummary = new List <ReportFields>();
                while (reader.Read())
                {
                    ReportFields rowitem = new ReportFields();
                    rowitem.VersionId     = Int32.Parse(reader["VersionId"].ToString());
                    rowitem.Title         = reader["URL"].ToString().ToLower();
                    rowitem.CategoryTitle = reader["Title"].ToString().ToLower();
                    rowitem.ShortName     = reader["URL"].ToString();
                    rowitem.TotalOrders   = Int32.Parse(reader["TotalOrders"].ToString());
                    rowitem.TotalRevenue  = Convert.ToDecimal(reader["TotalRevenue"]);
                    rowitem.AverageOrder  = Convert.ToDecimal(reader["AverageOrder"]);
                    UrlSummary.Add(rowitem);
                }

                item.Add(2, UrlSummary);
            }
            return(item);
        }
Ejemplo n.º 17
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.VersionCategory versionItem = e.Item.DataItem as CSBusiness.VersionCategory;
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle           = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder      = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblAvgOrder        = e.Item.FindControl("lblAvgOrder") as Label;
                Label lblTotalRev        = e.Item.FindControl("lblTotalRev") as Label;
                Label lbHitLinkVisitor   = e.Item.FindControl("lbHitLinkVisitor") as Label;
                Label lblConversion      = e.Item.FindControl("lblConversion") as Label;
                Label lblRevenuePerVisit = e.Item.FindControl("lblRevenuePerVisit") as Label;

                ReportFields item = e.Item.DataItem as ReportFields;

                lblTitle.Text = item.ShortName;
                if (item.TotalOrders > 0)
                {
                    lblTotalOrder.Text = string.Format("{0:##,##}", item.TotalOrders);
                }
                else
                {
                    lblTotalOrder.Text = "0";
                }

                if (item.UniqueVisitors > 0)
                {
                    lbHitLinkVisitor.Text = string.Format("{0:##,##}", item.UniqueVisitors);
                }
                else
                {
                    lbHitLinkVisitor.Text = "0";
                }


                lblConversion.Text      = String.Format("{0}%", item.Conversion);
                lblRevenuePerVisit.Text = String.Format("{0:C}", item.RevenuePerVisit);
                lblAvgOrder.Text        = String.Format("{0:C}", item.AverageOrder);
                lblTotalRev.Text        = String.Format("{0:C}", item.TotalRevenue);

                CategoryUniqueVistiors += item.UniqueVisitors;


                DataList            dlUrlList = (DataList)e.Item.FindControl("dlUrlList");
                List <ReportFields> items     = dtCollectionList[2].FindAll(y => y.VersionId == item.VersionId);
                if (items.Count > 0)
                {
                    dlUrlList.DataSource = items;
                    dlUrlList.DataBind();
                }
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblSumTotalOrder      = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label lblSumAvgOrder        = e.Item.FindControl("lblSumAvgOrder") as Label;
                Label lblSumTotalRev        = e.Item.FindControl("lblSumTotalRev") as Label;
                Label lblSumHitLinkVisitor  = e.Item.FindControl("lblSumHitLinkVisitor") as Label;
                Label lblSumTotalConversion = e.Item.FindControl("lblSumTotalConversion") as Label;
                Label lblSumRevenuePerClick = e.Item.FindControl("lblSumRevenuePerClick") as Label;

                HtmlContainerControl versionFooter = e.Item.FindControl("versionFooter") as HtmlContainerControl;
                ReportFields         foundItem     = dtCollectionList[0].Find(y => y.CatgoryId == CategoryId);
                if (dtCollectionList[0].Count == 1)
                {
                    versionFooter.Visible = false;
                }
                else
                {
                    versionFooter.Visible = true;
                }
                if (foundItem != null)
                {
                    if (CategoryUniqueVistiors > 0)
                    {
                        lblSumHitLinkVisitor.Text = string.Format("{0:##,##}", CategoryUniqueVistiors);

                        lblSumTotalConversion.Text = String.Format("{0}%", Math.Round((foundItem.TotalOrders * 100) / CategoryUniqueVistiors, 1));
                        lblSumRevenuePerClick.Text = String.Format("{0:C}", Math.Round(foundItem.TotalRevenue / CategoryUniqueVistiors, 2));
                    }
                    else
                    {
                        lblSumHitLinkVisitor.Text  = "0";
                        lblSumTotalConversion.Text = "0";
                        lblSumRevenuePerClick.Text = "0";
                    }

                    if (foundItem.TotalOrders > 0)
                    {
                        lblSumTotalOrder.Text = string.Format("{0:##,##}", foundItem.TotalOrders);
                    }
                    else
                    {
                        lblSumTotalOrder.Text = "0";
                    }


                    lblSumAvgOrder.Text = String.Format("{0:C}", foundItem.AverageOrder);
                    lblSumTotalRev.Text = String.Format("{0:C}", foundItem.TotalRevenue);

                    TotalCategoryUniqueVistiors += CategoryUniqueVistiors;
                    TotalOrders  += foundItem.TotalOrders;
                    TotalRevenue += foundItem.TotalRevenue;
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Creates a column model for a report
        /// </summary>
        /// <param name="fields">The visible columns</param>
        public static ColumnModel CreateColumnModel(ReportFields fields)
        {
            ImageColumn reportTypeImageColumn = CreateImageColumn(string.Empty, 20, "");
            ImageColumn reportStatusImageColumn = CreateImageColumn(string.Empty, 20, "");
            TextColumn reportVillageColumn = CreateTextColumn("Village", 50);
            TextColumn reportPlayerColumn = CreateTextColumn("Player", 100);
            DateTimeColumn reportDateColumn = CreateDateTimeColumn("Date", 70);
            ImageColumn reportFlagImageColumn = CreateImageColumn(string.Empty, 20, "");

            reportTypeImageColumn.Visible = (fields & ReportFields.Type) != 0;
            reportStatusImageColumn.Visible = (fields & ReportFields.Status) != 0;
            reportVillageColumn.Visible = (fields & ReportFields.Village) != 0;
            reportPlayerColumn.Visible = (fields & ReportFields.Player) != 0;
            reportDateColumn.Visible = (fields & ReportFields.Date) != 0;
            reportFlagImageColumn.Visible = (fields & ReportFields.Flag) != 0;

            return new ColumnModel(new Column[] {
                reportTypeImageColumn,
                reportStatusImageColumn,
                reportVillageColumn,
                reportPlayerColumn,
                reportDateColumn,
                reportFlagImageColumn});
        }
Ejemplo n.º 19
0
        private bool IsCaptionMissing()
        {
            int nummissing = ReportFields.Where(x => string.IsNullOrEmpty(x.Caption)).Count();

            return(nummissing > 0);
        }
    private void CreateColumns(Report report)
    {
        DataTable table = new DataTable();

        using (SqlCommand command = new SqlCommand())
        {
            command.CommandText = report.GetSqlOld(true, filterControl.ReportConditions);
            command.CommandType = CommandType.Text;
            Report.CreateParameters(UserSession.LoginUser, command, UserSession.LoginUser.UserID);

            using (SqlConnection connection = new SqlConnection(GetReportConnectionString()))
            {
                connection.Open();
                command.Connection = connection;
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.FillSchema(table, SchemaType.Source);
                    adapter.Fill(table);
                }
                connection.Close();
            }
        }

        ReportFields fields = new ReportFields(UserSession.LoginUser);

        fields.LoadByReportID(_reportID);
        foreach (ReportField field in fields)
        {
            if (field.IsCustomField == false && (field.LinkedFieldID == 30 || field.LinkedFieldID == 146))
            {
                GridButtonColumn column = new GridButtonColumn();
                gridReport.MasterTableView.Columns.Add(column);
                column.ButtonType        = GridButtonColumnType.ImageButton;
                column.ImageUrl          = "../images/icons/open.png";
                column.UniqueName        = "ButtonOpen";
                column.CommandName       = "OpenItem";
                column.HeaderStyle.Width = new Unit(32, UnitType.Pixel);
                column.Resizable         = false;
                break;
            }
        }

        if (fields.IsEmpty)
        {
            if (table.Columns.Contains("Ticket_Number"))
            {
                GridButtonColumn column = new GridButtonColumn();
                gridReport.MasterTableView.Columns.Add(column);
                column.ButtonType        = GridButtonColumnType.ImageButton;
                column.ImageUrl          = "../images/icons/open.png";
                column.UniqueName        = "ButtonOpen";
                column.CommandName       = "OpenItem";
                column.HeaderStyle.Width = new Unit(32, UnitType.Pixel);
                column.Resizable         = false;
            }
        }



        foreach (DataColumn dataColumn in table.Columns)
        {
            GridBoundColumn gridColumn;
            if (dataColumn.DataType == typeof(System.DateTime))
            {
                gridColumn = new GridDateTimeColumn();
                gridColumn.DataFormatString = "{0:MM/dd/yyyy hh:mm tt}";
            }
            else if (dataColumn.DataType == typeof(System.Decimal) ||
                     dataColumn.DataType == typeof(System.Double)
                     )
            {
                gridColumn = new GridNumericColumn();
                gridColumn.DataFormatString = "{0:0.00}";
            }
            else if (dataColumn.DataType == typeof(System.Int16) ||
                     dataColumn.DataType == typeof(System.Int32) ||
                     dataColumn.DataType == typeof(System.Int64))
            {
                gridColumn = new GridNumericColumn();
                gridColumn.DataFormatString = "{0:0}";
            }
            else
            {
                gridColumn = new GridBoundColumn();
            }


            gridReport.MasterTableView.Columns.Add(gridColumn);
            gridColumn.DataType          = dataColumn.DataType;
            gridColumn.DataField         = dataColumn.ColumnName.Replace(' ', '_');
            gridColumn.UniqueName        = gridColumn.DataField;
            gridColumn.HeaderText        = dataColumn.ColumnName.Replace('_', ' ');
            gridColumn.HeaderStyle.Width = new Unit(200, UnitType.Pixel);
        }
    }
Ejemplo n.º 21
0
        private bool IsFieldTypeMissing()
        {
            int nummissing = ReportFields.Where(x => x.FieldType < -90).Count();

            return(nummissing > 0);
        }
Ejemplo n.º 22
0
        private bool IsDataTypeMissing()
        {
            int nummissing = ReportFields.Where(x => x.DataTypeID == 0).Count();

            return(nummissing > 0);
        }
Ejemplo n.º 23
0
        private bool IsFieldNameMissing()
        {
            int nummissing = ReportFields.Where(x => string.IsNullOrEmpty(x.FieldName)).Count();

            return(nummissing > 0);
        }