private void frmDictamenSustitucion_Load(object sender, EventArgs e)
        {
            try {
                lblfecha.Text = DateTime.Now.ToLongDateString();

                GroupDescriptor Entidades = new GroupDescriptor();
                Entidades.GroupNames.Add("ENT_Nombre", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Entidades);

                GroupDescriptor Grupo = new GroupDescriptor();
                Grupo.GroupNames.Add("ENT_Nombre", ListSortDirection.Ascending);
                this.gvDictamen.GroupDescriptors.Add(Grupo);

                ConditionalFormattingObject obj = new ConditionalFormattingObject("MyCondition", ConditionTypes.Greater, "30", "", true);
                obj.CellForeColor       = Color.White;
                obj.CellBackColor       = Color.RoyalBlue;
                obj.ApplyOnSelectedRows = true;
                this.gvDatos.Columns["Estado"].ConditionalFormattingObjectList.Add(obj);

                LimpiarCampos();
                CargarSolicitudes();
                this.docSustitucion.Select();
            } catch (Exception) {
                throw;
            }
        }
Ejemplo n.º 2
0
        private void MyTimer_Tick(object sender, EventArgs e)
        {
            this.ProductsRadGridView.TableElement.Text            = string.Empty;
            this.ProductsRadGridView.TableElement.BackgroundImage = null;
            FillProductsRadGridView();
            if (ProductsRadGridView.Rows.Count == 0)
            {
                this.ProductsRadGridView.TableElement.Text = "Producto(s) no encontrado(s)..";
            }
            this.MyTimer.Stop();
            ConditionalFormattingObject objFormat =
                new ConditionalFormattingObject("MyCondiction", ConditionTypes.Equal, "0", "", true);

            objFormat.CellForeColor = Color.Red;
            objFormat.RowBackColor  = Color.SkyBlue;
            this.ProductsRadGridView.Columns["Stock"]
            .ConditionalFormattingObjectList
            .Add(objFormat);
            GridViewSummaryItem summaryItem = new GridViewSummaryItem("ProductCode", "Producto(s) Reg. {0}", GridAggregateFunction.Count);



            GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();

            summaryRowItem.Add(summaryItem);

            ProductsRadGridView.SummaryRowsTop.Add(summaryRowItem);
        }
Ejemplo n.º 3
0
        private void SetConditions()
        {
            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Light Sea Green, applied to entire row", ConditionTypes.Less, "0", "", true);

            c1.RowBackColor = Color.LawnGreen;
            radGridView1.Columns["K100"].ConditionalFormattingObjectList.Add(c1);
            ConditionalFormattingObject c3 = new ConditionalFormattingObject("Light Sea Green, applied to entire row", ConditionTypes.Less, "0", "", true);

            c3.RowBackColor = Color.LawnGreen;
            radGridView1.Columns["K98"].ConditionalFormattingObjectList.Add(c3);
            //Pecah
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Light Sea Green, applied to cell only", ConditionTypes.Greater, "0", "", false);

            c2.CellBackColor = Color.LightCoral;
            radGridView1.Columns["PECAH"].ConditionalFormattingObjectList.Add(c2);
            //Sumbing
            ConditionalFormattingObject c4 = new ConditionalFormattingObject("Corn Flower Blue, applied to cell only", ConditionTypes.Greater, "0", "", false);

            c4.CellBackColor = Color.CornflowerBlue;
            radGridView1.Columns["SUMBING"].ConditionalFormattingObjectList.Add(c4);
            //Total
            ConditionalFormattingObject c5 = new ConditionalFormattingObject("Corn Flower Blue, applied to cell only", ConditionTypes.Greater, "0", "", false);

            c5.CellBackColor = Color.LightBlue;
            radGridView2.Columns["Total"].ConditionalFormattingObjectList.Add(c5);
        }
        public static void SetRadGridViewStyle(RadGridView gridView, int setType, int colIndex, double threshold, double curVal)
        {
            ConditionalFormattingObject obj = null;

            if (setType == 1)//正常颜色
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.None, "", "", true);
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else//错误提示
            {
                if (threshold > curVal)
                {
                    obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Less, $"{threshold}", "", true);
                    obj.CellBackColor = Color.Red;
                    obj.TextAlignment = ContentAlignment.MiddleCenter;
                }
                else
                {
                    obj = new ConditionalFormattingObject("myCondition", ConditionTypes.None, "", "", true);
                    obj.TextAlignment = ContentAlignment.MiddleCenter;
                }
            }
            gridView.Columns[colIndex].ConditionalFormattingObjectList.Add(obj);
        }
Ejemplo n.º 5
0
        private void SetConditions()
        {
            //Tukar
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Light Sea Green, applied to entire row", ConditionTypes.Equal, "1", "", true);

            c2.RowBackColor = Color.LightSeaGreen;
            radGridView5.Columns["statusid"].ConditionalFormattingObjectList.Add(c2);
        }
Ejemplo n.º 6
0
        private void SetConditions()
        {
            //Keluar
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Light Salmon, applied to entire row", ConditionTypes.Equal, "0", "", true);

            c2.RowBackColor = Color.LightSalmon;
            radGridView1.Columns["category"].ConditionalFormattingObjectList.Add(c2);
        }
Ejemplo n.º 7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Green, applied to entire row", ConditionTypes.Equal, "", "", true);

            c1.RowBackColor  = Color.LightBlue;
            c1.CellBackColor = Color.LightBlue;
            radGridViewExtended.Columns["Column1"].ConditionalFormattingObjectList.Add(c1);
        }
Ejemplo n.º 8
0
        private void SetConditions()
        {
            //Kemarin
            ConditionalFormattingObject c4 = new ConditionalFormattingObject("Light Blue, applied to entire row", ConditionTypes.Less, dtpTanggal.Value.ToString("dd MMM yy"), "", true);

            c4.RowBackColor = Color.LightBlue;
            radGridView1.Columns["created"].ConditionalFormattingObjectList.Clear();
            radGridView1.Columns["created"].ConditionalFormattingObjectList.Add(c4);
        }
        public static void SetRadGridViewStyle(RadGridView gridView, int columnCount, GridViewRecordEnum viewRecordEnum)
        {
            ConditionalFormattingObject obj = null;

            if (viewRecordEnum == GridViewRecordEnum.Normal)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "", "", true);
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.Qualification)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "合格", "", true);
                obj.CellBackColor = Color.LawnGreen;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.Disqualification)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "不合格", "", true);
                obj.CellBackColor = Color.Red;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.Conduction)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "导通", "", true);
                obj.CellBackColor = Color.LawnGreen;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.UnConduction)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "不导通", "", true);
                obj.CellBackColor = Color.Red;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.OpenCircuit)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, "开路", "", true);
                obj.CellBackColor = Color.OrangeRed;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
            }
            else if (viewRecordEnum == GridViewRecordEnum.CurrentRow)
            {
                obj = new ConditionalFormattingObject("myCondition", ConditionTypes.NotEqual, "", "", true);
                obj.CellBackColor = Color.Red;
                obj.TextAlignment = ContentAlignment.MiddleCenter;
                for (int i = 0; i < gridView.ColumnCount; i++)
                {
                    gridView.Columns[i].ConditionalFormattingObjectList.Add(obj);
                }
            }
            gridView.Columns[columnCount].ConditionalFormattingObjectList.Add(obj);
        }
        private void SetConditions()
        {
            //add a couple of sample formatting objects
            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Red", ConditionTypes.Equal, "London", "", true);

            c1.RowBackColor = Color.FromArgb(255, 153, 0);
            c1.RowForeColor = Color.Black;
            radGridView1.Columns["City"].ConditionalFormattingObjectList.Add(c1);

            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Green", ConditionTypes.Equal, "Berlin", "", true);

            c2.RowBackColor = Color.FromArgb(165, 244, 36);
            c2.RowForeColor = Color.Black;
            radGridView1.Columns["City"].ConditionalFormattingObjectList.Add(c2);
        }
Ejemplo n.º 11
0
 private void frmNuevoPuesto_Load(object sender, EventArgs e)
 {
     try {
         LimpiarCampos();
         CargarDeptos();
         CargarEntidades();
         CargarNuevosPuestos();
         ConditionalFormattingObject obj = new ConditionalFormattingObject("MyCondition", ConditionTypes.Greater, "30", "", true);
         obj.CellForeColor       = Color.White;
         obj.CellBackColor       = Color.RoyalBlue;
         obj.ApplyOnSelectedRows = true;
         this.gvDatos.Columns["Estado"].ConditionalFormattingObjectList.Add(obj);
     } catch (Exception) {
         throw;
     }
 }
Ejemplo n.º 12
0
        private void frmDictamenNuevoP_Load(object sender, EventArgs e)
        {
            try {
                CargarNuevosPuestos();
                lblfecha.Text = DateTime.Now.ToLongDateString();

                ConditionalFormattingObject obj = new ConditionalFormattingObject("MyCondition", ConditionTypes.Greater, "30", "", true);
                obj.CellForeColor       = Color.White;
                obj.CellBackColor       = Color.RoyalBlue;
                obj.ApplyOnSelectedRows = true;
                this.gvDatos.Columns["Estado"].ConditionalFormattingObjectList.Add(obj);
                this.DockNuevoP.Select();
            } catch (Exception) {
                throw;
            }
        }
Ejemplo n.º 13
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (this.DesignMode)
            {
                return;
            }
            fieldInfo.FillData();
            RefreshData();

            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Green, applied to entire row", ConditionTypes.Equal, "14", "", true);

            c1.RowBackColor  = Color.FromArgb(219, 251, 91);
            c1.CellBackColor = Color.FromArgb(219, 251, 91);
            radGridView.Columns["FieldTypeCode"].ConditionalFormattingObjectList.Add(c1);
        }
 public static void SetGridViewRowStyle(RadGridView gridView, int colIndex, string content)
 {
     foreach (var rowInfo in gridView.Rows)
     {
         if (rowInfo.Cells[colIndex].Value.ToString() == content)
         {
             ConditionalFormattingObject obj = new ConditionalFormattingObject("myCondition", ConditionTypes.Equal, content, "", true);
             obj.CellBackColor = Color.LawnGreen;
             obj.TextAlignment = ContentAlignment.MiddleCenter;
             for (int i = 0; i < gridView.ColumnCount; i++)
             {
                 gridView.Columns[i].ConditionalFormattingObjectList.Add(obj);//多线程中使用时,要释放已添加的对象,否则会导致内存增加问题
             }
         }
     }
 }
