Example #1
0
        public static void ApplyEmployeeDayStyle(XRControl control, StoreDay storeDay, EmployeeDay employeeDay, long worldID, IRecordingContext context)
        {
            control.BackColor = Color.Transparent;

            ApplyStoreDayStyle(control, storeDay);

            if (employeeDay != null)
            {
                if (employeeDay.CountDailyAdditionalCharges > 0)
                {
                    control.BackColor = Color.Yellow;
                }
                else if (employeeDay.StoreWorldId != worldID || employeeDay.HasLongAbsence || !employeeDay.HasRelation)
                {
                    control.BackColor = Color.Gray;

                    if (employeeDay.HasLongAbsence)
                    {
                        int? color = context.LongAbsences.GetColor(employeeDay.LongAbsenceId);
                        if (color.HasValue)
                            control.BackColor = Color.FromArgb(color.Value);
                        //control.ForeColor = Color.Black;
                    }
                }
            }
        }
Example #2
0
        public static void Localize(XRControl control)
        {
            if (control == null)
            {
                return;
            }

            if (!String.IsNullOrEmpty(control.Name))
            {
                control.Text = GetLocalizeWord(control.Name);
            }
            //
            if (control is XRTable)
            {
                XRTable table = control as XRTable;
                for (int rowIdx = 0; rowIdx < table.Rows.Count; rowIdx++)
                {
                    foreach (XRTableCell cell in table.Rows[rowIdx].Cells)
                    {
                        cell.Text = GetLocalizeWord(cell.Name);
                    }
                }
            }
            else if (control is Subreport)
            {
                Localize(control);
            }
            else
            {
                for (int i = 0; i < control.Controls.Count; ++i)
                    Localize(control.Controls[i]);
            }
        }
        private void AttachToControl(XRControl control)
        {
            var hashcode = control.GetHashCode();

            if (!_listenedInstances.ContainsKey(hashcode))
            {
                control.BeforePrint += control_BeforePrint;
                _listenedInstances.Add(hashcode, control);
            }
        }
        // Main Loop
        private void Visit(XRControl control)
        {
            // Set Root Hashcode On SubReport Here:
            control.TryAs<XRSubreport>(sr => sr.SetRootHashCodeOnSubreport(_eventAggregator));

            // Self
            PublishScopedMessage(control);

            // Get Children
            var children = VisitChildren(control);

            // Recursion
            foreach (var child in children)
                //Visit(child);
                AttachToControl(child);
        }
Example #5
0
        public static XRLabel AddLabelLine(XRControl container, string text, Color color, int yPosition, bool canGrow)
        {
            XRLabel label = new XRLabel();
            container.Controls.Add(label);
            label.Size = new Size(container.Width, 16);
            label.BorderColor = Color.Transparent;
            label.Borders = BorderSide.None;
            label.Location = new Point(0, yPosition);
            label.CanGrow = false;
            label.Dock = XRDockStyle.Top;
            label.Font = container.Font;
            label.Text = text;
            label.ForeColor = color;

            return label;
        }
Example #6
0
        public static void ApplyEmployeePlanningDayStyle(XRControl control, StoreDay storeDay, EmployeePlanningDay employeeDay, long worldID)
        {
            control.BackColor = Color.Transparent;

            ApplyStoreDayStyle(control, storeDay);

            if (employeeDay != null)
            {
                if (employeeDay.CountDailyAdditionalCharges > 0)
                {
                    control.BackColor = Color.Yellow ;
                }
                else if (employeeDay.WorldId != worldID || employeeDay.HasLongAbsence)
                {
                    control.BackColor = Color.Gray;
                }
            }
        }
Example #7
0
        protected virtual DetailBand CreateDetailContainer(XRControl control)
        {
            var result = this.ContainerBand.GetBandByType <DetailBand>();

            if (result == null)
            {
                result = new DetailBand()
                {
                    HeightF = 0F
                };
                this.ContainerBand.Bands.Add(result);
            }
            else
            {
                result.Controls.Clear();
                result.HeightF = 0F;
            }
            result.Controls.Add(control);
            return(result);
        }
Example #8
0
        public static void SetFormat(this XRControl control,
                                     string formatString,
                                     BorderSide?border,
                                     TextAlignment?alignment)
        {
            if (!string.IsNullOrWhiteSpace(formatString))
            {
                control.SetFormat(formatString);
            }

            if (border.HasValue)
            {
                control.SetBorder(border.Value);
            }

            if (alignment.HasValue)
            {
                control.SetAlignment(alignment.Value);
            }
        }
        public override void HandleDragDrop(object sender, DragEventArgs e)
        {
            ResetUI(e);

            XRControl parent = BandViewSvc.GetControlByScreenPoint(new Point(e.X, e.Y));

            if (parent == null)
            {
                return;
            }

            XRRichText demoRichText = new XRRichText();
            PointF     location     = GetDragDropLocation(e, demoRichText, parent);

            DesignToolHelper.AddToContainer(Host, demoRichText);

            demoRichText.LocationF = location;
            demoRichText.Size      = new Size(100, 25);
            demoRichText.DataBindings.Add("Rtf", null, "test");
        }
Example #10
0
        public ActionResult DocumentViewerPartial()
        {
            string selectedIDs = Request["txtselected"].ToString();

            //string sql = String.Format("SELECT * FROM view_FullExamineeResults WHERE ActualTestID IN ({0}) ORDER BY {1} {2}", selectedIDs, Request["rgSortedBy"], Request["rptSortdOrder"]);
            string sql = String.Format("SELECT * FROM (select * from view_FullExamineeResults where SiteID in (" + GlobalVar.SiteID + ")) vfe WHERE ActualTestID IN ({0}) ORDER BY {1} {2}", selectedIDs, Request["rgSortedBy"], Request["rptSortdOrder"]);

            string        constr = ConfigurationManager.ConnectionStrings["dbconn"].ToString();
            SqlConnection _con   = new SqlConnection(constr);

            SqlDataAdapter _da = new SqlDataAdapter(sql, _con);

            DataSet ds = new DataSet();

            _da.Fill(ds);
            MainReport.DataMember = ds.Tables[0].TableName;
            MainReport.DataSource = ds;

            ViewBag.selection              = Request["teFirstName"];
            MainReport.txtPrintDate.Text   = "Print Date: " + DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt");
            MainReport.txtCompanyName.Text = Util.GetConfig("COMPANY_NAME");
            MainReport.pbLogo.ImageUrl     = Util.GetReportLogoPath();
            MainReport.txtRptTitle.Text    = Util.GetConfig("APP_ABBRV") + " " + MainReport.txtRptTitle.Text;
            MainReport.txtSortedBy.Text    = String.Format("{0} ({1})", Request["SortedDesc"], Request["rptSortdOrder"] == "Asc" ? "Ascending" : "Descending");


            DataTable dt = ds.Tables[0];

            for (int i = 0; i <= dt.Columns.Count - 1; i++)
            {
                XRControl cell = MainReport.FindControl(dt.Columns[i].ColumnName, true);
                if (cell != null)
                {
                    cell.DataBindings.Add("Text", null, dt.Columns[i].ColumnName);
                }
            }

            MainReport.txtAvgScore.DataBindings.Add("Text", null, "TotalPercent");

            return(PartialView("_DocumentViewer1Partial", MainReport));
        }
Example #11
0
        public static void SetFormat(this XRControl control,
                                     string formatString)
        {
            if (formatString == null)
            {
                throw new ArgumentNullException(nameof(formatString));
            }

            var binding = control.GetTextBinding();

            if (binding != null)
            {
                binding.FormatString = formatString;

                binding = control.GetBookmarkBinding();
                if (binding != null)
                {
                    binding.FormatString = formatString;
                }
            }
        }
        public void AttemptActionsOnControl(XRControl control)
        {
            // TODO: Add Filter by Whitelist ReportActionName and/or ReportActionGroupName

            // Optimization - ignore XRControls that we don't have ReportActions for
            var foundMatchingRuntimeAction = (from type in _controlTypes
                                              where type.IsInstanceOfType(control)
                                              select type).Any();

            if (foundMatchingRuntimeAction == false)
                return;

            // Predicates
            var actions = from action in _runtimeActions
                          where action.ActionPredicate(control)
                          select action;

            // Execute matching Runtime Actions
            foreach (var action in actions)
                action.ActionToApply.Invoke(control);
        }
        public override void HandleDragDrop(object sender, DragEventArgs e)
        {
            ResetUI(e);

            DataInfo[] droppedData   = e.Data.GetData(typeof(DataInfo[])) as DataInfo[];
            XRControl  parentControl = BandViewSvc.GetControlByScreenPoint(new Point(e.X, e.Y));

            ISelectionService selectSvc = Host.GetService(typeof(ISelectionService)) as ISelectionService;

            if (((parentControl is XRPanel) || (parentControl is Band)) && ((droppedData.Length == 1)))
            {
                AddSingleField(e, droppedData, parentControl, selectSvc);
            }
            else if (((parentControl is XRPanel) || (parentControl is Band)) && ((droppedData.Length > 1)))
            {
                AddMultipleFields(e, droppedData, parentControl, selectSvc);
            }
            else
            {
                base.HandleDragDrop(sender, e);
            }
        }
Example #14
0
        private void ReadComp(XRControl xtraControl, StiComponent comp)
        {
            comp.Name = xtraControl.Name;

            comp.Left   = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.LeftF);
            comp.Top    = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.TopF);
            comp.Width  = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.WidthF);
            comp.Height = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.HeightF);

            comp.CanGrow   = xtraControl.CanGrow;
            comp.CanShrink = xtraControl.CanShrink;
            comp.Enabled   = xtraControl.Visible;

            comp.Bookmark.Value  = xtraControl.Bookmark;
            comp.Hyperlink.Value = xtraControl.NavigateUrl;
            comp.Tag.Value       = xtraControl.Tag != null?xtraControl.Tag.ToString() : "";

            comp.AfterPrintEvent.Script  = xtraControl.Scripts.OnAfterPrint;
            comp.BeforePrintEvent.Script = xtraControl.Scripts.OnBeforePrint;

            comp.Enabled        = xtraControl.Visible;
            comp.ComponentStyle = xtraControl.StyleName;
        }
Example #15
0
 private void SetVariables(DevExpress.XtraReports.UI.XtraReport rptTmp)
 {
     foreach (DictionaryEntry de in Config.Variables)
     {
         string key = de.Key.ToString();
         if (key.Contains("@"))
         {
             key = key.Remove(0, 1);
         }
         XRControl xrc = rptTmp.FindControl(key, true);
         if (xrc != null)
         {
             string   value = de.Value.ToString();
             DateTime r;
             if (DateTime.TryParse(value, out r))
             {
                 value = DateTime.Parse(value).ToString("dd/MM/yyyy");//.ToShortDateString();
             }
             xrc.Text = value;
             xrc      = null;
         }
     }
 }
Example #16
0
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRControl control     = (XRControl)sender;
            int       orderItemID = (int)this.GetCurrentColumnValue("[ID]");

            Models.OrderItem oItem = new Models.OrderItem();
            oItem = dbContext.OrderItems.FirstOrDefault(o => o.ID == orderItemID);

            int partID = oItem.PartID;

            Models.Part prt = new Models.Part();
            prt = dbContext.Parts.FirstOrDefault(p => p.ID == partID);

            if (prt.Files.Count > 0)
            {
                int         fileID   = prt.Files.FirstOrDefault().FileId;
                Models.File fileItem = new Models.File();
                fileItem = dbContext.Files.FirstOrDefault(f => f.FileId == fileID);

                if (fileItem.Content != null)
                {
                    PdfViewer pdfViewer = new PdfViewer();
                    Stream    stream    = new MemoryStream(fileItem.Content);

                    pdfViewer.LoadDocument(stream);
                    Bitmap bitmap = pdfViewer.CreateBitmap(1, 950);
                    bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);

                    pdfViewer.CloseDocument();
                    pdfViewer.Dispose();

                    xrPictureBox1.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource(bitmap);
                    //string name = (string) this.GetCurrentColumnValue("FileName");
                    //xrLabel1.Text = name;
                }
            }
        }
Example #17
0
        public static void SetAlignment(this XRControl control, TextAlignment alignment)
        {
            int h = 0;

            if (alignment == TextAlignment.BottomLeft ||
                alignment == TextAlignment.MiddleLeft ||
                alignment == TextAlignment.TopLeft)
            {
                h = -1;
            }
            else if (alignment == TextAlignment.BottomRight ||
                     alignment == TextAlignment.MiddleRight ||
                     alignment == TextAlignment.TopRight)
            {
                h = 1;
            }

            int v             = 0;
            var baseAlignment = control.GetEffectiveTextAlignment();

            if (baseAlignment == TextAlignment.BottomLeft ||
                baseAlignment == TextAlignment.BottomCenter ||
                baseAlignment == TextAlignment.BottomJustify ||
                baseAlignment == TextAlignment.BottomRight)
            {
                v = -1;
            }
            else if (baseAlignment == TextAlignment.TopLeft ||
                     baseAlignment == TextAlignment.TopCenter ||
                     baseAlignment == TextAlignment.TopJustify ||
                     baseAlignment == TextAlignment.TopRight)
            {
                v = 1;
            }

            control.TextAlignment = CalculateTextAlignment(h, v);
        }
Example #18
0
        public void AlignHorizontally(XRControl container)
        {
            // Make sure that the collection is not empty.
            if (container.Controls.Count > 0)
            {
                // Assign the Y-coordinate of the first control in the collection to a variable.
                int height = container.Controls[0].Top;

                // Find the Y-coordinate of the control located above other controls.
                foreach (XRControl control in container.Controls)
                {
                    if (control.Top < height)
                    {
                        height = control.Top;
                    }
                }

                // Align the controls with the topmost control.
                foreach (XRControl control in container.Controls)
                {
                    control.Location = new Point(control.Left, height);
                }
            }
        }
Example #19
0
        public void CreateReportWithBookmark()
        {
            ReportDataV2 reportData = ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", "ReportWithBookmark"));

            if (reportData == null)
            {
                reportData = ObjectSpace.CreateObject <ReportDataV2>();
                XtraReport rep = new XtraReport();
#if !DXCORE3
                byte[]       byteArray = Encoding.UTF8.GetBytes(ConvertVersion(OrdinalReportResource.ReportLayout));
                MemoryStream stream    = new MemoryStream(byteArray);
                rep.LoadLayout(stream);
#else
                var assembly      = Assembly.GetExecutingAssembly();
                var resourceNames = assembly.GetManifestResourceNames();
                var resourceName  = resourceNames.FirstOrDefault(p => p.Contains("OrdinalReport.repx"));

                using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
                    rep.LoadLayout(stream);
                }
#endif
                rep.DisplayName = "ReportWithBookmark";
                rep.Bookmark    = "Names";
                XRControl control = rep.FindControl("label5", true);
                if (control != null)
                {
                    control.DataBindings.Add(new DevExpress.XtraReports.UI.XRBinding("Bookmark", null, "FirstName"));
                }
                control = rep.FindControl("label9", true);
                if (control != null)
                {
                    control.Text = "Report with bookmarks";
                }
                ReportDataProvider.ReportsStorage.SaveReport(reportData, rep);
            }
        }
Example #20
0
        void serv_ComponentAdded(object sender, ComponentEventArgs e)
        {
            XRControl cont = e.Component as XRControl;

            if (cont != null)
            {
                if (cont.DataBindings["Text"] != null)
                {
                    PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(cont);

                    string        s       = cont.DataBindings["Text"].DataMember.Substring(cont.DataBindings["Text"].DataMember.LastIndexOf(".") + 1) + "_test";
                    string        ss      = s;
                    IDesignerHost host    = cont.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
                    int           counter = 1;
                    while (host.Container.Components[ss] != null)
                    {
                        ss = s + counter;
                        counter++;
                    }
                    cont.Site.Name = ss;
                    pdc["Name"].SetValue(cont, ss);
                }
            }
        }
Example #21
0
        public static void Insert15MinuteShapes(XRControl target, DateTime baseTime, bool manualFill)
        {
            int shapeWidth = (target.Width - 5) / 4;
            int shapeHeight = target.Height - 2;

            for (int idx=0; idx<4; idx++)
            {
                TimeSpan cellTime = baseTime.AddMinutes(idx * 15).TimeOfDay;

                XRLabel label = new XRLabel();
                label.Tag = new TimeCellInfo(cellTime, manualFill);
                if (manualFill)
                {
                    label.Borders = BorderSide.All;
                    label.BorderColor = Color.Black;
                } else
                {
                    label.Borders = BorderSide.None;
                }
                target.Controls.Add(label);
                label.Location = new Point((shapeWidth * idx) + idx + 1, 1);
                label.Size = new Size(shapeWidth, shapeHeight);
                label.BackColor = Color.Transparent;
            }
        }