Ejemplo n.º 15
0
        private void SetConditions()
        {
            //Mesin
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Light Sea Green, applied to entire row", ConditionTypes.Equal, "6", "", true);

            c2.RowBackColor = Color.LightSeaGreen;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c2);
            //Borongan
            ConditionalFormattingObject c3 = new ConditionalFormattingObject("Light Yellow, applied to entire row", ConditionTypes.Equal, "7", "", true);

            c3.RowBackColor = Color.LightSteelBlue;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c3);
            //Meja
            ConditionalFormattingObject c4 = new ConditionalFormattingObject("Corn Flower Blue, applied to entire row", ConditionTypes.Equal, "8", "", true);

            c4.RowBackColor = Color.CornflowerBlue;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c4);
        }
Ejemplo n.º 16
0
        private void SetConditions()
        {
            //add a couple of sample formatting objects
            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Orange, applied to entire row", ConditionTypes.Equal, "Germany", "", true);

            c1.RowBackColor  = Color.FromArgb(255, 209, 140);
            c1.CellBackColor = Color.FromArgb(255, 209, 140);
            //c1.RowForeColor = Color.Black;
            radGridView1.Columns["Country"].ConditionalFormattingObjectList.Add(c1);

            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Green, applied to cells only", ConditionTypes.Equal, "France", "", false);

            c2.RowBackColor = Color.FromArgb(219, 251, 91);
            //c2.RowForeColor = Color.Black;
            c2.CellBackColor = Color.FromArgb(219, 251, 91);
            radGridView1.Columns["Country"].ConditionalFormattingObjectList.Add(c2);

            //update the grid view for the conditional formatting to take effect
            //radGridView1.TableElement.Update(false);
        }
Ejemplo n.º 17
0
        private void SetConditions()
        {
            ConditionalFormattingObject c3 = new ConditionalFormattingObject("Grey, applied to cell", ConditionTypes.NotEqual, "Germany", "", false);

            c3.RowBackColor  = Color.FromArgb(169, 183, 201);
            c3.CellBackColor = Color.FromArgb(169, 183, 201);
            this.radGridView.Columns["Country"].ConditionalFormattingObjectList.Add(c3);

            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Blue , applied to cell", ConditionTypes.Equal, "Germany", "", false);

            c1.RowBackColor  = Color.FromArgb(163, 191, 226);
            c1.CellBackColor = Color.FromArgb(163, 191, 226);
            this.radGridView.Columns["Country"].ConditionalFormattingObjectList.Add(c1);

            ConditionalFormattingObject c2 = new ConditionalFormattingObject("LightPurple, applied to cell", ConditionTypes.Equal, "France", "", false);

            c2.RowBackColor  = Color.FromArgb(212, 210, 241);
            c2.CellBackColor = Color.FromArgb(212, 210, 241);
            this.radGridView.Columns["Country"].ConditionalFormattingObjectList.Add(c2);
        }
Ejemplo n.º 18
0
        private void frmSolicitud_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor Entidades = new GroupDescriptor();
                Entidades.GroupNames.Add("ENT_Nombre", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Entidades);

                ConditionalFormattingObject obj = new ConditionalFormattingObject("MyCondition", ConditionTypes.Greater, "30", "", true);
                obj.CellForeColor       = Color.White;
                obj.CellBackColor       = Color.RoyalBlue;
                obj.ApplyOnSelectedRows = true;
                this.gvDatos.Columns["Estado"].ConditionalFormattingObjectList.Add(obj);

                LimpiarCampos();
                CargarEntidades();
                CargarTiposContrato();
                CargarSolicitudes();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Ejemplo n.º 19
0
        private void SetConditions()
        {
            //Pecah
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Light Sea Green, applied to entire row", ConditionTypes.Equal, "2", "", true);

            c2.RowBackColor = Color.LightSeaGreen;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c2);
            //Rusak
            ConditionalFormattingObject c3 = new ConditionalFormattingObject("Light Yellow, applied to entire row", ConditionTypes.Equal, "3", "", true);

            c3.RowBackColor = Color.LightSteelBlue;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c3);
            //Sumbing
            ConditionalFormattingObject c4 = new ConditionalFormattingObject("Corn Flower Blue, applied to entire row", ConditionTypes.Equal, "4", "", true);

            c4.RowBackColor = Color.CornflowerBlue;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c4);
            //Expire
            ConditionalFormattingObject c5 = new ConditionalFormattingObject("Purple, applied to entire row", ConditionTypes.Equal, "5", "", true);

            c5.RowBackColor = Color.MediumPurple;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c5);
        }