Example #22
0
 public void SetPageNumberVisibility(XRControl control, bool visibility)
 {
     if (control.Controls.Count > 0)
     {
         foreach (XRControl subControl in control.Controls)
         {
             SetPageNumberVisibility(subControl, visibility);
         }
     }
     else if (control is XRPageInfo)
     {
         control.Visible = visibility;
     }
 }
Example #23
0
 public ControlInfo(XRControl control, float height)
 {
     Control = control;
     Height = height;
 }
 private void PublishScopedMessage(XRControl control)
 {
     var guid = ((gcXtraReport)control.NavigateToBaseReport()).RootReportGuid;
     var message = new ScopedControlBeforePrintMessage(guid, control);
     _eventAggregator.Publish(message);
 }
 public static XRBinding GetBookmarkBinding(this XRControl control)
 {
     return(control.DataBindings[nameof(control.Bookmark)]);
 }
Example #26
0
        protected void addLogo()
        {
            try
            {
                if (_impostazioniReport.PosizioneLogo != PosizioneStampaLogoEnum.Nessuno)
                {
                    var logo = getAziendaService().GetLogo();
                    if (logo == null)
                        return;
                    if (_impostazioniReport.TipoLogo == TipoLogoEnum.Rtf || _impostazioniReport.TipoLogo == TipoLogoEnum.RtfDate || _impostazioniReport.TipoLogo == TipoLogoEnum.Nessuno)
                    {
                        var intestazioneRtf = logo.LogoRtfEsercizioAzienda;
                        if (_impostazioniReport.TipoLogo == TipoLogoEnum.RtfDate)
                            intestazioneRtf = logo.LogoRtfDateAzienda;

                        int? idEsercizio = null;
                        if (_esercizio != null)
                            idEsercizio = _esercizio.ID;

                        float width = _report.PageWidth;
                        if (_impostazioniReport.LogoWidth != null)
                            width = _impostazioniReport.LogoWidth.GetValueOrDefault();

                        _logo = new XRRichText
                        {
                            SizeF = new SizeF(width, 100)
                        };

                        if (_impostazioniReport.TipoLogo == TipoLogoEnum.Rtf || _impostazioniReport.TipoLogo == TipoLogoEnum.RtfDate)
                        {
                            var intestazione = getStampeService()
                                .MailMergeRtfText(Conversione.ToString(intestazioneRtf),
                                    new ParametriStampaUnione
                                    {
                                        IdCondominio = _condominio.ID,
                                        IdEsercizio = idEsercizio,
                                        DataIniziale = _dataIniziale,
                                        DataFinale = _dataFinale,
                                        TipoReport = _impostazioniReport.Descrizione
                                    });
                            ((XRRichText) _logo).Rtf = intestazione;
                        }
                    }
                    else if (_impostazioniReport.TipoLogo == TipoLogoEnum.Picture && logo.LogoAzienda != null && logo.LogoAzienda.Length > 0)
                    {
                        _logo = new XRPanel();
                        var logoPicture = new XRPictureBox();
                        var logoIntestazione = new XRLabel();
                        var nomeCondominio = new XRLabel();
                        var indirizzoCondominio = new XRLabel();

                        // 
                        // logoPicture
                        // 
                        logoPicture.Image = Conversione.ToImage(logo.LogoAzienda);
                        logoPicture.LocationFloat = new PointFloat(9.999998F, 10.00001F);
                        logoPicture.Name = "logoPicture";
                        logoPicture.SizeF = new SizeF(715F, 69.58334F);
                        // 
                        // logoIntestazione
                        // 
                        logoIntestazione.BorderDashStyle = BorderDashStyle.Solid;
                        logoIntestazione.Borders = ((BorderSide.Left | BorderSide.Top)
                                                    | BorderSide.Right)
                                                   | BorderSide.Bottom;
                        logoIntestazione.BorderWidth = 1F;
                        logoIntestazione.Font = new Font("Arial", 9F, FontStyle.Bold);
                        logoIntestazione.LocationFloat = new PointFloat(10.00005F, 85F);
                        logoIntestazione.Name = "logoIntestazione";
                        logoIntestazione.Padding = new PaddingInfo(2, 2, 0, 0, 100F);
                        logoIntestazione.SizeF = new SizeF(715F, 23F);
                        logoIntestazione.StylePriority.UseBorderDashStyle = false;
                        logoIntestazione.StylePriority.UseBorders = false;
                        logoIntestazione.StylePriority.UseBorderWidth = false;
                        logoIntestazione.StylePriority.UseFont = false;
                        logoIntestazione.StylePriority.UseTextAlignment = false;
                        logoIntestazione.Text =
                            "<<codiceCondominio>> - <<nomeReport>> - Esercizio: <<descrizioneEsercizio>>";
                        logoIntestazione.TextAlignment = TextAlignment.MiddleCenter;
                        // 
                        // nomeCondominio
                        // 
                        nomeCondominio.Font = new Font("Arial", 9.75F);
                        nomeCondominio.LocationFloat = new PointFloat(10.00001F, 115F);
                        nomeCondominio.Name = "nomeCondominio";
                        nomeCondominio.Padding = new PaddingInfo(2, 2, 0, 0, 100F);
                        nomeCondominio.SizeF = new SizeF(587.5001F, 19F);
                        nomeCondominio.StylePriority.UseFont = false;
                        nomeCondominio.Text = "<<condominio>>";
                        // 
                        // indirizzoCondominio
                        // 
                        indirizzoCondominio.Font = new Font("Arial", 9.75F);
                        indirizzoCondominio.LocationFloat = new PointFloat(10.00001F, 135F);
                        indirizzoCondominio.Name = "indirizzoCondominio";
                        indirizzoCondominio.Padding = new PaddingInfo(2, 2, 0, 0, 100F);
                        indirizzoCondominio.SizeF = new SizeF(587.5001F, 19F);
                        indirizzoCondominio.StylePriority.UseFont = false;
                        indirizzoCondominio.Text = "<<indirizzoCondominio>> - Codice Fiscale: <<codiceFiscale>>";

                        _logo.Controls.AddRange(new XRControl[]
                        {
                            logoPicture,
                            logoIntestazione,
                            nomeCondominio,
                            indirizzoCondominio
                        });
                    }

                    _logo.Location = new Point(20, 0);

                    if (_impostazioniReport.LogoHeight != null && _impostazioniReport.LogoWidth != null)
                        _logo.SizeF = new SizeF(_impostazioniReport.LogoWidth.GetValueOrDefault(),
                            _impostazioniReport.LogoHeight.GetValueOrDefault());
                    if (_impostazioniReport.LogoLocationX != null && _impostazioniReport.LogoLocationY != null)
                        _logo.Location = new Point(_impostazioniReport.LogoLocationX.Value,
                            _impostazioniReport.LogoLocationY.Value);

                    if (_impostazioniReport.PosizioneLogo == PosizioneStampaLogoEnum.Tutte)
                    {
                        _pageHeaderBand.Controls.Add(_logo);
                        _pageHeaderBand.HeightF = 80F;
                        if (_impostazioniReport.LogoHeight != null)
                            _pageHeaderBand.HeightF = _impostazioniReport.LogoHeight.Value;
                    }
                    else if (_impostazioniReport.PosizioneLogo == PosizioneStampaLogoEnum.Prima)
                    {
                        _reportHeaderBand.Controls.Add(_logo);
                        _pageHeaderBand.HeightF = 20F;
                    }
                }
                else
                {
                    _reportHeaderBand.Visible = false;
                    _pageHeaderBand.HeightF = 20F;
                }

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nella stampa del logo - {0} - azienda:{1}", ex, Utility.GetMethodDescription(), Security.Login.Instance.CurrentLogin().Azienda);
                throw;
            }
        }
        private void AddMultipleFields(DragEventArgs e, DataInfo[] droppedData, XRControl parentControl, ISelectionService selectSvc)
        {
            XRTableCell headerCell;
            XRControl   parent = BandViewSvc.GetControlByScreenPoint(new Point(e.X, e.Y));

            if (parent == null)
            {
                return;
            }
            SizeF size = new SizeF(100F * droppedData.Length, 25F);

            if (parentControl is DetailBand)
            {
                size.Width = CalculateWidth(parentControl);
            }

            XRTable detailTable = new XRTable()
            {
                Name = "DetailTable"
            };

            detailTable.BeginInit();
            XRTableRow detailRow = new XRTableRow();

            detailTable.Rows.Add(detailRow);

            this.droppedControl = detailTable;
            detailTable.SizeF   = size;

            Host.Container.Add(detailTable);
            Host.Container.Add(detailRow);

            for (int i = 0; i < droppedData.Length; i++)
            {
                XRTableCell cell       = new XRTableCell();
                string      expression = ExpressionBindingHelper.NormalizeDataMember(droppedData[i].Member, parent.Report.DataMember);
                cell.ExpressionBindings.Add(
                    new ExpressionBinding("Text",
                                          expression));
                detailRow.Cells.Add(cell);
                Host.Container.Add(cell);
            }
            detailTable.EndInit();

            PointF dropPoint = GetDragDropLocation(e, detailTable, parentControl);

            this.DropXRControl(parentControl, new PointF(0, dropPoint.Y));
            selectSvc.SetSelectedComponents(new XRControl[] { detailTable });
            if ((parentControl is DetailBand))
            {
                PageHeaderBand band = null;
                if ((parentControl as DetailBand).Report.Bands.OfType <PageHeaderBand>().FirstOrDefault() != null)
                {
                    band = (parentControl as DetailBand).Report.Bands[BandKind.PageHeader] as PageHeaderBand;
                }
                else
                {
                    band = new PageHeaderBand();
                    (parentControl as DetailBand).Report.Bands.Add(band);
                    Host.Container.Add(band);
                }

                XRTable headerTable = new XRTable()
                {
                    Name = "HeaderTable"
                };
                headerTable.BeginInit();

                XRTableRow headerRow = new XRTableRow();
                headerTable.Rows.Add(headerRow);

                headerTable.SizeF = size;

                Host.Container.Add(headerTable);
                Host.Container.Add(headerRow);

                for (int i = 0; i < droppedData.Length; i++)
                {
                    headerCell = CreateTableCell(Host, headerRow, droppedData[i].DisplayName);
                }
                headerTable.Borders = BorderSide.All;
                headerTable.EndInit();

                band.Controls.Add(headerTable);
                headerTable.LocationF = droppedControl.LocationF;
            }
        }
 private static void BindReportControl(XRControl control, DataTable dt, string fieldName)
 {
     BindReportControl(control, dt, fieldName, string.Empty);
 }
 void DropXRControl(XRControl parent, PointF dropPoint)
 {
     parent.Controls.Add(droppedControl);
     droppedControl.LocationF = dropPoint;
 }
        private void lbPage_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRControl label = sender as XRControl;

            label.Tag = String.Format("PageBrick_{0}", GetCurrentColumnValue("CategoryID"));
        }
 public XRTreeListScripts(XRControl control)
     : base(control)
 {
     printNode     = string.Empty;
     printNodeCell = string.Empty;
 }
        private void TranslateLabels(Translation translate, XRControlCollection Controls, string lang)
        {
            for (int i = 0; i < Controls.Count; i++)
            {
                XRControl item = Controls[i];

                if (item is XRSubreport)
                {
                    XRSubreport control = (XRSubreport)item;
                    if (control.ReportSource is BaseReport)
                    {
                        BaseReport report = (BaseReport)control.ReportSource;
                        report.TranslateLabels(translate, lang);
                    }
                }
                else if (item is XRTable)
                {
                    XRTableRowCollection control = (XRTableRowCollection)item.Controls;
                    foreach (XRTableRow row in control)
                    {
                        TranslateLabels(translate, row.Controls, lang);
                    }
                }

                else if (item is XRTableCell)
                {
                    XRTableCell label = (XRTableCell)item;
                    if (label.Name.ToLower() == "programid")
                    {
                        string reportName = GetType().Name.Replace("Report", "");
                        label.Text = translate.GetProgramName(lang, reportName) + " (" + reportName + ")";
                    }
                    else
                    {
                        string caption = GetControlLabel(translate, label.Name, lang);
                        if (caption.Length > 0 && !caption.StartsWith("["))
                        {
                            label.Text = caption;
                        }
                    }
                    foreach (XRBinding binding in label.DataBindings)
                    {
                        if (binding.FormatString != null)
                        {
                            if (binding.FormatString.Contains("$"))
                            {
                                binding.FormatString = "{0:c}";
                            }
                            else if (binding.FormatString.Contains("%"))
                            {
                                binding.FormatString = "{0:p}";
                            }
                        }
                    }

                    if (item.Controls.Count > 0)
                    {
                        TranslateLabels(translate, item.Controls, lang);
                    }
                }

                else if (item is XRLabel)
                {
                    XRLabel label = (XRLabel)item;
                    if (label.Name.ToLower() == "programid")
                    {
                        string reportName = GetType().Name.Replace("Report", "");
                        label.Text = translate.GetProgramName(lang, reportName) + " (" + reportName + ")";
                    }
                    else
                    {
                        string caption = GetControlLabel(translate, label.Name, lang);
                        if (caption.Length > 0 && !caption.StartsWith("["))
                        {
                            label.Text = caption;
                        }
                    }

                    foreach (XRBinding binding in label.DataBindings)
                    {
                        if (binding.FormatString != null)
                        {
                            if (binding.FormatString.Contains("$"))
                            {
                                binding.FormatString = "{0:c}";
                            }
                            else if (binding.FormatString.Contains("%"))
                            {
                                binding.FormatString = "{0:p}";
                            }
                        }
                    }
                }
                else if (item is XRPivotGrid)
                {
                    XRPivotGrid grid = (XRPivotGrid)item;

                    foreach (XRPivotGridField field in grid.Fields)
                    {
                        string caption = GetControlLabel(translate, field.Name, lang);
                        if (caption.Length > 0 && !caption.StartsWith("["))
                        {
                            field.Caption = caption;
                        }

                        if (field.CellFormat.FormatType == DevExpress.Utils.FormatType.Numeric)
                        {
                            String sFormatString = field.CellFormat.FormatString.ToLower();
                            if (!sFormatString.Contains("c") && !sFormatString.Contains("n") && !sFormatString.Contains("p"))
                            {
                                if (sFormatString.Contains("$"))
                                {
                                    field.CellFormat.FormatString = "c";
                                }
                                else if (sFormatString.Contains("%"))
                                {
                                    field.CellFormat.FormatString = "p";
                                }
                                else
                                {
                                    field.CellFormat.FormatString = "n";
                                }
                            }
                        }

                        if (field.ValueFormat.FormatType == DevExpress.Utils.FormatType.Numeric)
                        {
                            String sFormatString = field.ValueFormat.FormatString.ToLower();
                            if (!sFormatString.Contains("c") && !sFormatString.Contains("n") && !sFormatString.Contains("p"))
                            {
                                if (sFormatString.Contains("$"))
                                {
                                    field.ValueFormat.FormatString = "c";
                                }
                                else if (sFormatString.Contains("%"))
                                {
                                    field.ValueFormat.FormatString = "p";
                                }
                                else
                                {
                                    field.ValueFormat.FormatString = "n";
                                }
                            }
                            field.CellFormat.FormatType   = field.ValueFormat.FormatType;
                            field.CellFormat.FormatString = field.ValueFormat.FormatString;
                        }
                    }
                }
            }
        }
        private List<XRControl> VisitChildren(XRControl control)
        {
            if (control is XRSubreport) return VisitSubreportPlaceholderChildren(control as XRSubreport);
            if (control is XRTable) return VisitTableChildren(control as XRTable);
            if (control is XRTableRow) return VisitTableRowChildren(control as XRTableRow);
            if (control is XtraReportBase)
            {
                return (control as XtraReportBase).Bands.OfType<Band>().SelectMany(VisitBandChildren).ToList();
            }
            if (control is Band) return VisitBandChildren(control as Band);

            return control.Controls.Cast<XRControl>().ToList();
        }
Example #34
0
        public static void PrintDayCellValues(XRControl container, EmployeeDay employeeDay, IRecordingContext recordingContext)
        {
            if (employeeDay != null)
            {
                if (employeeDay.HasLongAbsence)
                {
                    string s = recordingContext.LongAbsences.GetAbbreviation(employeeDay.LongAbsenceId);
                    if (!String.IsNullOrEmpty(s))
                    {
                        XRLabel label = AddLabelLine(container, s, Color.Black, 0, false);
                        label.TextAlignment = TextAlignment.MiddleCenter;
                    }
                    return;
                }

                if(employeeDay.TimeList != null)
                {
                    int y = 0;

                    foreach (EmployeeTimeRange range in employeeDay.TimeList)
                    {
                        XRLabel label = AddLabelLine(container, TextParser.EmployeeTimeToString(range), range.Absence == null ? Color.Black : Color.FromArgb(range.Absence.Color), y, false);
                        y = y + label.Height + 1;
                    }
                }
            }
        }
Example #35
0
        public static XRPanel GetPanelControl(XRControl container)
        {
            XRPanel result = null;

            foreach(XRControl control in container.Controls)
            {
                result= control as XRPanel;
                if(result != null)
                {
                    result.Height = container.Height;
                    break;
                }
            }

            return result;
        }