Ejemplo n.º 20
0
        private void SetConditions()
        {
            //Pecah
            ConditionalFormattingObject c1 = new ConditionalFormattingObject("Yellow, applied to entire row", ConditionTypes.Equal, "2", "", true);

            c1.RowBackColor  = Color.Yellow;
            c1.CellBackColor = Color.Yellow;
            //c1.RowForeColor = Color.Black;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c1);
            //Rusak
            ConditionalFormattingObject c2 = new ConditionalFormattingObject("Green, applied to entire row", ConditionTypes.Equal, "3", "", true);

            c2.RowBackColor = Color.Red;
            //c2.RowForeColor = Color.Black;
            c2.CellBackColor = Color.Red;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c2);
            ConditionalFormattingObject c3 = new ConditionalFormattingObject("Orange, applied to entire row", ConditionTypes.Equal, "5", "", true);

            c3.RowBackColor = Color.Orange;
            //c2.RowForeColor = Color.Black;
            c3.CellBackColor = Color.Orange;
            radGridView1.Columns["status"].ConditionalFormattingObjectList.Add(c3);
            //update the grid view for the conditional formatting to take effect
        }
        public static void SetRadGridViewProperty(RadGridView gridView, bool allowAddNewRow, bool IsReadOnly, int columnCount)
        {
            gridView.EnableGrouping  = false;
            gridView.AllowDrop       = true;
            gridView.AllowRowReorder = true;
            //显示新行
            gridView.AddNewRowPosition   = SystemRowPosition.Bottom;
            gridView.ShowRowHeaderColumn = true;
            gridView.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            //radGridView.AutoSizeRows = true;
            //gridView.MasterTemplate.BestFitColumns();
            //gridView.ColumnChooserSortOrder = RadSortOrder.Ascending;
            //dgv.AllowRowHeaderContextMenu = false;
            gridView.ShowGroupPanel = false;
            gridView.MasterTemplate.EnableGrouping     = false;
            gridView.MasterTemplate.AllowAddNewRow     = allowAddNewRow;
            gridView.EnableHotTracking                 = true;
            gridView.MasterTemplate.SelectLastAddedRow = false;
            gridView.ReadOnly = IsReadOnly;
            //radRadioDataReader.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
            //this.radGridView1.CurrentRow = this.radGridView1.Rows[0];//设置某行为当前行
            //radGridView.Rows[0].Cells[0].Style.ForeColor;
            //gridView.AutoScroll = true;
            ConditionalFormattingObject obj = new ConditionalFormattingObject("myCondition", ConditionTypes.NotEqual, "", "", true);

            //obj.CellBackColor = Color.DeepSkyBlue;
            //obj.CellForeColor = Color.Red;
            obj.TextAlignment = ContentAlignment.MiddleCenter;
            if (columnCount > 0)
            {
                for (int i = 0; i < columnCount; i++)
                {
                    gridView.Columns[i].ConditionalFormattingObjectList.Add(obj);
                }
            }
        }
        private void FormatGrid()
        {
            GridViewCheckBoxColumn cb = new GridViewCheckBoxColumn();

            cb.Name     = "Check";
            cb.Width    = 80;
            cb.ReadOnly = false;
            grdLister.Columns.Add(cb);

            GridViewTextBoxColumn col = new GridViewTextBoxColumn();

            col.Name      = COLS.Id;
            col.IsVisible = false;
            grdLister.Columns.Add(col);

            col           = new GridViewTextBoxColumn();
            col.Name      = COLS.TranId;
            col.IsVisible = false;
            grdLister.Columns.Add(col);


            col            = new GridViewTextBoxColumn();
            col.Name       = COLS.Active;
            col.HeaderText = "Active/Off";
            col.Width      = 110;
            col.ReadOnly   = true;
            grdLister.Columns.Add(col);


            col            = new GridViewTextBoxColumn();
            col.Name       = COLS.DriverNo;
            col.HeaderText = "Driver";
            col.Width      = 100;
            col.ReadOnly   = true;
            grdLister.Columns.Add(col);

            col           = new GridViewTextBoxColumn();
            col.Name      = COLS.DriverName;
            col.IsVisible = false;
            grdLister.Columns.Add(col);

            // Rent/Comm Column

            GridViewDecimalColumn dcol = new GridViewDecimalColumn();

            dcol.Name                    = COLS.Rent;
            dcol.HeaderText              = "Rent/Comm";
            dcol.Width                   = 100;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);


            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidRent;
            dcol.HeaderText              = "Paid Rent/Comm";
            dcol.Width                   = 100;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);



            // Prev Rent/Comm Column

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PreviousBalance;
            dcol.HeaderText              = "Prev Rent/Comm";
            dcol.Width                   = 160;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidPreviousBalance;
            dcol.HeaderText              = "Paid Prev Rent/Comm";
            dcol.Width                   = 160;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);



            // Collection Column

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.Collection;
            dcol.HeaderText              = COLS.Collection;
            dcol.Width                   = 100;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            grdLister.Columns.Add(dcol);



            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidCollection;
            dcol.HeaderText              = COLS.PaidCollection;
            dcol.Width                   = 120;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            grdLister.Columns.Add(dcol);



            // Old Collection Column

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.OldCollection;
            dcol.HeaderText              = "Prev Collection";
            dcol.Width                   = 120;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            grdLister.Columns.Add(dcol);



            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.OldPaidCollection;
            dcol.HeaderText              = COLS.OldPaidCollection;
            dcol.Width                   = 120;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            grdLister.Columns.Add(dcol);



            // Agent Commission Column


            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.AgentCommission;
            dcol.HeaderText              = "Agent Comm";
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.Width                   = 110;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            grdLister.Columns.Add(dcol);



            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidAgentCommission;
            dcol.HeaderText              = "Paid Agent Comm";
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.Width                   = 140;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            grdLister.Columns.Add(dcol);



            // Previous Agent Commission Column

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.OldAgentBalance;
            dcol.HeaderText              = "Prev Agent Comm";
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.Width                   = 150;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            grdLister.Columns.Add(dcol);


            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidOldAgentBalance;
            dcol.HeaderText              = "Paid Prev Agent Comm";
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            dcol.Width                   = 170;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            grdLister.Columns.Add(dcol);



            // Adjustments Column

            dcol               = new GridViewDecimalColumn();
            dcol.Name          = COLS.Adjustment;
            dcol.HeaderText    = "Adjustment";
            dcol.Width         = 100;
            dcol.DecimalPlaces = 2;
            dcol.ReadOnly      = false;
            grdLister.Columns.Add(dcol);


            dcol               = new GridViewDecimalColumn();
            dcol.Name          = COLS.PaidAdjustment;
            dcol.HeaderText    = "Paid Adjustment";
            dcol.Width         = 100;
            dcol.DecimalPlaces = 2;
            dcol.ReadOnly      = false;
            dcol.IsVisible     = false;
            grdLister.Columns.Add(dcol);



            // old adjustments column
            dcol               = new GridViewDecimalColumn();
            dcol.Name          = COLS.OldAdjustment;
            dcol.HeaderText    = "Prev Adj.";
            dcol.Width         = 70;
            dcol.DecimalPlaces = 2;
            dcol.ReadOnly      = false;
            grdLister.Columns.Add(dcol);


            dcol               = new GridViewDecimalColumn();
            dcol.Name          = COLS.OldPaidAdjustment;
            dcol.HeaderText    = "Prev Paid Adjustment";
            dcol.Width         = 100;
            dcol.DecimalPlaces = 2;
            dcol.ReadOnly      = false;
            dcol.IsVisible     = false;
            grdLister.Columns.Add(dcol);



            // Total COlumn

            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.Total;
            dcol.HeaderText              = "Total";
            dcol.Width                   = 100;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);


            dcol                         = new GridViewDecimalColumn();
            dcol.Name                    = COLS.PaidTotal;
            dcol.HeaderText              = "Paid Total";
            dcol.Width                   = 100;
            dcol.DecimalPlaces           = 2;
            dcol.ReadOnly                = true;
            dcol.IsVisible               = false;
            dcol.ExcelExportType         = DisplayFormatType.Text;
            dcol.ExcelExportFormatString = "{0:d}";
            grdLister.Columns.Add(dcol);



            GridViewCheckBoxColumn cbcol = new GridViewCheckBoxColumn();

            cbcol.Name       = COLS.IsPaid;
            cbcol.HeaderText = "Paid";
            cbcol.Width      = 100;
            grdLister.Columns.Add(cbcol);


            col            = new GridViewTextBoxColumn();
            col.Name       = COLS.Paid;
            col.HeaderText = COLS.Paid;
            col.Width      = 100;
            col.ReadOnly   = true;
            grdLister.Columns.Add(col);


            GridViewDateTimeColumn dtCol = new GridViewDateTimeColumn();

            dtCol.Name       = COLS.FromDate;
            dtCol.HeaderText = COLS.FromDate;
            dtCol.Width      = 120;
            dtCol.ReadOnly   = true;
            dtCol.IsVisible  = false;
            grdLister.Columns.Add(dtCol);


            dtCol            = new GridViewDateTimeColumn();
            dtCol.Name       = COLS.ToDate;
            dtCol.HeaderText = COLS.ToDate;
            dtCol.Width      = 120;
            dtCol.ReadOnly   = true;
            dtCol.IsVisible  = false;
            grdLister.Columns.Add(dtCol);



            GridViewCommandColumn cmdcol = new GridViewCommandColumn();

            cmdcol.Width          = 80;
            cmdcol.Name           = "btnDelete";
            cmdcol.UseDefaultText = true;
            cmdcol.ImageLayout    = System.Windows.Forms.ImageLayout.Center;
            cmdcol.DefaultText    = "Delete";
            cmdcol.TextAlignment  = System.Drawing.ContentAlignment.MiddleCenter;
            grdLister.Columns.Add(cmdcol);



            ConditionalFormattingObject obj = new ConditionalFormattingObject();

            obj.RowBackColor  = Color.LightGreen;
            obj.TValue1       = "Paid";
            obj.ConditionType = ConditionTypes.Equal;
            obj.TValue2       = string.Empty;
            obj.RowForeColor  = Color.Black;
            obj.ApplyToRow    = true;

            grdLister.Columns[COLS.Paid].ConditionalFormattingObjectList.Add(obj);


            ConditionalFormattingObject obj2 = new ConditionalFormattingObject();

            obj2.TValue1       = "(C)";
            obj2.ConditionType = ConditionTypes.EndsWith;
            obj2.TValue2       = string.Empty;
            obj2.CellForeColor = Color.White;
            obj2.CellBackColor = Color.Red;
            obj2.ApplyToRow    = false;
            grdLister.Columns[COLS.DriverNo].ConditionalFormattingObjectList.Add(obj2);
        }
        private void FormatGrid()
        {
            GridViewTextBoxColumn col = new GridViewTextBoxColumn();

            col.Name       = "BookingReference";
            col.HeaderText = " Ref #";
            col.FieldName  = "Booking Reference";
            col.WrapText   = true;
            col.Width      = 70;
            grdBookings.Columns.Add(col);


            col           = new GridViewTextBoxColumn();
            col.Name      = COLS.ID;
            col.IsVisible = false;

            grdBookings.Columns.Add(col);


            GridViewDateTimeColumn colDate = new GridViewDateTimeColumn();

            colDate.Name         = "PickupDateTime";
            colDate.WrapText     = true;
            colDate.HeaderText   = "Pickup Date-Time";
            colDate.Width        = 140;
            colDate.FieldName    = "Pickup Time";
            colDate.CustomFormat = "dd/MM/yyyy HH:mm";
            colDate.FormatString = "{0:dd/MM/yyyy HH:mm}";
            grdBookings.Columns.Add(colDate);


            GridViewComboBoxColumn colCombo = new GridViewComboBoxColumn();

            colCombo.Name          = "VehicleType";
            colCombo.HeaderText    = "Vehicle";
            colCombo.FieldName     = "Vehicle Class";
            colCombo.DataSource    = General.GetQueryable <Fleet_VehicleType>(null).OrderBy(c => c.OrderNo).ToList();
            colCombo.DisplayMember = "VehicleType";
            colCombo.ValueMember   = "Id";
            colCombo.Width         = 80;
            col.WrapText           = true;
            grdBookings.Columns.Add(colCombo);


            col            = new GridViewTextBoxColumn();
            col.Name       = "PhoneNo";
            col.HeaderText = "Phone No";
            col.Width      = 120;
            col.WrapText   = true;
            col.FieldName  = "Phone";
            grdBookings.Columns.Add(col);


            col            = new GridViewTextBoxColumn();
            col.Name       = "Passenger";
            col.HeaderText = "Passenger";
            col.FieldName  = "Passenger Name";
            col.WrapText   = true;
            col.Width      = 100;
            grdBookings.Columns.Add(col);



            col      = new GridViewTextBoxColumn();
            col.Name = "From";

            col.HeaderText = "Pickup Point";
            col.FieldName  = "0";
            col.WrapText   = true;

            col.Width = 130;
            grdBookings.Columns.Add(col);



            col            = new GridViewTextBoxColumn();
            col.Name       = "To";
            col.WrapText   = true;
            col.HeaderText = "Destination";
            col.Width      = 130;
            col.FieldName  = "1";
            grdBookings.Columns.Add(col);


            col           = new GridViewTextBoxColumn();
            col.Name      = "Notes";
            col.WrapText  = true;
            col.FieldName = "Driver Notes";

            col.HeaderText = "Notes";
            col.Width      = 120;
            grdBookings.Columns.Add(col);


            col            = new GridViewTextBoxColumn();
            col.Name       = "Account";
            col.HeaderText = "Account";
            col.FieldName  = "Booking Account";
            col.WrapText   = true;
            col.Width      = 120;
            grdBookings.Columns.Add(col);


            //GridViewDecimalColumn colDec = new GridViewDecimalColumn();
            //colDec.Name = "Fare";
            //colDec.FieldName = "Pricing";

            //colDec.DecimalPlaces = 2;
            //colDec.Minimum = 0;
            //colDec.Maximum = 999999;
            //colDec.HeaderText = "Fare";
            //colDec.Width = 60;
            //grdBookings.Columns.Add(colDec);



            //col = new GridViewTextBoxColumn();
            //col.Name = "PaymentType";
            //col.WrapText = true;
            //col.FieldName = "Card";

            //col.HeaderText = "Payment";
            //col.Width = 100;

            //grdBookings.Columns.Add(col);


            col           = new GridViewTextBoxColumn();
            col.Name      = "Via";
            col.WrapText  = true;
            col.FieldName = "Via";

            col.HeaderText = "Via Point";
            col.Width      = 100;

            grdBookings.Columns.Add(col);



            col           = new GridViewTextBoxColumn();
            col.Name      = "FlightNo";
            col.WrapText  = true;
            col.FieldName = "FlightNo";

            col.HeaderText = "Flight No";
            col.Width      = 100;

            grdBookings.Columns.Add(col);



            ConditionalFormattingObject objSave = new ConditionalFormattingObject();

            objSave.ApplyToRow    = true;
            objSave.RowBackColor  = Color.LightGreen;
            objSave.ConditionType = ConditionTypes.Greater;
            objSave.TValue1       = "0";
            grdBookings.Columns[COLS.ID].ConditionalFormattingObjectList.Add(objSave);


            ConditionalFormattingObject objError = new ConditionalFormattingObject();

            objError.ApplyToRow    = true;
            objError.RowBackColor  = Color.Pink;
            objError.ConditionType = ConditionTypes.Equal;
            objError.TValue1       = "0";
            grdBookings.Columns[COLS.ID].ConditionalFormattingObjectList.Add(objError);



            grdBookings.AddDeleteColumn();
            grdBookings.Columns["btnDelete"].PinPosition = PinnedColumnPosition.Right;
            grdBookings.Columns["btnDelete"].IsPinned    = true;
            grdBookings.Columns["btnDelete"].Width       = 70;


            grdBookings.CommandCellClick += new CommandCellClickEventHandler(grdBookings_CommandCellClick);
        }