Example #36
0
        private XtraReport CreateReport()
        {
            // Create a blank report.
            XtraReport rep = new XtraReport();

            // Create a detail band and add it to the report.
            DetailBand detail = new DetailBand();

            rep.Bands.Add(detail);

            // Create a pivot grid and add it to the Detail band.
            XRPivotGrid pivotGrid = new XRPivotGrid();

            detail.Controls.Add(pivotGrid);

            DataSet dataSet1 = new DataSet();

            using (SqlDataAdapter ada = new SqlDataAdapter((string)string.Format("SELECT Period,AccountNo,OpenBal,CloseBal,TransDescription,BankName,BankShortCode,Amount FROM ViewIGRAccountDetails WHERE CONVERT(VARCHAR(10),StartDate,103)='{0}' AND CONVERT(VARCHAR(10),EndDate,103)='{1}'", string.Format("{0:dd/MM/yyy}", dtpStart.Value), string.Format("{0:dd/MM/yyy}", dtpEnd.Value)), Logic.ConnectionString))
            {
                ada.Fill(dataSet1, "table");
            }

            // Creata a dataset and fill it.
            //DataSet dataSet1 = new DataSet();
            //adapter.Fill(dataSet1, "SalesPerson");


            // Bind the pivot grid to data.
            pivotGrid.DataSource = dataSet1;
            pivotGrid.DataMember = "SalesPerson";

            XRControl xrControl1 = new XRControl();

            XRLabel label1 = new XRLabel();

            //pivotGrid = xrControl1 as XRPivotGrid;


            pivotGrid.Appearance.Cell.Font = new System.Drawing.Font("Times New Roman", 8F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Regular))));

            //pivotGrid.Appearance.Cell
            // Generate pivot grid's fields.

            XRPivotGridField fieldCategoryName = new XRPivotGridField("BankName", PivotArea.RowArea)
            {
                AreaIndex = 0, Width = 150
            };

            fieldCategoryName.CellFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            fieldCategoryName.CellFormat.FormatString = "({0})";

            XRPivotGridField fieldCountry = new XRPivotGridField("TransDescription", PivotArea.ColumnArea)
            {
                AreaIndex = 0, Width = 120
            };


            XRPivotGridField fieldQuantity = new XRPivotGridField("Amount", PivotArea.DataArea)
            {
                AreaIndex = 0, Width = 80
            };

            fieldQuantity.CellFormat.FormatType             = DevExpress.Utils.FormatType.Numeric;
            fieldQuantity.CellFormat.FormatString           = "{0:n2}";
            fieldQuantity.GrandTotalCellFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            fieldQuantity.GrandTotalCellFormat.FormatString = "{0:n2}";
            fieldQuantity.TotalCellFormat.FormatType        = DevExpress.Utils.FormatType.Numeric;
            fieldQuantity.TotalValueFormat.FormatString     = "{0:n2}";

            //label1 = (string)fieldCountry;



            pivotGrid.OptionsView.ShowColumnHeaders = false;

            pivotGrid.OptionsView.ShowColumnGrandTotals = false;

            //pivotGrid.OptionsView.ShowColumnHeaders = false;
            pivotGrid.OptionsView.ShowDataHeaders = false;

            pivotGrid.OptionsView.ShowRowHeaders = true;

            //pivotGrid.Fields["TransDescription"].BestFit();
            //fieldOrderDate.RowValueLineCount = 3;
            //xrControl1.WordWrap = true;

            //fieldCategoryName.CollapseAll();

            //xrControl1 = (object)fieldCategoryName;
            // Add these fields to the pivot grid.
            //pivotGrid.Fields.AddRange(new PivotGridField[] {fieldCategoryName, fieldCountry,
            //     fieldQuantity});

            pivotGrid.Fields.AddRange(new XRPivotGridField[] { fieldCategoryName, fieldCountry, fieldQuantity });
            pivotGrid.CanShrink = true;

            //pivotGrid.BestFit();
            return(rep);
        }
Example #37
0
        public ActionResult DocumentViewerPartial()
        {
            MainReport.GroupHeader.BeforePrint += MainReport_BeforePrint;

            string selectedIDs = Request["txtselected"].ToString();
            string conditions  = "";

            string sql = String.Format("SELECT * FROM view_ListOfTests WHERE TestID IN ({0}) ", selectedIDs);

            string        constr = ConfigurationManager.ConnectionStrings["dbconn"].ToString();
            SqlConnection _con   = new SqlConnection(constr);

            SqlDataAdapter _da = new SqlDataAdapter(sql, _con);

            DataSet ds = new DataSet();

            _da.Fill(ds);
            MainReport.DataMember = ds.Tables[0].TableName;
            MainReport.DataSource = ds;

            MainReport.TestName.DataBindings.Add("Text", null, MainReport.TestName.Name);
            MainReport.txtTotalTQuestion.DataBindings.Add("Text", null, MainReport.TQuestions.Name);

            MainReport.txtPrintDate.Text   = "Print Date: " + DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt");
            MainReport.txtCompanyName.Text = Util.GetConfig("COMPANY_NAME");
            MainReport.pbLogo.ImageUrl     = Util.GetReportLogoPath();
            MainReport.txtRptTitle.Text    = Util.GetConfig("APP_ABBRV") + " " + MainReport.txtRptTitle.Text;

            GroupField item = new GroupField();

            item.FieldName = "TestName";
            item.SortOrder = Request["rgSortOrder"] == "Asc" ? XRColumnSortOrder.Ascending : XRColumnSortOrder.Descending;
            MainReport.GroupHeader.GroupFields.Add(item);

            MainReport.Detail.SortFields.Add(new GroupField(Request["SortReportBy"], Request["rgSortReportOrder"] == "Asc" ? XRColumnSortOrder.Ascending : XRColumnSortOrder.Descending));

            DataTable dt = ds.Tables[0];

            for (int i = 0; i <= dt.Columns.Count - 1; i++)
            {
                XRControl cell = MainReport.FindControl(dt.Columns[i].ColumnName, true);
                if (cell != null)
                {
                    cell.DataBindings.Add("Text", null, dt.Columns[i].ColumnName);
                    continue;
                }

                cell = MainReport.SubTable.FindControl(dt.Columns[i].ColumnName, true);
                if (cell != null)
                {
                    cell.DataBindings.Add("Text", null, dt.Columns[i].ColumnName);
                    cell.EvaluateBinding += FormatZeroValues;
                }
            }

            ShowRevDates = Convert.ToBoolean(Request["ShowRevDates"]);

            _da = new SqlDataAdapter("SELECT OrigID, FORMAT(DateCreated, 'dd-MMM-yyyy hh:mm tt', 'en-us') DateCreated FROM tblAdmTestTemplates WHERe IsActive<>1 ORDER BY DateCreated DESC", constr);
            _da.Fill(RevisionDatesList);

            RevisionDates.DateCreated.DataBindings.Add("Text", null, "DateCreated");
            MainReport.subRevisionDates.ReportSource = RevisionDates;

            return(PartialView("_DocumentViewer1Partial", MainReport));
        }
 public static XRBinding GetTextBinding(this XRControl control)
 {
     return(control.DataBindings[nameof(control.Text)]);
 }
 public ScopedXRControlBeforePrintMessage(int rootReportHashcode, XRControl control)
 {
     RootReportHashcode = rootReportHashcode;
     Control = control;
 }
        private EmployeePlanningDay ProcessDayCell(XRControl cell)
        {
            EmployeePlanningDay result = null;

            EmployeePlanningWeek employeeWeek = GetCurrentRow();

            StoreDay storeDay = _planningContext.StoreDays[(DateTime)cell.Tag];

            if(employeeWeek != null && storeDay != null && employeeWeek.Days.ContainsKey(storeDay.Date))
            {
                result = employeeWeek.Days[storeDay.Date];
            }

            ReportPainter.ApplyEmployeePlanningDayStyle(cell, storeDay, result, CurrentWorldID);

            return result;
        }
Example #41
0
        DataRow row = null; //tinh
        public static void CreateReport(XtraReport Report, XRControl Band, bool IsShowLateEarly, bool IsShowShift)
        {
            string      str;
            XRTable     xRTable;
            XRTableRow  xRTableRow;
            XRTableCell xRTableCell;
            XRTableCell font;
            XRLabel     xRLabel = new XRLabel()
            {
                Text          = "Bảng ký hiệu chấm công",
                Font          = new Font("Times New Roman", 9.25f, FontStyle.Bold | FontStyle.Italic),
                TopF          = Band.TopF + 12f,
                WidthF        = 200f,
                TextAlignment = TextAlignment.MiddleLeft
            };

            Band.Controls.Add(xRLabel);
            float single = 0f;
            float topF   = xRLabel.TopF + xRLabel.HeightF + 6f;


            foreach (DataRow row in (new DIC_SYMBOL()).GetList().Rows)
            {
                if (bool.Parse(row["IsShow"].ToString()))
                {
                    str                       = "";
                    str                       = (!(row["SymbolCode"].ToString() == "") ? row["SymbolCode"].ToString() : "(trống)");
                    xRTable                   = new XRTable();
                    xRTableRow                = new XRTableRow();
                    xRTableCell               = new XRTableCell();
                    font                      = new XRTableCell();
                    xRTableCell.WidthF        = 102f;
                    xRTableCell.Text          = row["SymbolName"].ToString();
                    xRTableCell.WordWrap      = false;
                    xRTableCell.Font          = new Font("Times New Roman", 8.75f);
                    xRTableCell.TextAlignment = TextAlignment.MiddleLeft;
                    font.WidthF               = 62f;
                    font.Text                 = string.Concat(": ", str);
                    font.WordWrap             = false;
                    font.Font                 = new Font("Times New Roman", 8.75f);
                    font.TextAlignment        = TextAlignment.MiddleLeft;
                    xRTableRow.Cells.Add(xRTableCell);
                    xRTableRow.Cells.Add(font);
                    xRTable.Rows.Add(xRTableRow);
                    xRTable.HeightF = 15f;
                    xRTable.WidthF  = 164f;
                    xRTable.TopF    = topF;
                    xRTable.LeftF   = single;
                    Band.Controls.Add(xRTable);
                    if ((float)(Report.PageWidth - (Report.Margins.Left + Report.Margins.Right)) - single < 328f)
                    {
                        single = 0f;
                        topF  += 18f;
                    }
                    else
                    {
                        single += 164f;
                    }
                }
            }
            if (IsShowLateEarly)
            {
                for (int i = 0; i < 4; i++)
                {
                    string str1 = "";
                    str = "";
                    if (i == 0)
                    {
                        str1 = "Số phút đi trễ: ";
                        str  = ": +(số phút)";
                    }
                    else if (i == 1)
                    {
                        str1 = "Số phút về sớm: ";
                        str  = ": -(số phút)";
                    }
                    else if (i == 2)
                    {
                        str1 = "Đi trễ, về sớm: ";
                        str  = ": +(sp):-(sp)";
                    }
                    else if (i == 3)
                    {
                        str1 = "Tách đôi ca: ";
                        str  = ": +;V +;P ...";
                    }
                    xRTable                   = new XRTable();
                    xRTableRow                = new XRTableRow();
                    xRTableCell               = new XRTableCell();
                    font                      = new XRTableCell();
                    xRTableCell.WidthF        = 102f;
                    xRTableCell.Text          = str1;
                    xRTableCell.WordWrap      = false;
                    xRTableCell.Font          = new Font("Times New Roman", 8.75f);
                    xRTableCell.TextAlignment = TextAlignment.MiddleLeft;
                    font.WidthF               = 62f;
                    font.Text                 = str;
                    font.WordWrap             = false;
                    font.Font                 = new Font("Times New Roman", 8.75f);
                    font.TextAlignment        = TextAlignment.MiddleLeft;
                    xRTableRow.Cells.Add(xRTableCell);
                    xRTableRow.Cells.Add(font);
                    xRTable.Rows.Add(xRTableRow);
                    xRTable.HeightF = 15f;
                    xRTable.WidthF  = 164f;
                    xRTable.TopF    = topF;
                    xRTable.LeftF   = single;
                    Band.Controls.Add(xRTable);
                    if ((float)(Report.PageWidth - (Report.Margins.Left + Report.Margins.Right)) - single < 328f)
                    {
                        single = 0f;
                        topF  += 18f;
                    }
                    else
                    {
                        single += 164f;
                    }
                }
            }
            if (IsShowShift)
            {
                XRLabel xRLabel1 = new XRLabel()
                {
                    Text = "Ký hiệu chấm công theo ca",
                    Font = new Font("Times New Roman", 9.25f, FontStyle.Bold | FontStyle.Italic)
                };
                float single1 = topF + 20f;
                topF                   = single1;
                xRLabel1.TopF          = single1;
                xRLabel1.WidthF        = 200f;
                xRLabel1.TextAlignment = TextAlignment.MiddleLeft;
                Band.Controls.Add(xRLabel1);
                single = 0f;
                topF  += 30f;
                foreach (DataRow dataRow in (new DIC_SHIFT()).GetList().Rows)
                {
                    str                = "";
                    str                = (!(dataRow["ShiftCode"].ToString() == "") ? dataRow["ShiftCode"].ToString() : "(trống)");
                    xRTable            = new XRTable();
                    xRTableRow         = new XRTableRow();
                    xRTableCell        = new XRTableCell();
                    font               = new XRTableCell();
                    xRTableCell.WidthF = 136f;
                    string[] shortTimeString = new string[] { dataRow["ShiftName"].ToString(), " (", null, null, null, null };
                    DateTime dateTime        = Convert.ToDateTime(dataRow["BeginTime"].ToString());
                    shortTimeString[2]        = dateTime.ToShortTimeString();
                    shortTimeString[3]        = " - ";
                    dateTime                  = Convert.ToDateTime(dataRow["EndTime"].ToString());
                    shortTimeString[4]        = dateTime.ToShortTimeString();
                    shortTimeString[5]        = ")";
                    xRTableCell.Text          = string.Concat(shortTimeString);
                    xRTableCell.WordWrap      = false;
                    xRTableCell.Font          = new Font("Times New Roman", 8.75f);
                    xRTableCell.TextAlignment = TextAlignment.MiddleLeft;
                    font.WidthF               = 62f;
                    font.Text                 = string.Concat(": ", str);
                    font.WordWrap             = false;
                    font.Font                 = new Font("Times New Roman", 8.75f);
                    font.TextAlignment        = TextAlignment.MiddleLeft;
                    xRTableRow.Cells.Add(xRTableCell);
                    xRTableRow.Cells.Add(font);
                    xRTable.Rows.Add(xRTableRow);
                    xRTable.HeightF = 15f;
                    xRTable.WidthF  = 198f;
                    xRTable.TopF    = topF;
                    xRTable.LeftF   = single;
                    Band.Controls.Add(xRTable);
                    if ((float)(Report.PageWidth - (Report.Margins.Left + Report.Margins.Right)) - single < 396f)
                    {
                        single = 0f;
                        topF  += 18f;
                    }
                    else
                    {
                        single += 198f;
                    }
                }
            }
        }
Example #42
0
        private float getControlHeight(XRControl control)
        {
            var height = 0f;
            foreach (var childControl in control.Controls)
            {
                var childXrControl = childControl as XRControl;
                if (childXrControl != null)
                {
                    if (childXrControl.HasChildren)
                        height += getControlHeight(childXrControl);
                    else
                    {
                        height += childXrControl.HeightF;
                    }
                }
            }

            return height;
        }
 public ScopedXRControlBeforePrintMessage(int rootReportHashcode, XRControl control)
 {
     RootReportHashcode = rootReportHashcode;
     Control            = control;
 }
        public ScopedControlBeforePrintMessage(Guid rootReportGuid, XRControl control)
        {
            RootReportGuid = rootReportGuid;

            Control = control;
        }