Ejemplo n.º 24
0
        private void FormatCell()
        {
            // Order No
            ConditionalFormattingObject objOrderNo = new ConditionalFormattingObject("OrderNoCondition", ConditionTypes.NotEqual, "", "", false);

            objOrderNo.CellForeColor = Color.Blue;

            this.radGridView.Columns[0].ConditionalFormattingObjectList.Add(objOrderNo);

            // Order Status
            ConditionalFormattingObject objOrderStatus1 = new ConditionalFormattingObject("objOrderStatus1", ConditionTypes.Equal,
                                                                                          Constants.OrderStatusDraft, string.Empty, false);

            objOrderStatus1.CellBackColor = Color.Red;
            objOrderStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderStatus2 = new ConditionalFormattingObject("objOrderStatus2", ConditionTypes.Equal,
                                                                                          Constants.OrderStatusDelivered, string.Empty, false);

            objOrderStatus2.CellBackColor = Color.Green;
            objOrderStatus2.CellForeColor = Color.White;
            this.radGridView.Columns[3].ConditionalFormattingObjectList.Add(objOrderStatus1);
            this.radGridView.Columns[3].ConditionalFormattingObjectList.Add(objOrderStatus2);

            // Order SMS
            ConditionalFormattingObject objOrderSms1 = new ConditionalFormattingObject("objOrderSms1", ConditionTypes.Equal,
                                                                                       Constants.OrderSms1, string.Empty, false);

            objOrderSms1.CellBackColor = Color.Orange;
            objOrderSms1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms2 = new ConditionalFormattingObject("objOrderSms2", ConditionTypes.Equal,
                                                                                       Constants.OrderSms2, string.Empty, false);

            objOrderSms2.CellBackColor = Color.Green;
            objOrderSms2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms3 = new ConditionalFormattingObject("objOrderSms3", ConditionTypes.Equal,
                                                                                       Constants.OrderSms3, string.Empty, false);

            objOrderSms3.CellBackColor = Color.Red;
            objOrderSms3.CellForeColor = Color.White;


            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms1);
            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms2);
            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms3);

            // Order Email
            ConditionalFormattingObject objOrderEmail1 = new ConditionalFormattingObject("objOrderEmail1", ConditionTypes.Equal,
                                                                                         Constants.OrderEmail1, string.Empty, false);

            objOrderEmail1.CellBackColor = Color.Orange;
            objOrderEmail1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail2 = new ConditionalFormattingObject("objOrderEmail2", ConditionTypes.Equal,
                                                                                         Constants.OrderEmail2, string.Empty, false);

            objOrderEmail2.CellBackColor = Color.Green;
            objOrderEmail2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail3 = new ConditionalFormattingObject("objOrderEmail3", ConditionTypes.Equal,
                                                                                         Constants.OrderEmail3, string.Empty, false);

            objOrderEmail3.CellBackColor = Color.Red;
            objOrderEmail3.CellForeColor = Color.White;


            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail1);
            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail2);
            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail3);

            // Order Report
            ConditionalFormattingObject objOrderReport1 = new ConditionalFormattingObject("objOrderReport1", ConditionTypes.Equal,
                                                                                          Constants.OrderReport1, string.Empty, false);

            objOrderReport1.CellBackColor = Color.Orange;
            objOrderReport1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport2 = new ConditionalFormattingObject("objOrderReport2", ConditionTypes.Equal,
                                                                                          Constants.OrderReport2, string.Empty, false);

            objOrderReport2.CellBackColor = Color.Green;
            objOrderReport2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport3 = new ConditionalFormattingObject("objOrderReport3", ConditionTypes.Equal,
                                                                                          Constants.OrderReport3, string.Empty, false);

            objOrderReport3.CellBackColor = Color.Red;
            objOrderReport3.CellForeColor = Color.White;


            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport1);
            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport2);
            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport3);
        }
        private void PopulateData(long groupId, long selectedJobId)
        {
            try
            {
                var objGroup = General.GetObject <BookingGroup>(c => c.Id == groupId);


                if (objGroup != null)
                {
                    if (grdGroupDetails.Rows.Count == 0)
                    {
                        grdGroupDetails.Rows.AddNew();
                    }



                    grdGroupDetails.Rows[0].Cells["Id"].Value              = objGroup.Id;
                    grdGroupDetails.Rows[0].Cells["GroupName"].Value       = objGroup.GroupName;
                    grdGroupDetails.Rows[0].Cells["FlightDeparture"].Value = objGroup.FlightDepartureDate;
                    grdGroupDetails.Rows[0].Cells["Destination"].Value     = objGroup.Gen_Location.DefaultIfEmpty().LocationName;
                    grdGroupDetails.Rows[0].Cells["DestinationId"].Value   = objGroup.DestinationId;

                    grdGroupDetails.Rows[0].Cells["Zone"].Value       = objGroup.Gen_ShuttleZone.DefaultIfEmpty().ZoneName.ToStr();
                    grdGroupDetails.Rows[0].Cells["TotalSeats"].Value = objGroup.NoOfSeats.ToInt();
                    grdGroupDetails.Rows[0].Cells["AvailSeats"].Value = objGroup.NoOfSeats.ToInt() - objGroup.Bookings.Sum(c => c.NoofPassengers).ToInt();


                    grdGroupDetails.Rows[0].Cells["TotalJobs"].Value = objGroup.Bookings.Count;
                    grdGroupDetails.Rows[0].Cells["Status"].Value    = objGroup.BookingTripStatus.DefaultIfEmpty().StatusName.ToStr();



                    if (objGroup.FlightDepartureDate == null)
                    {
                        grdGroupDetails.Columns["FlightDeparture"].IsVisible = false;
                        grdGroupDetails.Columns["Destination"].Width         = 420;
                    }


                    var jobs = (from a in General.GetQueryable <Booking>(c => c.GroupJobId == groupId)
                                select new
                    {
                        Id = a.Id,
                        RefNo = a.BookingNo,
                        Passenger = a.CustomerName,
                        PickupDateTime = a.PickupDateTime,
                        PickupPoint = a.FromAddress,
                        Status = a.BookingStatus.StatusName,
                        Drv = a.Fleet_Driver != null ? a.Fleet_Driver.DriverNo : "",
                        TotalPax = a.NoofPassengers
                    }
                                ).ToList();



                    grdJobDetails.RowCount = jobs.Count;

                    for (int i = 0; i < grdJobDetails.RowCount; i++)
                    {
                        grdJobDetails.Rows[i].Cells["Id"].Value             = jobs[i].Id;
                        grdJobDetails.Rows[i].Cells["Passenger"].Value      = jobs[i].Passenger.ToStr();
                        grdJobDetails.Rows[i].Cells["PickupDateTime"].Value = jobs[i].PickupDateTime;
                        grdJobDetails.Rows[i].Cells["PickupPoint"].Value    = jobs[i].PickupPoint;
                        grdJobDetails.Rows[i].Cells["NoOfPax"].Value        = jobs[i].TotalPax.ToInt();
                        grdJobDetails.Rows[i].Cells["Drv"].Value            = jobs[i].Drv;
                        grdJobDetails.Rows[i].Cells["Status"].Value         = jobs[i].Status;
                    }



                    if (grdJobDetails.RowCount > 0 && this.SelectedJobId > 0)
                    {
                        ConditionalFormattingObject objCondition = new ConditionalFormattingObject();
                        objCondition.ApplyToRow    = true;
                        objCondition.RowBackColor  = Color.LightGreen;
                        objCondition.ConditionType = ConditionTypes.Equal;
                        objCondition.TValue1       = selectedJobId.ToStr();

                        grdJobDetails.Columns["Id"].ConditionalFormattingObjectList.Add(objCondition);

                        grdJobDetails.ContextMenuOpening += new ContextMenuOpeningEventHandler(grdJobDetails_ContextMenuOpening);
                    }
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Ejemplo n.º 26
0
        private void FormatCell()
        {
            // Order No
            ConditionalFormattingObject objOrderNo = new ConditionalFormattingObject("OrderNoCondition", ConditionTypes.NotEqual, "", "", false);
            objOrderNo.CellForeColor = Color.Blue;

            this.radGridView.Columns[0].ConditionalFormattingObjectList.Add(objOrderNo);

            // Order Status
            ConditionalFormattingObject objOrderStatus1 = new ConditionalFormattingObject("objOrderStatus1", ConditionTypes.Equal,
                Constants.OrderStatusDraft, string.Empty, false);
            objOrderStatus1.CellBackColor = Color.Red;
            objOrderStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderStatus2 = new ConditionalFormattingObject("objOrderStatus2", ConditionTypes.Equal,
                Constants.OrderStatusDelivered, string.Empty, false);
            objOrderStatus2.CellBackColor = Color.Green;
            objOrderStatus2.CellForeColor = Color.White;
            this.radGridView.Columns[3].ConditionalFormattingObjectList.Add(objOrderStatus1);
            this.radGridView.Columns[3].ConditionalFormattingObjectList.Add(objOrderStatus2);

            // Order SMS
            ConditionalFormattingObject objOrderSms1 = new ConditionalFormattingObject("objOrderSms1", ConditionTypes.Equal,
                Constants.OrderSms1, string.Empty, false);
            objOrderSms1.CellBackColor = Color.Orange;
            objOrderSms1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms2 = new ConditionalFormattingObject("objOrderSms2", ConditionTypes.Equal,
                Constants.OrderSms2, string.Empty, false);
            objOrderSms2.CellBackColor = Color.Green;
            objOrderSms2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms3 = new ConditionalFormattingObject("objOrderSms3", ConditionTypes.Equal,
                Constants.OrderSms3, string.Empty, false);
            objOrderSms3.CellBackColor = Color.Red;
            objOrderSms3.CellForeColor = Color.White;

            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms1);
            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms2);
            this.radGridView.Columns[6].ConditionalFormattingObjectList.Add(objOrderSms3);

            // Order Email
            ConditionalFormattingObject objOrderEmail1 = new ConditionalFormattingObject("objOrderEmail1", ConditionTypes.Equal,
                Constants.OrderEmail1, string.Empty, false);
            objOrderEmail1.CellBackColor = Color.Orange;
            objOrderEmail1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail2 = new ConditionalFormattingObject("objOrderEmail2", ConditionTypes.Equal,
                Constants.OrderEmail2, string.Empty, false);
            objOrderEmail2.CellBackColor = Color.Green;
            objOrderEmail2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail3 = new ConditionalFormattingObject("objOrderEmail3", ConditionTypes.Equal,
                Constants.OrderEmail3, string.Empty, false);
            objOrderEmail3.CellBackColor = Color.Red;
            objOrderEmail3.CellForeColor = Color.White;

            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail1);
            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail2);
            this.radGridView.Columns[5].ConditionalFormattingObjectList.Add(objOrderEmail3);

            // Order Report
            ConditionalFormattingObject objOrderReport1 = new ConditionalFormattingObject("objOrderReport1", ConditionTypes.Equal,
                Constants.OrderReport1, string.Empty, false);
            objOrderReport1.CellBackColor = Color.Orange;
            objOrderReport1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport2 = new ConditionalFormattingObject("objOrderReport2", ConditionTypes.Equal,
                Constants.OrderReport2, string.Empty, false);
            objOrderReport2.CellBackColor = Color.Green;
            objOrderReport2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport3 = new ConditionalFormattingObject("objOrderReport3", ConditionTypes.Equal,
                Constants.OrderReport3, string.Empty, false);
            objOrderReport3.CellBackColor = Color.Red;
            objOrderReport3.CellForeColor = Color.White;

            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport1);
            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport2);
            this.radGridView.Columns[7].ConditionalFormattingObjectList.Add(objOrderReport3);
        }
Ejemplo n.º 27
0
        private void FormatDataGrid()
        {
            try
            {
                Telerik.WinControls.UI.Localization.RadGridLocalizationProvider.CurrentProvider = new Infrastructure.WinForms.Controls.MySpanishRadGridLocalizationProvider();
                this.grdItems.Columns.Clear();
                this.grdItems.AllowAddNewRow = false;

                Telerik.WinControls.UI.GridViewCheckBoxColumn _Seleccionar = new Telerik.WinControls.UI.GridViewCheckBoxColumn();
                _Seleccionar.Name       = "Seleccionar";
                _Seleccionar.HeaderText = "Seleccionar";
                _Seleccionar.FieldName  = "Seleccionar";
                _Seleccionar.ReadOnly   = false;
                this.grdItems.Columns.Add(_Seleccionar);
                this.grdItems.Columns["Seleccionar"].ReadOnly = false;

                this.grdItems.Columns.Add("TIPO_TDO", "Tipo", "TIPO_TDO");
                this.grdItems.Columns.Add("CCCT_Serie", "Serie", "CCCT_Serie");
                this.grdItems.Columns.Add("CCCT_Numero", "Número", "CCCT_Numero");
                this.grdItems.Columns.Add("CCCT_FechaEmision", "Fecha Emisión", "CCCT_FechaEmision");
                this.grdItems.Columns.Add("OV_OP", "OV / OP", "OV_OP");
                this.grdItems.Columns.Add("FEmbarque", "Fecha de Embarque / Zarpe", "FEmbarque");
                this.grdItems.Columns.Add("FechaETA", "Fecha ETA", "FechaETA");
                this.grdItems.Columns.Add("NAVE_Nombre", "Nave Viaje", "NAVE_Nombre");
                this.grdItems.Columns.Add("DOOV_MBL", "MBL", "DOOV_MBL");
                this.grdItems.Columns.Add("DOOV_HBL", "HBL", "DOOV_HBL");
                this.grdItems.Columns.Add("UNegocio", "Uni. Negocio", "UNegocio");
                this.grdItems.Columns.Add("TIPO_MND", "Moneda", "TIPO_MND");
                this.grdItems.Columns.Add("CCCT_Pendiente_Cargo", "Ingreso", "CCCT_Pendiente_Cargo");
                this.grdItems.Columns.Add("CCCT_Pendiente_Abono", "Egreso", "CCCT_Pendiente_Abono");
                Telerik.WinControls.UI.GridViewCheckBoxColumn _conciliado = new Telerik.WinControls.UI.GridViewCheckBoxColumn();
                _conciliado.Name       = "Conciliado";
                _conciliado.HeaderText = "Conciliado";
                _conciliado.FieldName  = "Conciliado";
                this.grdItems.Columns.Add(_conciliado);
                this.grdItems.Columns.Add("CONC_FecConciliacion", "Fec. Conciliación", "CONC_FecConciliacion");
                this.grdItems.Columns.Add("CCCT_Codigo", "Transacción", "CCCT_Codigo");
                this.grdItems.Columns.Add("ObservacionesConciliacion", "Observaciones", "ObservacionesConciliacion");
                this.grdItems.Columns.Add("ConciliadoError", "Conciliacion", "ConciliadoError");
                this.grdItems.Columns.Add("PagoMNDOriginal", "Monto Referencial", "PagoMNDOriginal");


                this.grdItems.Columns["CCCT_FechaEmision"].FormatString     = "{0:dd/MM/yyyy}";
                this.grdItems.Columns["FEmbarque"].FormatString             = "{0:dd/MM/yyyy}";
                this.grdItems.Columns["FechaETA"].FormatString              = "{0:dd/MM/yyyy}";
                this.grdItems.Columns["CCCT_Pendiente_Cargo"].FormatString  = "{0:#,###,##0.00}";
                this.grdItems.Columns["CCCT_Pendiente_Abono"].FormatString  = "{0:#,###,##0.00}";
                this.grdItems.Columns["CCCT_Pendiente_Cargo"].TextAlignment = ContentAlignment.MiddleRight;
                this.grdItems.Columns["CCCT_Pendiente_Abono"].TextAlignment = ContentAlignment.MiddleRight;
                this.grdItems.Columns["PagoMNDOriginal"].TextAlignment      = ContentAlignment.MiddleRight;

                this.grdItems.Columns["TIPO_TDO"].ReadOnly                   = true;
                this.grdItems.Columns["CCCT_Serie"].ReadOnly                 = true;
                this.grdItems.Columns["CCCT_Numero"].ReadOnly                = true;
                this.grdItems.Columns["CCCT_FechaEmision"].ReadOnly          = true;
                this.grdItems.Columns["OV_OP"].ReadOnly                      = true;
                this.grdItems.Columns["FEmbarque"].ReadOnly                  = true;
                this.grdItems.Columns["FechaETA"].ReadOnly                   = true;
                this.grdItems.Columns["NAVE_Nombre"].ReadOnly                = true;
                this.grdItems.Columns["DOOV_MBL"].ReadOnly                   = true;
                this.grdItems.Columns["DOOV_HBL"].ReadOnly                   = true;
                this.grdItems.Columns["UNegocio"].ReadOnly                   = true;
                this.grdItems.Columns["TIPO_MND"].ReadOnly                   = true;
                this.grdItems.Columns["Conciliado"].ReadOnly                 = true;
                this.grdItems.Columns["Conciliado"].IsVisible                = false;
                this.grdItems.Columns["CONC_FecConciliacion"].ReadOnly       = true;
                this.grdItems.Columns["CONC_FecConciliacion"].IsVisible      = false;
                this.grdItems.Columns["UNegocio"].IsVisible                  = false;
                this.grdItems.Columns["CCCT_Pendiente_Cargo"].ReadOnly       = true;
                this.grdItems.Columns["CCCT_Pendiente_Abono"].IsVisible      = true;
                this.grdItems.Columns["CCCT_Pendiente_Cargo"].ReadOnly       = true;
                this.grdItems.Columns["CCCT_Pendiente_Abono"].IsVisible      = true;
                this.grdItems.Columns["ObservacionesConciliacion"].ReadOnly  = true;
                this.grdItems.Columns["ObservacionesConciliacion"].IsVisible = false;
                this.grdItems.Columns["ObservacionesConciliacion"].Width     = 200;
                this.grdItems.Columns["ConciliadoError"].IsVisible           = false;
                this.grdItems.Columns["PagoMNDOriginal"].ReadOnly            = true;

                ConditionalFormattingObject c1 = new ConditionalFormattingObject("Orange, applied to entire row", ConditionTypes.Equal, "true", "", true);
                c1.RowBackColor  = Color.DarkBlue; // FromArgb(255, 91, 15, 2);
                c1.CellBackColor = Color.DarkBlue;
                c1.RowForeColor  = Color.White;
                grdItems.Columns["ConciliadoError"].ConditionalFormattingObjectList.Add(c1);

                Infrastructure.WinForms.Controls.GridAutoFit.Fit(grdItems);

                //grdItems.BestFitColumns();
                grdItems.Columns["Seleccionar"].Width    = 90;
                grdItems.Columns["Seleccionar"].ReadOnly = false;
                //grdItems.ReadOnly = false;
                //grdItems.ShowFilteringRow = false;
                //grdItems.EnableFiltering = false;
                //grdItems.MasterTemplate.EnableFiltering = false;
                //grdItems.EnableGrouping = false;
                //grdItems.MasterTemplate.EnableGrouping = false;
                //grdItems.EnableSorting = false;
                //grdItems.MasterTemplate.EnableCustomSorting = false;
                //grdItems.AllowColumnHeaderContextMenu = false;
                //grdItems.AllowCellContextMenu = false;
            }
            catch (Exception ex)
            { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Presenter.Title, Infrastructure.Aspect.Constants.Mensajes.FormatDataGridView, ex); }
        }