Example #45
0
        public ActionResult DocumentViewerPartial()
        {
            //SETSReport.Reports.XtraReport2 report = new SETSReport.Reports.XtraReport2();
            //DevExpress.XtraReports.UI.XRLabel lbl = ((DevExpress.XtraReports.UI.XRLabel)report.FindControl("xrlabel1", true));
            // lbl.Text = Session["amount"].ToString();
            //report.DataSource = "SELECT * FROM [SETS].[dbo].[view_FullExamineeResultsWithQuestions] ";// where actualtestid in(" + Session["selected"] + ") ORDER BY LastFirstMiddle ASC"; //WHERE ActualTestID IN ({0}) {1}ORDER BY LastFirstMiddle ASC";
            string selectedIDs = Request["txtselected"].ToString();
            string conditions  = "";

            if (Request["AnswerFilter"].ToString() != "2")  // "" in sets desktop..empty space causes error in view
            {
                conditions = String.Format("AND Answer {0} UserAns ", ((Request["AnswerFilter"].ToString()) == "0") ? "!=": "=");
            }

            //sql from report class. which from desktop sets
            string sql = String.Format("SELECT * FROM view_FullExamineeResultsWithQuestions where SiteID in (" + GlobalVar.SiteID + ") and ActualTestID IN ({0}) {1}ORDER BY LastFirstMiddle ASC", selectedIDs, conditions);


            string        constr = ConfigurationManager.ConnectionStrings["dbconn"].ToString();
            SqlConnection _con   = new SqlConnection(constr);

            //SqlDataAdapter _da = new SqlDataAdapter("SELECT * FROM [SETS].[dbo].[view_FullExamineeResultsWithQuestions] where actualtestid in(" + Session["selected"] + ") ORDER BY LastFirstMiddle ASC", _con);
            //SqlDataAdapter _da = new SqlDataAdapter("SELECT * FROM [SETS].[dbo].[view_FullExamineeResultsWithQuestions] where actualtestid in(" + Request["txtselected"].ToString() + ") ORDER BY LastFirstMiddle ASC", _con);
            SqlDataAdapter _da = new SqlDataAdapter(sql, _con);

            DataSet ds = new DataSet();

            _da.Fill(ds);
            MainReport.DataMember = ds.Tables[0].TableName;
            MainReport.DataSource = ds;

            //return PartialView("~/Views/rptIndiTestResult/_DocumentViewer1Partial.cshtml", report);
            //return PartialView("~/Views/ReportMain/ReportFilters/_DocumentViewerPartial.cshtml", report);
            //return PartialView("_DocumentViewer1Partial", report);

            //--- !Declaration of controls in report's designer.cs should all be public change from private
            ViewBag.selection              = Request["teFirstName"];
            MainReport.txtPrintDate.Text   = "Print Date: " + DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt");
            MainReport.txtCompanyName.Text = Util.GetConfig("COMPANY_NAME");
            MainReport.pbLogo.ImageUrl     = Util.GetReportLogoPath();
            MainReport.txtRptTitle.Text    = Util.GetConfig("APP_ABBRV") + " " + MainReport.txtRptTitle.Text;

            GroupField item = new GroupField();

            item.FieldName = "ActualTestID";
            item.SortOrder = XRColumnSortOrder.Ascending;
            MainReport.ActualTestHeader.GroupFields.Add(item);
            MainReport.SubjectName.DataBindings.Add("Text", null, "ActualTestID");

            item           = new GroupField();
            item.FieldName = "SubjectName";
            item.SortOrder = XRColumnSortOrder.Ascending;
            MainReport.SubjectNameHeader.GroupFields.Add(item);
            MainReport.SubjectName.DataBindings.Add("Text", null, "SubjectName");

            DataTable dt = ds.Tables[0];

            for (int i = 0; i <= dt.Columns.Count - 1; i++)
            {
                XRControl cell = MainReport.FindControl(dt.Columns[i].ColumnName, true);
                if (cell != null)
                {
                    cell.DataBindings.Add("Text", null, dt.Columns[i].ColumnName);
                }
            }


            return(PartialView("_DocumentViewer1Partial", MainReport));
        }
Example #46
0
        private void simpleButtonPreview_Click(object sender, EventArgs e)
        {
            // if (Int32.Parse(_data.DrTable["RpType"].ToString()) == 2)
            //   gridViewReport.ActiveFilterString = "InBaoCao = 1";

            DevExpress.XtraReports.UI.XtraReport rptTmp = null;
            string  reportFile, title;
            DataRow dr = null;

            if (lcisysFormReport.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Always)
            {
                DataTable dtFormReport = lookUpEditsysFormReport.Properties.DataSource as DataTable;
                dr         = dtFormReport.Rows[lookUpEditsysFormReport.ItemIndex];
                reportFile = checkEditNgoaiTe.Checked ? dr["ReportFile2"].ToString() : dr["ReportFile"].ToString();
                title      = checkEditNgoaiTe.Checked ? dr["ReportName2"].ToString() : dr["ReportName"].ToString();
                if (dr["FileName"] != DBNull.Value)
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream(dr["FileName"] as byte[]);
                    rptTmp = XtraReport.FromStream(ms, true);
                }
            }
            else
            {
                reportFile = checkEditNgoaiTe.Checked ? _data.DrTable["ReportFile2"].ToString() : _data.DrTable["ReportFile"].ToString();
                title      = checkEditNgoaiTe.Checked ? _data.DrTable["ReportName2"].ToString() : _data.DrTable["ReportName"].ToString();
            }

            string path = "";

            if (Config.GetValue("DuongDanBaoCao") != null)
            {
                path = Config.GetValue("DuongDanBaoCao").ToString() + "\\" + Config.GetValue("Package").ToString() + "\\" + reportFile + ".repx";
            }
            else
            {
                if (!System.IO.File.Exists(path))
                {
                    path = Application.StartupPath + "\\Reports\\" + Config.GetValue("Package").ToString() + "\\" + reportFile + ".repx";
                }
            }
            if (rptTmp == null)
            {
                if (System.IO.File.Exists(path))
                {
                    rptTmp = DevExpress.XtraReports.UI.XtraReport.FromFile(path, true);
                    //update vào fileName trên database
                    if (dr != null)
                    {
                        System.IO.Stream stream   = System.IO.File.OpenRead(path);
                        FileStream       fs       = new FileStream(path, FileMode.Open, FileAccess.Read);
                        BinaryReader     br       = new BinaryReader(fs);
                        long             numBytes = new FileInfo(path).Length;
                        dr["FileName"] = br.ReadBytes((int)numBytes);
                        _data.UpdateReportFile(dr);
                    }
                    rptTmp.DataSource = gridViewReport.DataSource;
                    if (Int32.Parse(_data.DrTable["RpType"].ToString()) == 2)
                    {
                        (rptTmp.DataSource as DataView).RowFilter = "InBaoCao = 1";
                    }
                    XRControl xrcTitle = rptTmp.FindControl("title", true);
                    if (xrcTitle != null)
                    {
                        xrcTitle.Text = title;
                    }

                    SetVariables(rptTmp);
                    rptTmp.ScriptReferences = new string[] { Application.StartupPath + "\\CDTLib.dll" };
                    rptTmp.ShowPreviewDialog();
                }
                else
                {
                    ShowDefaultReport(this.gridControlReport, false);
                }
            }
            else
            {
                rptTmp.DataSource = gridViewReport.DataSource;
                if (Int32.Parse(_data.DrTable["RpType"].ToString()) == 2)
                {
                    (rptTmp.DataSource as DataView).RowFilter = "InBaoCao = 1";
                }
                XRControl xrcTitle = rptTmp.FindControl("title", true);
                if (xrcTitle != null)
                {
                    xrcTitle.Text = title;
                }

                SetVariables(rptTmp);
                rptTmp.ScriptReferences = new string[] { Application.StartupPath + "\\CDTLib.dll" };
                rptTmp.ShowPreviewDialog();
            }
            //gridControlReport.ShowPrintPreview();
            if (Int32.Parse(_data.DrTable["RpType"].ToString()) == 2)
            {
                gridViewReport.ActiveFilterString = "";
            }
        }
        private float CalculateWidth(XRControl control)
        {
            XtraReport report = control.RootReport;

            return(GraphicsUnitConverter.Convert(report.PageWidth - report.Margins.Left - report.Margins.Right, report.Dpi, GraphicsDpi.HundredthsOfAnInch));
        }