Ejemplo n.º 28
0
        private void ViewReport()
        {
            try
            {
                DataSource = FillDataSource();

                var list = (from a in DataSource
                            select new
                {
                    Sno = a.Sno,
                    Name = a.Name,
                    PhoneNumber = a.PhoneNo,
                    CallDateTime = a.CallDateTime,
                    Line = a.Line,
                    STN = a.STN,
                    Duration = a.Duration,
                    IsMissed = a.IsMissed,
                    Company = a.CompanyName
                }).ToList();

                lblTotalAnsweredCalls.Text = "Total Answered Calls : " + list.Where(c => c.STN.Length > 0).Count();
                lblTotalMissedCalls.Text   = "Total Missed Calls : " + list.Where(c => (c.STN == null || c.STN == "")).Count();
                lblTotalBookings.Text      = "Total Bookings : " + 0;
                grdCalls.DataSource        = list;



                if (this.objCLISettings.IsAnalog.ToBool())
                {
                    grdCalls.Columns["Line"].IsVisible     = true;
                    grdCalls.Columns["Line"].Width         = 50;
                    grdCalls.Columns["CallDateTime"].Width = 150;
                    grdCalls.Columns["Name"].Width         = 160;
                }

                else
                {
                    grdCalls.Columns["Line"].IsVisible     = false;
                    grdCalls.Columns["CallDateTime"].Width = 140;
                    grdCalls.Columns["Name"].Width         = 180;
                }


                if (this.objCLISettings.DigitalCLIType.ToInt() == 2)
                {
                    grdCalls.Columns["Line"].IsVisible     = true;
                    grdCalls.Columns["Line"].Width         = 40;
                    grdCalls.Columns["CallDateTime"].Width = 140;
                    grdCalls.Columns["Name"].Width         = 140;

                    grdCalls.Columns["Duration"].Width = 120;


                    if (IsDataLoaded == false)
                    {
                        this.Width = this.Width + 190;
                    }


                    //   btnMissedCalls.Visible = true;
                }
                else
                {
                    grdCalls.Columns["Sno"].IsVisible      = false;
                    grdCalls.Columns["STN"].IsVisible      = false;
                    grdCalls.Columns["Duration"].IsVisible = false;
                }



                if (this.objCLISettings.VOIPCLIType.ToInt() == 2 || this.objCLISettings.VOIPCLIType.ToInt() == 4)
                {
                    grdCalls.Columns["Line"].IsVisible     = true;
                    grdCalls.Columns["Duration"].IsVisible = false;
                    //  grdCalls.Columns["Recording"].IsVisible = true;
                }

                grdCalls.Columns["Sno"].Width     = 60;
                grdCalls.Columns["Company"].Width = 140;
                //grdCalls.Columns["CompanyName"].HeaderText = "Company";
                grdCalls.Columns["STN"].IsVisible          = true;
                grdCalls.Columns["PhoneNumber"].Width      = 120;
                grdCalls.Columns["PhoneNumber"].HeaderText = "Phone Number";

                (grdCalls.Columns["CallDateTime"] as GridViewDateTimeColumn).CustomFormat = "dd/MM/yyyy";
                grdCalls.Columns["CallDateTime"].HeaderText = "Call Date Time";

                grdCalls.Columns["IsMissed"].IsVisible = false;



                if (grdCalls.Columns["IsMissed"].ConditionalFormattingObjectList.Count == 0)
                {
                    ConditionalFormattingObject objMissedCondition = new ConditionalFormattingObject();
                    objMissedCondition.TValue1       = "1";
                    objMissedCondition.ApplyToRow    = true;
                    objMissedCondition.RowBackColor  = Color.LightPink;
                    objMissedCondition.ConditionType = ConditionTypes.Equal;

                    grdCalls.Columns["IsMissed"].ConditionalFormattingObjectList.Add(objMissedCondition);
                }


                if (this.objCLISettings != null && this.objCLISettings.VOIPCLIType.ToInt() == 4 && File.Exists(Application.StartupPath + "\\CabTreasureEmeraldCallRecording.exe"))
                {
                    btnMissedCalls.Visible = true;
                }

                IsDataLoaded = true;
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Ejemplo n.º 29
0
        public override void PopulateData()
        {
            if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
            {
                dtpFromDate.Value = null;
            }

            if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
            {
                dtpTillDate.Value = null;
            }

            DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
            DateTime?tillDate = dtpTillDate.Value.ToDateorNull();

            string phone = txtPhone.Text.Trim();
            string name  = ddlCustomer.Text.Trim().ToLower();

            string line = txtLine.Text.Trim();
            string stn  = txtSTN.Text.Trim();

            bool MissedCalls = optMissedCalls.Checked;

            string SubCompanyNo = string.Empty;

            int SubCompanyId = ddlSubCompanyId.SelectedValue.ToInt();

            if (SubCompanyId > 0)
            {
                using (TaxiDataContext dbX = new TaxiDataContext())
                {
                    SubCompanyNo = dbX.Gen_SubCompanies.FirstOrDefault(c => c.Id == SubCompanyId).ConnectionString;
                }


                if (string.IsNullOrEmpty(SubCompanyNo))
                {
                    grdCalls.Rows.Clear();;
                    MessageBox.Show("Sub Company CallerId Number is not defined");
                    return;
                    //  SubCompanyNo = null;
                }
            }
            else
            {
                SubCompanyNo = string.Empty;
            }



            TaxiDataContext db = new TaxiDataContext();

            var list = (from a in db.CallHistories
                        join b in db.Gen_SubCompanies on a.CalledToNumber equals b.ConnectionString into table2
                        from b in table2.DefaultIfEmpty()

                        where (fromDate == null || a.CallDateTime.Value.Date >= fromDate) &&
                        (tillDate == null || a.CallDateTime.Value.Date <= tillDate) &&
                        (name == string.Empty || a.Name.Trim().ToLower() == name) &&
                        (MissedCalls == false || (a.STN == null || a.STN == "")) &&
                        (phone == string.Empty || a.PhoneNumber.Trim() == phone) &&
                        (line == string.Empty || (a.Line != null && a.Line.Trim() == line)) &&
                        (stn == string.Empty || (a.STN != null && a.STN.Trim() == stn)) &&
                        (IsAccepted == true || (a.IsAccepted != null && a.IsAccepted == true)) &&
                        (SubCompanyNo == string.Empty || (a.CalledToNumber != null && a.CalledToNumber.Trim() == SubCompanyNo))
                        orderby a.CallDateTime descending
                        select new
            {
                Sno = a.Sno,
                Name = a.Name,
                PhoneNumber = a.PhoneNumber,
                CallDateTime = a.CallDateTime,
                Line = a.Line,
                STN = a.STN,
                Duration = a.CallDuration,
                IsMissed = (a.IsAccepted != null && a.IsAccepted == true) ? "1" : "0",
                Company = b != null && b.CompanyName != "" ? b.CompanyName : a.CalledToNumber
            }).ToList();

            //foreach (var item in list)
            //{
            //    //objTempCallHistory.Add(new TempCallHistory { Name = item.Name, PhoneNo = item.PhoneNumber, CallDateTime = item.CallDateTime, STN = item.STN, Line = item.Line, CompanyName = item.Company });
            //}

            db.Dispose();



            //var list2 = (from a in General.GetQueryable<CallHistory>(null)
            //            where (fromDate == null || a.CallDateTime.Value.Date >= fromDate)
            //             && (tillDate == null || a.CallDateTime.Value.Date <= tillDate)
            //             && (name == string.Empty || a.Name.ToStr().Trim().ToLower() == name)
            //             && (phone == string.Empty || a.PhoneNumber.Trim() == phone)
            //              && (line == string.Empty || (a.Line != null && a.Line.Trim() == line))
            //               && (stn == string.Empty || (a.STN != null && a.STN.Trim() == stn))
            //               && (IsAccepted == true || (a.IsAccepted != null && a.IsAccepted == true))
            //            orderby a.CallDateTime descending
            //            select new
            //            {
            //                Sno = a.Sno,
            //                Name = a.Name,
            //                PhoneNumber = a.PhoneNumber,
            //                CallDateTime = a.CallDateTime,
            //                Line = a.Line,
            //                STN = a.STN,
            //                Duration = a.CallDuration,
            //                IsMissed = (a.IsAccepted != null && a.IsAccepted == true) ? "1" : "0"
            //            }).ToList();

            lblTotalAnsweredCalls.Text = "Total Answered Calls : " + list.Where(c => c.STN.Length > 0).Count();
            lblTotalMissedCalls.Text   = "Total Missed Calls : " + list.Where(c => (c.STN == null || c.STN == "")).Count();
            lblTotalBookings.Text      = "Total Bookings : " + 0;
            grdCalls.DataSource        = list;



            if (this.objCLISettings.IsAnalog.ToBool())
            {
                grdCalls.Columns["Line"].IsVisible     = true;
                grdCalls.Columns["Line"].Width         = 50;
                grdCalls.Columns["CallDateTime"].Width = 160;
                grdCalls.Columns["Name"].Width         = 140;
            }

            else
            {
                grdCalls.Columns["Line"].IsVisible     = false;
                grdCalls.Columns["CallDateTime"].Width = 180;
                grdCalls.Columns["Name"].Width         = 140;
            }


            if (this.objCLISettings.DigitalCLIType.ToInt() == 2)
            {
                grdCalls.Columns["Line"].IsVisible     = true;
                grdCalls.Columns["Line"].Width         = 40;
                grdCalls.Columns["CallDateTime"].Width = 160;
                grdCalls.Columns["Name"].Width         = 140;

                grdCalls.Columns["Duration"].Width = 120;


                if (IsDataLoaded == false)
                {
                    this.Width = this.Width + 190;
                }


                //  btnMissedCalls.Visible = true;
            }
            else
            {
                grdCalls.Columns["Sno"].IsVisible      = false;
                grdCalls.Columns["STN"].IsVisible      = false;
                grdCalls.Columns["Duration"].IsVisible = false;
            }



            if (this.objCLISettings.VOIPCLIType.ToInt() == 2 || this.objCLISettings.VOIPCLIType.ToInt() == 4)
            {
                grdCalls.Columns["Line"].IsVisible      = true;
                grdCalls.Columns["Duration"].IsVisible  = false;
                grdCalls.Columns["Recording"].IsVisible = true;
            }

            grdCalls.Columns["Sno"].Width              = 60;
            grdCalls.Columns["CompanyName"].Width      = 140;
            grdCalls.Columns["CompanyName"].HeaderText = "Company";
            grdCalls.Columns["STN"].IsVisible          = true;
            grdCalls.Columns["PhoneNumber"].Width      = 120;
            grdCalls.Columns["PhoneNumber"].HeaderText = "Phone Number";

            (grdCalls.Columns["CallDateTime"] as GridViewDateTimeColumn).CustomFormat = "dd/MM/yyyy";
            grdCalls.Columns["CallDateTime"].HeaderText = "Call Date Time";

            grdCalls.Columns["IsMissed"].IsVisible = false;



            if (grdCalls.Columns["IsMissed"].ConditionalFormattingObjectList.Count == 0)
            {
                ConditionalFormattingObject objMissedCondition = new ConditionalFormattingObject();
                objMissedCondition.TValue1       = "1";
                objMissedCondition.ApplyToRow    = true;
                objMissedCondition.RowBackColor  = Color.LightPink;
                objMissedCondition.ConditionType = ConditionTypes.Equal;

                grdCalls.Columns["IsMissed"].ConditionalFormattingObjectList.Add(objMissedCondition);
            }


            if (this.objCLISettings != null && this.objCLISettings.VOIPCLIType.ToInt() == 4 && File.Exists(Application.StartupPath + "\\CabTreasureEmeraldCallRecording.exe"))
            {
                btnMissedCalls.Visible = true;
            }

            IsDataLoaded = true;
        }
Ejemplo n.º 30
0
        private void FormatCell()
        {
            // Delivery
            ConditionalFormattingObject objDeliveryNo = new ConditionalFormattingObject("DeliveryNoCondition", ConditionTypes.NotEqual, "", "", false);
            objDeliveryNo.CellForeColor = Color.Blue;

            this.radGridView.MasterTemplate.Columns["DeliveryNo"].ConditionalFormattingObjectList.Add(objDeliveryNo);

            ConditionalFormattingObject objDeliveryStatus1 = new ConditionalFormattingObject("DeliveryStatusCondition1", ConditionTypes.Equal,
                ECommon.Constants.DeliveryStatusDraft, string.Empty, false);
            objDeliveryStatus1.CellBackColor = Color.Orange;
            objDeliveryStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objDeliveryStatus2 = new ConditionalFormattingObject("DeliveryStatusCondition2", ConditionTypes.Equal,
                ECommon.Constants.DeliveryStatusDelivered, string.Empty, false);
            objDeliveryStatus2.CellBackColor = Color.Green;
            objDeliveryStatus2.CellForeColor = Color.White;

            this.radGridView.MasterTemplate.Columns["Status"].ConditionalFormattingObjectList.Add(objDeliveryStatus1);
            this.radGridView.MasterTemplate.Columns["Status"].ConditionalFormattingObjectList.Add(objDeliveryStatus2);

            // Order
            var template = this.radGridView.Templates[0];

            ConditionalFormattingObject objOrderNo = new ConditionalFormattingObject("OrderNoCondition", ConditionTypes.NotEqual, "", "", false);
            objOrderNo.CellForeColor = Color.Blue;
            template.Columns["OrderNo"].ConditionalFormattingObjectList.Add(objOrderNo);

            // Order Status
            ConditionalFormattingObject objOrderStatus1 = new ConditionalFormattingObject("objOrderStatus1", ConditionTypes.Equal,
                ECommon.Constants.OrderStatusDraft, string.Empty, false);
            objOrderStatus1.CellBackColor = Color.Red;
            objOrderStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderStatus2 = new ConditionalFormattingObject("objOrderStatus2", ConditionTypes.Equal,
                ECommon.Constants.OrderStatusDelivered, string.Empty, false);
            objOrderStatus2.CellBackColor = Color.Green;
            objOrderStatus2.CellForeColor = Color.White;
            template.Columns["Status"].ConditionalFormattingObjectList.Add(objOrderStatus1);
            template.Columns["Status"].ConditionalFormattingObjectList.Add(objOrderStatus2);

            // Order SMS
            ConditionalFormattingObject objOrderSms1 = new ConditionalFormattingObject("objOrderSms1", ConditionTypes.Equal,
                ECommon.Constants.OrderSms1, string.Empty, false);
            objOrderSms1.CellBackColor = Color.Orange;
            objOrderSms1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms2 = new ConditionalFormattingObject("objOrderSms2", ConditionTypes.Equal,
                ECommon.Constants.OrderSms2, string.Empty, false);
            objOrderSms2.CellBackColor = Color.Green;
            objOrderSms2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms3 = new ConditionalFormattingObject("objOrderSms3", ConditionTypes.Equal,
                ECommon.Constants.OrderSms3, string.Empty, false);
            objOrderSms3.CellBackColor = Color.Red;
            objOrderSms3.CellForeColor = Color.White;

            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms1);
            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms2);
            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms3);

            // Order Email
            ConditionalFormattingObject objOrderEmail1 = new ConditionalFormattingObject("objOrderEmail1", ConditionTypes.Equal,
                ECommon.Constants.OrderEmail1, string.Empty, false);
            objOrderEmail1.CellBackColor = Color.Orange;
            objOrderEmail1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail2 = new ConditionalFormattingObject("objOrderEmail2", ConditionTypes.Equal,
                ECommon.Constants.OrderEmail2, string.Empty, false);
            objOrderEmail2.CellBackColor = Color.Green;
            objOrderEmail2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail3 = new ConditionalFormattingObject("objOrderEmail3", ConditionTypes.Equal,
                ECommon.Constants.OrderEmail3, string.Empty, false);
            objOrderEmail3.CellBackColor = Color.Red;
            objOrderEmail3.CellForeColor = Color.White;

            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail1);
            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail2);
            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail3);

            // Order Report
            ConditionalFormattingObject objOrderReport1 = new ConditionalFormattingObject("objOrderReport1", ConditionTypes.Equal,
                ECommon.Constants.OrderReport1, string.Empty, false);
            objOrderReport1.CellBackColor = Color.Orange;
            objOrderReport1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport2 = new ConditionalFormattingObject("objOrderReport2", ConditionTypes.Equal,
                ECommon.Constants.OrderReport2, string.Empty, false);
            objOrderReport2.CellBackColor = Color.Green;
            objOrderReport2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport3 = new ConditionalFormattingObject("objOrderReport3", ConditionTypes.Equal,
                ECommon.Constants.OrderReport3, string.Empty, false);
            objOrderReport3.CellBackColor = Color.Red;
            objOrderReport3.CellForeColor = Color.White;

            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport1);
            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport2);
            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport3);
        }
        private void FormatChargesGrid()
        {
            GridViewTextBoxColumn col = new GridViewTextBoxColumn();

            col.IsVisible = false;
            col.Name      = "Id";
            grdLister.Columns.Add(col);

            col           = new GridViewTextBoxColumn();
            col.IsVisible = false;
            col.Name      = COLS.InvoiceId;
            grdLister.Columns.Add(col);

            col           = new GridViewTextBoxColumn();
            col.IsVisible = false;
            col.Name      = COLS.PaymentTypeId;
            grdLister.Columns.Add(col);


            col           = new GridViewTextBoxColumn();
            col.IsVisible = false;
            col.Name      = COLS.BookingId;
            grdLister.Columns.Add(col);

            GridViewDateTimeColumn colDt = new GridViewDateTimeColumn();

            colDt.Name       = "PickupDate";
            colDt.ReadOnly   = true;
            colDt.HeaderText = "Pickup Date-Time";
            grdLister.Columns.Add(colDt);



            col = new GridViewTextBoxColumn();
            // col.IsVisible = false;
            col.ReadOnly   = true;
            col.HeaderText = "Job #";
            col.Name       = "RefNumber";
            grdLister.Columns.Add(col);

            //col = new GridViewTextBoxColumn();
            // col.IsVisible = false;

            //col.HeaderText = "Order No";
            //col.Name = "OrderNo";

            //grdLister.Columns.Add(col);


            //col = new GridViewTextBoxColumn();
            //col.IsVisible = false;
            //col.HeaderText = "Pupil No";
            //col.Name = "PupilNo";
            //grdLister.Columns.Add(col);

            col = new GridViewTextBoxColumn();
            // col.IsVisible = false;
            col.HeaderText = "Vehicle";
            col.Name       = "Vehicle";
            col.ReadOnly   = true;
            grdLister.Columns.Add(col);


            //col = new GridViewTextBoxColumn();
            ////  col.IsVisible = false;
            //col.ReadOnly = true;
            //col.Name = COLS.Account;
            //col.HeaderText = COLS.Account;
            //grdLister.Columns.Add(col);



            col = new GridViewTextBoxColumn();
            // col.IsVisible = false;
            col.ReadOnly   = false;
            col.HeaderText = "Pickup Point";
            col.Name       = "PickupPoint";
            grdLister.Columns.Add(col);



            col = new GridViewTextBoxColumn();
            //     col.IsVisible = false;
            col.ReadOnly   = false;
            col.HeaderText = "Destination";
            col.Name       = "Destination";
            grdLister.Columns.Add(col);



            GridViewDecimalColumn colD = new GridViewDecimalColumn();

            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Charges";
            colD.Name          = "Charges";
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);

            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Parking";
            colD.Name          = "Parking";
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);


            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Waiting";
            colD.Name          = "Waiting";
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);


            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Extra Drop";
            colD.Name          = "ExtraDrop";
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);


            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Meet and Greet";
            colD.Name          = "MeetAndGreet";
            colD.IsVisible     = false;
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);


            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.HeaderText    = "Congestion";
            colD.Name          = "CongtionCharge";
            colD.Maximum       = 9999999;
            colD.IsVisible     = false;
            colD.FormatString  = "{0:#,###0.00}";
            grdLister.Columns.Add(colD);


            colD = new GridViewDecimalColumn();
            colD.DecimalPlaces = 2;
            colD.Minimum       = 0;
            colD.ReadOnly      = true;
            colD.HeaderText    = "Total";
            colD.Name          = "Total";
            colD.Maximum       = 9999999;
            colD.FormatString  = "{0:#,###0.00}";
            // colD.Expression = "Charges+Parking+Waiting+ExtraDrop+MeetAndGreet+CongtionCharge";
            colD.Expression = "Charges+Parking+Waiting+ExtraDrop";
            grdLister.Columns.Add(colD);

            //     grdLister.Columns["Id"].IsVisible = false;

            (grdLister.Columns["PickUpDate"] as GridViewDateTimeColumn).CustomFormat = "dd/MM/yyyy HH:mm";
            (grdLister.Columns["PickUpDate"] as GridViewDateTimeColumn).FormatString = "{0:dd/MM/yyyy HH:mm}";


            grdLister.Columns["PickUpDate"].Width = 105;
            grdLister.Columns["RefNumber"].Width  = 40;
            grdLister.Columns["Vehicle"].Width    = 50;
            //     grdLister.Columns[COLS.Account].Width = 60;
            grdLister.Columns["PickUpPoint"].Width = 170;
            grdLister.Columns["Destination"].Width = 170;

            grdLister.Columns["Charges"].Width        = 50;
            grdLister.Columns["Parking"].Width        = 45;
            grdLister.Columns["Waiting"].Width        = 50;
            grdLister.Columns["ExtraDrop"].Width      = 60;
            grdLister.Columns["MeetAndGreet"].Width   = 50;
            grdLister.Columns["CongtionCharge"].Width = 60;
            grdLister.Columns["Total"].Width          = 45;
            //      grdLister.Columns["OrderNo"].Width = 55;

            grdLister.Columns["PickUpDate"].HeaderText  = "Pickup Date-Time";
            grdLister.Columns["RefNumber"].HeaderText   = "Ref #";
            grdLister.Columns["PickUpPoint"].HeaderText = "Pickup Point";
            grdLister.Columns["ExtraDrop"].HeaderText   = "Congestion";

            grdLister.Columns["MeetAndGreet"].HeaderText   = "M & G";
            grdLister.Columns["CongtionCharge"].HeaderText = "Congestion";

            //grdLister.Columns["MeetAndGreet"].ReadOnly = false;
            //grdLister.Columns["CongtionCharge"].ReadOnly = false;
            //grdLister.Columns["Charge"].ReadOnly = false;
            //grdLister.Columns["Parking"].ReadOnly = false;
            //grdLister.Columns["Waiting"].ReadOnly = false;
            //grdLister.Columns["ExtraDrop"].ReadOnly = false;

            AddUpdateColumn(grdLister);


            ConditionalFormattingObject objPaid = new ConditionalFormattingObject();

            objPaid.ApplyToRow    = true;
            objPaid.RowBackColor  = Color.LightGreen;
            objPaid.ConditionType = ConditionTypes.Equal;
            objPaid.TValue1       = "6";
            objPaid.TValue2       = "2";
            grdLister.Columns["PaymentTypeId"].ConditionalFormattingObjectList.Add(objPaid);
        }