Example #48
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DateTime giovao;
            DateTime giora;

            if (checkEdit1.Checked)
            {
                labelControl1.Text = DateTime.Now.ToString();
                labelControl2.Text = DateTime.Now.AddMinutes(70).ToString();
                giovao             = DateTime.Now;
                giora = DateTime.Now.AddMinutes(70);
            }
            else
            {
                labelControl1.Text = DateTime.Now.ToString();
                labelControl2.Text = DateTime.Now.AddMinutes(45).ToString();
                giovao             = DateTime.Now;
                giora = DateTime.Now.AddMinutes(45);
            }
            DevExpress.XtraReports.UI.XtraReport rptTmp = null;
            string path = "";

            if (Config.GetValue("DuongDanBaoCao") != null)
            {
                path = Config.GetValue("DuongDanBaoCao").ToString() + "\\" + Config.GetValue("Package").ToString() + "\\MassageTicket.repx";
            }
            else
            {
                path = Application.StartupPath + "\\Reports\\" + Config.GetValue("Package").ToString() + "\\MassageTicket.repx";
            }
            if (System.IO.File.Exists(path))
            {
                rptTmp = DevExpress.XtraReports.UI.XtraReport.FromFile(path, true);
                //rptTmp.DataSource = gridViewReport.DataSource;
                XRControl xrcTitle = rptTmp.FindControl("title", true);

                XRControl xrc = rptTmp.FindControl("Giovao", true);
                if (xrc != null)
                {
                    xrc.Text = this.labelControl1.Text;
                }
                XRControl xrc1 = rptTmp.FindControl("Giora", true);
                if (xrc1 != null)
                {
                    xrc1.Text = this.labelControl2.Text;
                }
                XRControl xrc2 = rptTmp.FindControl("Gia", true);
                if (xrc2 != null)
                {
                    xrc2.Text = int.Parse(this.textEdit1.Text).ToString("### ### ###");
                }

                rptTmp.ScriptReferences = new string[] { Application.StartupPath + "\\CDTLib.dll" };
                rptTmp.PrintDialog();
                Database db = Database.NewDataDatabase();
                try
                {
                    db.UpdateDatabyStore("MassageStore", new string[] { "Giovao", "Giora", "Gia" },
                                         new object[] { giovao, giora, double.Parse(textEdit1.Text) });
                }
                catch { }
            }
        }
 private void PublishScopedMessage(XRControl control)
 {
     var hashcode = control.NavigateToMyReportBase().RootHashCode;
     var message = new ScopedXRControlBeforePrintMessage(hashcode, control);
     _eventAggregator.Publish(message);
 }
Example #50
0
        public ActionResult DocumentViewerPartial()
        {
            string selectedIDs = Request["txtselected"].ToString();

            IDictionary <string, string> previewcriteria = new Dictionary <string, string>();

            previewcriteria.Add("PositionID", Request["PositionID"].ToString());
            previewcriteria.Add("VesselTypeID", Request["VesselTypeID"].ToString());
            previewcriteria.Add("TestName", Request["TestName"].ToString());
            previewcriteria.Add("CompanyName", Request["CompanyName"].ToString());
            previewcriteria.Add("FromDate", Request["deFromDate"].ToString());
            previewcriteria.Add("ToDate", Request["deToDate"].ToString());


            string filterCriteria = ApplyCriteria(previewcriteria);

            //string sql = String.Format(
            //"SELECT *, CAST((CAST(UserScore AS FLOAT) / TotalScore) * 100 AS FLOAT) TotalPercent, " +
            //    "CONCAT(CONVERT(DECIMAL(10,2), CAST((CAST(UserScore AS FLOAT) / TotalScore) * 100 AS FLOAT)), ' % (', UserScore, '/', TotalScore, ')') SubjectScore " +
            //"FROM (" +
            //    "SELECT SubjectID, LastFirstMiddle, PositionID, RankName, DateTaken, TestID, TestName, TestStatusName, SubjectName, CompanyName, COUNT(CASE WHEN IsCorrect = 1 THEN 1 ELSE NULL END) UserScore, COUNT(Answer) TotalScore " +
            //    "FROM view_FullExamineeResultsWithQuestions " +
            //    "GROUP BY SubjectID, LastFirstMiddle, PositionID, RankName, DateTaken, TestID, TestName, TestStatusName, SubjectName, CompanyName" +
            //    ") T WHERE SubjectID IN ({0}) {1}", selectedIDs, filterCriteria !=""? " And " + filterCriteria:""); //SubjectName to SubjectID...

            string sql = String.Format(
                "SELECT *, CAST((CAST(UserScore AS FLOAT) / TotalScore) * 100 AS FLOAT) TotalPercent, " +
                "CONCAT(CONVERT(DECIMAL(10,2), CAST((CAST(UserScore AS FLOAT) / TotalScore) * 100 AS FLOAT)), ' % (', UserScore, '/', TotalScore, ')') SubjectScore " +
                "FROM (" +
                "SELECT SubjectID, LastFirstMiddle, PositionID, RankName, DateTaken, TestID, TestName, TestStatusName, SubjectName, CompanyName, COUNT(CASE WHEN IsCorrect = 1 THEN 1 ELSE NULL END) UserScore, COUNT(Answer) TotalScore " +
                "FROM (select * from view_FullExamineeResultsWithQuestions where SiteID in (" + GlobalVar.SiteID + ")) vfe " +
                "GROUP BY SubjectID, LastFirstMiddle, PositionID, RankName, DateTaken, TestID, TestName, TestStatusName, SubjectName, CompanyName" +
                ") T WHERE SubjectID IN ({0}) {1}", selectedIDs, filterCriteria != "" ? " And " + filterCriteria : ""); //SubjectName to SubjectID...

            string        constr = ConfigurationManager.ConnectionStrings["dbconn"].ToString();
            SqlConnection _con   = new SqlConnection(constr);

            SqlDataAdapter _da = new SqlDataAdapter(sql, _con);

            DataSet ds = new DataSet();

            _da.Fill(ds);
            MainReport.DataMember = ds.Tables[0].TableName;
            MainReport.DataSource = ds;

            ViewBag.selection              = Request["teFirstName"];
            MainReport.txtPrintDate.Text   = "Print Date: " + DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt");
            MainReport.txtCompanyName.Text = Util.GetConfig("COMPANY_NAME");
            MainReport.pbLogo.ImageUrl     = Util.GetReportLogoPath();
            MainReport.txtRptTitle.Text    = Util.GetConfig("APP_ABBRV") + " " + MainReport.txtRptTitle.Text;

            MainReport.SubjectHeader.GroupFields.Add(new GroupField("SubjectName", Request["rgSortOrder"] == "ASC" ? XRColumnSortOrder.Ascending : XRColumnSortOrder.Descending));
            MainReport.Detail.SortFields.Add(new GroupField(Request["SortReportBy"], Request["rptSortdOrder"] == "ASC" ? XRColumnSortOrder.Ascending : XRColumnSortOrder.Descending));

            MainReport.SubjectName.DataBindings.Add("Text", null, "SubjectName");
            MainReport.txtAvgScore.DataBindings.Add("Text", null, "TotalPercent");
            MainReport.lblAvgScore.DataBindings.Add("Text", null, "TestName");

            DataTable dt = ds.Tables[0];

            for (int i = 0; i <= dt.Columns.Count - 1; i++)
            {
                XRControl cell = MainReport.FindControl(dt.Columns[i].ColumnName, true);
                if (cell != null)
                {
                    cell.DataBindings.Add("Text", null, dt.Columns[i].ColumnName);
                }
            }

            MainReport.txtAvgScore.DataBindings.Add("Text", null, "TotalPercent");

            return(PartialView("_DocumentViewer1Partial", MainReport));
        }
Example #51
0
 public static void ApplyStoreDayStyle(XRControl control, StoreDay storeDay)
 {
     if (storeDay == null || storeDay.ClosedDay)
     {
         control.BackColor = Color.LightGray;
     }
     else if (storeDay.Feast)
     {
         control.BackColor = Color.LightGreen;
     }
 }