Ejemplo n.º 32
0
        private void FormatCell()
        {
            // Delivery
            ConditionalFormattingObject objDeliveryNo = new ConditionalFormattingObject("DeliveryNoCondition", ConditionTypes.NotEqual, "", "", false);

            objDeliveryNo.CellForeColor = Color.Blue;

            this.radGridView.MasterTemplate.Columns["DeliveryNo"].ConditionalFormattingObjectList.Add(objDeliveryNo);

            ConditionalFormattingObject objDeliveryStatus1 = new ConditionalFormattingObject("DeliveryStatusCondition1", ConditionTypes.Equal,
                                                                                             ECommon.Constants.DeliveryStatusDraft, string.Empty, false);

            objDeliveryStatus1.CellBackColor = Color.Orange;
            objDeliveryStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objDeliveryStatus2 = new ConditionalFormattingObject("DeliveryStatusCondition2", ConditionTypes.Equal,
                                                                                             ECommon.Constants.DeliveryStatusDelivered, string.Empty, false);

            objDeliveryStatus2.CellBackColor = Color.Green;
            objDeliveryStatus2.CellForeColor = Color.White;

            this.radGridView.MasterTemplate.Columns["Status"].ConditionalFormattingObjectList.Add(objDeliveryStatus1);
            this.radGridView.MasterTemplate.Columns["Status"].ConditionalFormattingObjectList.Add(objDeliveryStatus2);

            // Order
            var template = this.radGridView.Templates[0];

            ConditionalFormattingObject objOrderNo = new ConditionalFormattingObject("OrderNoCondition", ConditionTypes.NotEqual, "", "", false);

            objOrderNo.CellForeColor = Color.Blue;
            template.Columns["OrderNo"].ConditionalFormattingObjectList.Add(objOrderNo);

            // Order Status
            ConditionalFormattingObject objOrderStatus1 = new ConditionalFormattingObject("objOrderStatus1", ConditionTypes.Equal,
                                                                                          ECommon.Constants.OrderStatusDraft, string.Empty, false);

            objOrderStatus1.CellBackColor = Color.Red;
            objOrderStatus1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderStatus2 = new ConditionalFormattingObject("objOrderStatus2", ConditionTypes.Equal,
                                                                                          ECommon.Constants.OrderStatusDelivered, string.Empty, false);

            objOrderStatus2.CellBackColor = Color.Green;
            objOrderStatus2.CellForeColor = Color.White;
            template.Columns["Status"].ConditionalFormattingObjectList.Add(objOrderStatus1);
            template.Columns["Status"].ConditionalFormattingObjectList.Add(objOrderStatus2);

            // Order SMS
            ConditionalFormattingObject objOrderSms1 = new ConditionalFormattingObject("objOrderSms1", ConditionTypes.Equal,
                                                                                       ECommon.Constants.OrderSms1, string.Empty, false);

            objOrderSms1.CellBackColor = Color.Orange;
            objOrderSms1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms2 = new ConditionalFormattingObject("objOrderSms2", ConditionTypes.Equal,
                                                                                       ECommon.Constants.OrderSms2, string.Empty, false);

            objOrderSms2.CellBackColor = Color.Green;
            objOrderSms2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderSms3 = new ConditionalFormattingObject("objOrderSms3", ConditionTypes.Equal,
                                                                                       ECommon.Constants.OrderSms3, string.Empty, false);

            objOrderSms3.CellBackColor = Color.Red;
            objOrderSms3.CellForeColor = Color.White;


            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms1);
            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms2);
            template.Columns["SendMessage"].ConditionalFormattingObjectList.Add(objOrderSms3);

            // Order Email
            ConditionalFormattingObject objOrderEmail1 = new ConditionalFormattingObject("objOrderEmail1", ConditionTypes.Equal,
                                                                                         ECommon.Constants.OrderEmail1, string.Empty, false);

            objOrderEmail1.CellBackColor = Color.Orange;
            objOrderEmail1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail2 = new ConditionalFormattingObject("objOrderEmail2", ConditionTypes.Equal,
                                                                                         ECommon.Constants.OrderEmail2, string.Empty, false);

            objOrderEmail2.CellBackColor = Color.Green;
            objOrderEmail2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderEmail3 = new ConditionalFormattingObject("objOrderEmail3", ConditionTypes.Equal,
                                                                                         ECommon.Constants.OrderEmail3, string.Empty, false);

            objOrderEmail3.CellBackColor = Color.Red;
            objOrderEmail3.CellForeColor = Color.White;


            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail1);
            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail2);
            template.Columns["SendEmail"].ConditionalFormattingObjectList.Add(objOrderEmail3);

            // Order Report
            ConditionalFormattingObject objOrderReport1 = new ConditionalFormattingObject("objOrderReport1", ConditionTypes.Equal,
                                                                                          ECommon.Constants.OrderReport1, string.Empty, false);

            objOrderReport1.CellBackColor = Color.Orange;
            objOrderReport1.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport2 = new ConditionalFormattingObject("objOrderReport2", ConditionTypes.Equal,
                                                                                          ECommon.Constants.OrderReport2, string.Empty, false);

            objOrderReport2.CellBackColor = Color.Green;
            objOrderReport2.CellForeColor = Color.White;

            ConditionalFormattingObject objOrderReport3 = new ConditionalFormattingObject("objOrderReport3", ConditionTypes.Equal,
                                                                                          ECommon.Constants.OrderReport3, string.Empty, false);

            objOrderReport3.CellBackColor = Color.Red;
            objOrderReport3.CellForeColor = Color.White;


            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport1);
            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport2);
            template.Columns["SendReport"].ConditionalFormattingObjectList.Add(objOrderReport3);
        }