Beispiel #1
0
 // Calculate the Stock Value
 private void GrdControlViewCustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e == null) throw new ArgumentNullException("e");
     if (e.IsGetData)
     {
         var view = sender as ColumnView;
         if (view != null)
         {
             var itemDto = view.GetRow(e.RowHandle) as RentalItemDto;
             switch (e.Column.FieldName)
             {
                 case "Available":
                         decimal available = 0;
                         if (itemDto != null)
                         {
                             available = itemDto.Storages.Aggregate(available, (current, stock) => current + stock.Available);
                         }
                         e.Value = available;
                     break;
                 default:
                     break;
             }
         }
     }
 }
 private void CustomUnboundColumnDataMainView(object sender, CustomColumnDataEventArgs e)
 {
     try
     {
         e.Value = itogData[e.ListSourceRowIndex][e.Column.AbsoluteIndex];
     }
     catch { e.Value = string.Empty; }
 }
 private void CustomUnboundColumnDataViewSource(object sender, CustomColumnDataEventArgs e)
 {
     try
     {
         e.Value = sourceData.ElementAt(e.ListSourceRowIndex)[e.Column.AbsoluteIndex];
     }
     catch { e.Value = string.Empty; }
 }
 private void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == colCheck) {
         if (e.IsGetData)
             e.Value = selection[e.ListSourceRowIndex];
         else {
             selection[e.ListSourceRowIndex] = (bool)e.Value;
             UpdateLabel();
         }
     }
 }
 private void schemaView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == colSelected) {
         var schema = schemas[e.ListSourceRowIndex];
         if (e.IsGetData)
             e.Value = selectedSchemas.Contains(schema);
         else if (e.IsSetData) {
             if ((bool)e.Value)
                 selectedSchemas.Add(schema);
             else
                 selectedSchemas.Remove(schema);
         }
     }
 }
        private void CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (e.Column.AbsoluteIndex == 0)
            {
                long value = 0;
                string v = dataMetrixs[e.ListSourceRowIndex][e.Column.AbsoluteIndex].ToString();
                if (!Int64.TryParse(v, out value))
                {
                    value = -1;
                }
                e.Value = value == -1 ? v : value.ToString();
                return;
            }

            e.Value = dataMetrixs[e.ListSourceRowIndex][e.Column.AbsoluteIndex];
        }
Beispiel #7
0
 // Calculate the Stock Value
 private void GrdControlViewCustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e == null) throw new ArgumentNullException("e");
     if (e.Column.FieldName == "Stock" && e.IsGetData)
     {
         var view = sender as ColumnView;
         if (view != null)
         {
             var itemDto = view.GetRow(e.RowHandle) as ItemDto;
             decimal quantity = 0;
             if (itemDto != null)
             {
                 quantity = itemDto.Stocks.Aggregate(quantity, (current, stock) => current + stock.Quantity);
             }
             e.Value = quantity;
         }
     }
 }
 private void projectsGridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.IsGetData)
     {
         var project  = projectsDataSource[e.ListSourceRowIndex];
         var selected = project.Server.Projects.Contains(project);
         e.Value = selected;
     }
     else if (e.IsSetData)
     {
         var project  = projectsDataSource[e.ListSourceRowIndex];
         var selected = (bool)e.Value;
         if (selected)
         {
             ConfigurationService.AddProject(project);
         }
         else
         {
             ConfigurationService.RemoveProject(project);
         }
     }
 }
Beispiel #9
0
 private void schemaView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == colSelected)
     {
         var schema = schemas[e.ListSourceRowIndex];
         if (e.IsGetData)
         {
             e.Value = selectedSchemas.Contains(schema);
         }
         else if (e.IsSetData)
         {
             if ((bool)e.Value)
             {
                 selectedSchemas.Add(schema);
             }
             else
             {
                 selectedSchemas.Remove(schema);
             }
         }
     }
 }
Beispiel #10
0
        public static void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e, GridView gridView1, string Bed = "Bed", string Bes = "Bes", string Mande = "Mande")
        {
            if (gridView1.RowCount == 0)
            {
                return;
            }

            SetNumberRowsColumnUnboundGirdView(sender, e);
            int     rowIndex = e.ListSourceRowIndex;
            decimal bed      = Convert.ToDecimal(gridView1.GetListSourceRowCellValue(rowIndex, Bed));
            decimal bes      = Convert.ToDecimal(gridView1.GetListSourceRowCellValue(rowIndex, Bes));

            if (e.Column.FieldName != Mande)
            {
                return;
            }
            if (e.IsGetData)
            {
                if (rowIndex == 0)
                {
                    Result2.Add(bed - bes);
                    e.Value = Result2[rowIndex];
                    if (Convert.ToDecimal(e.Value) == 0)
                    {
                        IndexAkharinDaruaft = rowIndex;
                    }
                }
                else
                {
                    Result2.Add(Result2[rowIndex - 1] + bed - bes);
                    e.Value = Result2[rowIndex];
                    if (Convert.ToDecimal(e.Value) == 0)
                    {
                        IndexAkharinDaruaft = rowIndex;
                    }
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// Handle conversion of Mobius custom data types between the grid and the underlying DataSet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        public void OnCustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            try
            {
                if (InCustomUnboundColumnData)
                {
                    if (DebugDetails)                     // check for reentry which can cause display issues
                    {
                        ClientLog.Message("CustomUnboundColumnData reentry: " + new StackTrace(true));
                    }
                    //return;
                }

                InCustomUnboundColumnData = true;
                ProcessCustomUnboundColumnDataEvent(sender, e);
            }

            catch (Exception ex)
            { ClientLog.Message(DebugLog.FormatExceptionMessage(ex)); }

            InCustomUnboundColumnData = false;
            return;
        }
Beispiel #12
0
        public static void GetUnboundColumnData(CustomColumnDataEventArgs e,
                                                IDictionary <string, IDynamicPropertyList> propertyDictionary)
        {
            if (propertyDictionary == null)
            {
                return;
            }

            var bandedColumn = e.Column as BandedGridColumn;

            if (bandedColumn == null)
            {
                throw new ArgumentException("Only possible with column of type BandedGridColumn");
            }

            var band    = bandedColumn.OwnerBand;
            var bandKey = band.Tag.ToString();

            if (propertyDictionary.ContainsKey(bandKey))
            {
                DynamicBandedGridHelper.GetUnboundColumnData(e, propertyDictionary[bandKey]);
            }
        }
        private void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (!e.IsGetData)
            {
                return;
            }

            var row = OptionsGrid.GridView.GetRow(e.RowHandle);

            switch (e.Column.Name)
            {
            case "col_StandardCost":
                e.Value = (OptionsListForm.ServerMode ? ((VW_Medicament)row).StandardCost * ((VW_Medicament)row).ProductCurrencyRate : ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).StandardCost * ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).ProductCurrencyRate) / CurrencyRate;
                break;

            case "col_ListPrice":
                e.Value = (OptionsListForm.ServerMode ? ((VW_Medicament)row).ListPrice * ((VW_Medicament)row).ProductCurrencyRate : ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).ListPrice * ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).ProductCurrencyRate) / CurrencyRate;
                break;

            case "col_DealerPrice":
                e.Value = (OptionsListForm.ServerMode ? ((VW_Medicament)row).DealerPrice * ((VW_Medicament)row).ProductCurrencyRate : ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).DealerPrice * ((DS_Medicament.VW_MedicamentRow)((DataRowView)row).Row).ProductCurrencyRate) / CurrencyRate;
                break;
            }
        }
        private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            // Obtaining data for the sparkline editor.
            if (e.IsGetData)
            {
                List <double> values = new List <double>();
                DataRowView   row    = (DataRowView)e.Row;

                values.Add((double)row["January"]);
                values.Add((double)row["February"]);
                values.Add((double)row["March"]);
                values.Add((double)row["April"]);
                values.Add((double)row["May"]);
                values.Add((double)row["June"]);
                values.Add((double)row["July"]);
                values.Add((double)row["August"]);
                values.Add((double)row["September"]);
                values.Add((double)row["October"]);
                values.Add((double)row["November"]);
                values.Add((double)row["December"]);

                e.Value = values;
            }
        }
Beispiel #15
0
        private void OnUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (!e.IsGetData)
            {
                return;
            }

            PropertyDescriptorCollection pdc       = ((ITypedList)dataSet1.Tables[1].DefaultView).GetItemProperties(null);
            ExpressionEvaluator          evaluator = new ExpressionEvaluator(pdc, prodView.ActiveFilterCriteria);

            int controllerRow = catView.DataController.GetControllerRow(e.ListSourceRowIndex);

            if (!catView.DataController.IsValidControllerRowHandle(controllerRow))
            {
                return;
            }

            IList detailList = catView.DataController.GetDetailList(controllerRow, 0);

            if (detailList.Count == 0)
            {
                return;
            }

            decimal sum = 0;

            for (int i = 0; i < detailList.Count; i++)
            {
                if (evaluator.Fit((DataRowView)detailList[i]))
                {
                    sum += Convert.ToDecimal(((DataRowView)detailList[i])["UnitPrice"]);
                }
            }

            e.Value = sum;
        }
Beispiel #16
0
 private void gview_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     var channel = (ChannelInfo) e.Row;
       if (e.Column.FieldName == "Position")
     e.Value = channel.GetPosition(this.subListIndex);
 }
Beispiel #17
0
 private void Tablo_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column != _column) return;
     e.Value = IsRowSelected(_tablo.GetRowHandle(e.ListSourceRowIndex));
 }
 private void CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     e.Value = eventObjects[e.ListSourceRowIndex][e.Column.AbsoluteIndex];
 }
Beispiel #19
0
 void winExplorerView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e) {
     if(e.IsSetData) SetIsSelected((Product)e.Row, (bool)e.Value);
     if(e.IsGetData) e.Value = GetIsSelected((Product)e.Row);
 }
Beispiel #20
0
 public static void GetUnboundColumnData(CustomColumnDataEventArgs e,
                                         IDictionary <string, IDynamicPropertyList> propertyDictionary)
 {
     DynamicGridHelper.GetUnboundColumnData(e, propertyDictionary);
 }
Beispiel #21
0
        private void gvLookup_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            ILookupObject lookupObject = _lookupList[e.ListSourceRowIndex];

            DynamicGridHelper.GetUnboundColumnData(e, lookupObject.LookupAdditionalValues);
        }
Beispiel #22
0
 private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     GridView view = sender as GridView;
     if (e.Column.FieldName == "gridColumn1" && e.IsGetData) e.Value =
       getTotalValue(view, e.ListSourceRowIndex);
 }
Beispiel #23
0
 public static void GetUnboundColumnData(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList)
 {
     DynamicGridHelper.GetUnboundColumnData(e, propertyList);
 }
Beispiel #24
0
        private void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (!e.IsGetData)
            {
                return;
            }

            var row = gridView.GetRow(e.RowHandle);

            switch (e.Column.Name)
            {
            case "col_UnitPrice":
                e.Value = (OptionsListForm.ServerMode ? ((VW_ProductLocation)row).UnitPrice * ((VW_ProductLocation)row).PurchaseCurrencyRate : ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).UnitPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).PurchaseCurrencyRate) / OperationCurrencyRate;    //* _CrossRate;
                break;

            case "col_ListPrice":
                e.Value = (OptionsListForm.ServerMode ? ((VW_ProductLocation)row).ListPrice * ((VW_ProductLocation)row).ProductCurrencyRate : ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ListPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ProductCurrencyRate) / OperationCurrencyRate;    //* _CrossRate;
                break;

            case "col_DealerPrice":
                e.Value = (OptionsListForm.ServerMode ? ((VW_ProductLocation)row).DealerPrice * ((VW_ProductLocation)row).ProductCurrencyRate : ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).DealerPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ProductCurrencyRate) / OperationCurrencyRate;    //* _CrossRate;
                break;

            case "col_OneUnitPrice":
                if (OptionsListForm.ServerMode)
                {
                    var rowServerMode = ((VW_ProductLocation)row);
                    e.Value = (rowServerMode.ListPrice * rowServerMode.ProductCurrencyRate / OperationCurrencyRate) * MathHelper.MinQuantity(rowServerMode.UnitsInStock, 4);
                }
                else
                {
                    var rowNormalMode = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row);
                    e.Value = (rowNormalMode.ListPrice * rowNormalMode.ProductCurrencyRate / OperationCurrencyRate) * MathHelper.MinQuantity(rowNormalMode.UnitsInStock, 4);
                }
                break;

            case "col_Quantity":
                if (OptionsListForm.ServerMode)
                {
                    var rowServerMode = ((VW_ProductLocation)row);
                    e.Value = QtyToString(rowServerMode.Quantity, rowServerMode.UnitsInStock);
                }
                else
                {
                    var rowNormalMode = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row);
                    e.Value = QtyToString(rowNormalMode.Quantity, rowNormalMode.UnitsInStock);
                }
                break;

            case "col__PurchaseLineTotal":
                e.Value = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).UnitPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).Quantity * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).PurchaseCurrencyRate / OperationCurrencyRate;
                break;

            case "col__SalesLineTotal":
                e.Value = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ListPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).Quantity * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ProductCurrencyRate / OperationCurrencyRate;
                break;

            case "col__PurchaseTaxAmt":
                e.Value = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).StandardCost * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).Quantity * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).TaxRate * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ProductCurrencyRate / OperationCurrencyRate;
                break;

            case "col__SalesTaxAmt":
                e.Value = ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ListPrice * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).Quantity * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).TaxRate * ((DS_ProductLocation.VW_ProductLocationRow)((DataRowView)row).Row).ProductCurrencyRate / OperationCurrencyRate;
                break;
            }
        }
Beispiel #25
0
        private void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            //DataTable dt = gridControl.DataSource as DataTable;
            //if (dt == null || dt.Rows.Count < 1)
            //    return;
            //if (gridView.FocusedRowHandle < 0)
            //    return;

            // int i = 0;
            //for ( ; i < gridView.RowCount; i++)
            //{
            //    if (i == gridView.RowCount)
            //        break;

            //    string item = (string)((DataRowView)e.Row)["序列号"];
            //    string workno = (string)((DataRowView)e.Row)["工单"];

            //    string goodfilePath = "\\\\" + serverFilePath + "\\QA红单图片" + "\\" + workno + "\\" + item + "\\良品图片";
            //    string badfilePath = "\\\\" + serverFilePath + "\\QA红单图片" + "\\" + workno + "\\" + item + "\\不良品图片";

            //    if (e.Column.FieldName == "良品图片" && e.IsGetData)
            //    {
            //        try
            //        {
            //            Image img = null;
            //            if (Connect(serverFilePath))
            //            {
            //                if (Directory.Exists(goodfilePath))
            //                {
            //                    //FileStream fs = new FileStream(Directory.GetFiles(goodfilePath)[0].ToString(), FileMode.Open);
            //                    //Image goodpic = Image.FromStream(fs);
            //                    //fs.Close();
            //                    //fs.Dispose();
            //                    //gridView.SetRowCellValue(e.ListSourceRowIndex, gridView.Columns["良品图片"], goodpic);

            //                    img = Image.FromFile(Directory.GetFiles(goodfilePath)[0].ToString());
            //                    gridView.SetRowCellValue(e.ListSourceRowIndex, gridView.Columns["良品图片"], img);
            //                    // e.Value = img;


            //                }
            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            MessageBox.Show(ex.ToString());
            //        }
            //    }
            //    if (e.Column.FieldName == "不良品图片" && e.IsGetData)
            //    {
            //        try
            //        {
            //            if (Connect(serverFilePath))
            //            {
            //                if (Directory.Exists(badfilePath))
            //                {
            //                    FileStream ft = new FileStream(Directory.GetFiles(badfilePath)[0].ToString(), FileMode.Open);
            //                    Image badpic = Image.FromStream(ft);
            //                    ft.Close();
            //                    ft.Dispose();
            //                    gridView.SetRowCellValue(e.ListSourceRowIndex, gridView.Columns["不良品图片"], badpic);
            //                }
            //            }


            //        }
            //        catch (Exception ex)
            //        {
            //            MessageBox.Show(ex.ToString());
            //        }
            //    }
            //}
        }
Beispiel #26
0
 private void vista_datos_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
 }
Beispiel #27
0
        // --------------------------------------------------------------------------------------------------------------------

        public static void GetUnboundColumnData <T>(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList,
                                                    string propertyName)
        {
            DynamicGridHelper.GetUnboundColumnData <T>(e, propertyList, propertyName);
        }
        private void gvDrawings_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            var hierDraw = (HierarchyNumberDrawing)e.Row;

            if (e.IsGetData)
            {
                if (hierDraw != null)
                {
                    var rec =
                        _rateTechOpersToDrawings.FirstOrDefault(
                            x =>
                                x.Item1 == hierDraw.Id &&
                                x.Item2 == Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)));

                    e.Value = rec != null ? (object)rec.Item3 : null;
                }
                else
                {
                    e.Value = null;
                }
            }

            if (e.IsSetData)
            {
                if (!_loadTechOpersFlag)
                {
                    if (!_idDocsChanged.Contains((int)hierDraw.Id))
                        _idDocsChanged.Add((int)hierDraw.Id);
                }

                if (hierDraw != null)
                {
                    var rec =
                        _rateTechOpersToDrawings.FirstOrDefault(
                            x =>
                                x.Item1 == hierDraw.Id &&
                                x.Item2 == Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)));

                    if (rec != null)
                    {
                        _rateTechOpersToDrawings.Remove(rec);
                    }

                    _rateTechOpersToDrawings.Add(new Tuple<int, int, decimal?>(hierDraw.Id.Value, Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)), (decimal?)e.Value));
                }
            }
        }
Beispiel #29
0
        private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            //[SGL_NRATE]* (1 + ([TAX_PCT] / 100)) * [NBR_NITES]      [Nights] * [Meal Rate]
            if (e.Column.FieldName == "SGL")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Porterage")
                    {
                        e.Value = gridView1.GetRowCellValue(e.ListSourceRowIndex, "PORTERAGE");
                    }
                    else if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                    //else
                    //{
                    //    decimal sgl_n = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "SGL_NRATE"));
                    //    decimal tax_p = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "TAX_PCT"));
                    //    decimal nbr_n = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "NBR_NITES"));
                    //    e.Value = sgl_n * (1 + (tax_p / 100)) * nbr_n;
                    //}
                }
            }
            if (e.Column.FieldName == "DBL")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Porterage")
                    {
                        e.Value = gridView1.GetRowCellValue(e.ListSourceRowIndex, "PORTERAGE");
                    }
                    else if (val == "Meals")
                    {
                        //decimal nights = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "NBR_NITES"));
                        //decimal meal_rate = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "MEAL1_ADN"));
                        e.Value = mealsValue;
                    }
                }
            }

            if (e.Column.FieldName == "TPL")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Porterage")
                    {
                        e.Value = gridView1.GetRowCellValue(e.ListSourceRowIndex, "PORTERAGE");
                    }
                    else if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                }
            }

            if (e.Column.FieldName == "QUA")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Porterage")
                    {
                        e.Value = gridView1.GetRowCellValue(e.ListSourceRowIndex, "PORTERAGE");
                    }
                    else if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                }
            }
            if (e.Column.FieldName == "JUN")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                }
            }

            if (e.Column.FieldName == "CHD")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();

                    if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                }
            }
            if (e.Column.FieldName == "MealCost")
            {
                if (gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1") != null)
                {
                    string val = gridView1.GetRowCellValue(e.ListSourceRowIndex, "CODE1").ToString();
                    if (val == "Meals")
                    {
                        e.Value = mealsValue;
                    }
                    if (val != "Porterage" && val != "Meals")
                    {
                        decimal nights    = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "NBR_NITES"));
                        decimal meal_rate = Convert.ToDecimal(gridView1.GetRowCellValue(e.ListSourceRowIndex, "MEAL1_ADN"));
                        mealsValue = nights * meal_rate;
                        e.Value    = mealsValue;
                    }
                }
            }
        }
Beispiel #30
0
 public static void SetUnboundColumnData(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList,
                                         bool allowNullValue)
 {
     DynamicGridHelper.SetUnboundColumnData(e, propertyList, allowNullValue);
 }
Beispiel #31
0
        private void gridViewAbsence_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (AbsenceList != null)
            {
                if (e.Column == gridColumn_AbsenceType)
                {
                    int idx = e.ListSourceRowIndex;
                    if (idx >= 0 && idx < AbsenceList.Count && e.IsGetData)
                    {
                        AbsenceType ate = AbsenceList[idx].AbsenceTypeID;

                        switch (ate)
                        {
                            case AbsenceType.Holiday: e.Value = holidayTranslation;
                                break;
                            case AbsenceType.Absence: e.Value = absenceTranslation;
                                break;
                            case AbsenceType.Illness: e.Value = illnessTranslation;
                                break;
                            default:
                                Debug.Assert(false);
                                break;
                        }
                    }
                }
            }
        }
        private void gridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (seats == null) return;  //Still initializing

            if (e.Column.FieldName.StartsWith("Pledge/", StringComparison.OrdinalIgnoreCase)) {
                var columnName = Path.GetFileName(e.Column.FieldName);
                var row = seats.Rows[e.ListSourceRowIndex];

                if (e.IsGetData)
                    e.Value = row.Pledge[columnName];
                else
                    row.Pledge[columnName] = e.Value;
            } else if (e.Column == colChartStatus) {
                if (colChartStatus.ColumnEdit == gridLoadingEdit)
                    e.Value = LoadingImage;
                else if (seatGroups == null)
                    e.Value = null;
                else {
                    var row = seats.Rows[e.ListSourceRowIndex];

                    var chartCount = FindChartCount(row.Person);
                    if (chartCount == 0) {
                        if (row.MensSeats + row.BoysSeats == 0)
                            e.Value = 0;    //Not in chart, but has no seats
                        else
                            e.Value = null; //Missing
                    } else {
                        var reservedSeats = row.MensSeats + row.BoysSeats;
                        e.Value = reservedSeats - chartCount;
                    }
                }
            }
        }
 void view_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == CheckMarkColumn)
     {
         if (e.IsGetData)
             e.Value = IsRowSelected(e.RowHandle);
         else
             SelectRow(e.RowHandle, (bool)e.Value);
     }
 }
Beispiel #34
0
        /// <summary>
        /// Handle conversion of Mobius custom data types between the grid and the underlying DataSet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        void ProcessCustomUnboundColumnDataEvent(object sender, CustomColumnDataEventArgs e)
        {
            MobiusDataType     mdt   = null;
            FormattedFieldInfo ffi   = null;
            bool           formatted = false;
            NumberMx       numberEx;
            StringMx       stringEx;
            ImageMx        imageMx;
            DateTimeMx     dateTimeEx;
            DataRowMx      dr = null;
            BandedGridView mbgv;
            int            nonNullDri;
            string         debugMsg;

            if (DebugMx.False)             // fillValuesImmediately debug test
            {
                e.Value = "XXX";
                return;
            }

            DateTime t0     = DateTime.Now;
            int      callId = ++UnboundCalls;        // get id for this call

            if (sender is BandedGridView)
            {
                mbgv = sender as BandedGridView;
            }

            if (Grid.DataSource == null)
            {
                return;
            }
            CellInfo ci = Grid.GetDataTableCellInfo(e.ListSourceRowIndex, e.Column);

            //if (e.ListSourceRowIndex == 2 && ci.DataRowIndex == 1) e = e; // debug
            //if (ci.Mc.DataType == MetaColumnType.CompoundId && ci.DataRowIndex > 0) ci = ci; // debug
            //DebugLog.Message("CustomUnboundColumnData " + ci.DataRowIndex + ", " + ci.DataColIndex + ", " + ci.DataValue.ToString());
            if (ci.Rfld == null)
            {
                return;
            }

            QueryManager     qm   = Grid.QueryManager;
            ResultsFormatter fmtr = qm.ResultsFormatter;
            ResultsFormat    rf   = qm.ResultsFormat;

            if (e.ListSourceRowIndex == GridControl.NewItemRowHandle || e.ListSourceRowIndex >= Qm.DataTable.Rows.Count)             // new row being created
            {
                if (NewRow == null)
                {
                    NewRow = Qm.DataTable.NewRow();
                }
                dr = NewRow;
            }

            else if (e.ListSourceRowIndex >= 0 && ci.DataRowIndex >= 0)             // row exist in DataTable (i.e. not new row)
            {
                AdjustDataRowToRender(ci);
                if (ci.DataRowIndex >= 0)
                {
                    dr = DataTable.Rows[ci.DataRowIndex];
                    if (ci.DataRowIndex == 0)
                    {
                    }
                }
            }

            else
            {
                if (DebugDetails)
                {
                    ClientLog.Message("Fail 1");
                }
                return;                 // something else, ignore
            }

            // Store edited data for unbound column in DataTable

            if (e.IsSetData)
            {
                SetGridData(e, ci);
                return;
            }

            else if (!e.IsGetData)
            {
                return;                                // just return if not GetData as expected
            }
// Get data from underlying unbound dataset & return in format for grid

            //if (ci.Mc.DataType == MetaColumnType.Structure) ci = ci; // debug
            //if (ci.Mc.DataType == MetaColumnType.String) ci = ci; // debug
            //if (ci.DataValue is StringEx && ((StringEx)ci.DataValue).Value == " ") ci = ci; // debug

            UnboundGets++;

            if (dr == null)
            {
                e.Value = null;
                if (DebugDetails)
                {
                    ClientLog.Message("Fail 2");                               // debug
                }
                return;
            }

            if (Dtm.IsRetrievingDataMessageRow(dr) && ci.Mc != null && !ci.Mc.IsGraphical)
            {
                //if (ci.Mc.IsKey) // show retrieving data message for key field
                e.Value = "Retrieving data...";

                return;
            }

            object fieldValue = dr[ci.DataColIndex];

            if (DebugDetails && fieldValue is MoleculeMx)             // debug
            {
                MoleculeMx     cs      = fieldValue as MoleculeMx;
                MoleculeFormat csType  = cs.PrimaryFormat;
                string         csValue = cs.PrimaryValue;
                int            csLen   = cs.PrimaryValue.Length;
                string         molfile = cs.GetMolfileString();
                molfile = molfile;
            }

            try
            {
                // If already formatted use existing formatting info

                ffi = null;
                if (fieldValue is MobiusDataType)
                {
                    mdt = (MobiusDataType)fieldValue;
                    if (mdt.FormattedBitmap != null)
                    {
                        ffi = new FormattedFieldInfo();
                        ffi.FormattedBitmap = mdt.FormattedBitmap;
                    }

                    else if (mdt.FormattedText != null)
                    {
                        ffi = new FormattedFieldInfo();
                        ffi.FormattedText = mdt.FormattedText;
                    }

                    if (ffi != null)                     // if formatted then copy other format attributes as well
                    {
                        ffi.BackColor = mdt.BackColor;
                        ffi.ForeColor = mdt.ForeColor;
                        ffi.Hyperlink = mdt.Hyperlink;
                    }
                }

                // If not formatted then format

                if (ffi == null)                 // need to format?
                {
// Format non-image field (including structures)

                    if (ci.Mc.DataType != MetaColumnType.Image)                     // format other than image immediately
                    {
                        //if (ci.Mc.DataType == MetaColumnType.Structure)  // debug
                        //{
                        //	DebugLog.Message(fieldValue.ToString());
                        //	UIMisc.Beep();
                        //}

                        ffi = fmtr.FormatField(ci.Rt, ci.TableIndex, ci.Rfld, ci.FieldIndex, dr, e.ListSourceRowIndex, fieldValue, ci.DataRowIndex, false);

                        FormatFieldCalls++;
                        if (ci.Mc.DataType == MetaColumnType.Structure)
                        {
                            FormatStructureFieldCalls++;
                        }

                        StoreFormattingInformationInMdt(ffi, fieldValue, dr, ci, mdt);
                        formatted = true;
                    }

// Image: start asynch call to get image in background as necessary since it is too slow to wait for it here

                    else
                    {
                        if (fieldValue is ImageMx)
                        {
                            imageMx = fieldValue as ImageMx;
                        }

                        else
                        {
                            imageMx = new ImageMx();
                            if (fieldValue != null)
                            {
                                if (fieldValue is MobiusDataType)
                                {
                                    imageMx.DbLink = (fieldValue as MobiusDataType).DbLink;
                                }
                                else
                                {
                                    imageMx.DbLink = fieldValue.ToString();                                  // store field value as dblink
                                }
                            }
                            dr.ItemArrayRef[ci.DataColIndex] = imageMx;                             // store new image object without firing event
                        }

                        mdt = imageMx;                         // copy image object to general  MobiusDataType
                        ffi = new FormattedFieldInfo();

                        if (imageMx.FormattedBitmap != null)                         // already have bitmap?
                        {
                            ffi.FormattedBitmap = imageMx.FormattedBitmap;
                        }

                        else if (imageMx.Value != null)                                                        // have the bitmap, just need to scale it
                        {
                            int fieldWidth   = ci.Rfld.FieldWidth;                                             // current field width in milliinches
                            int desiredWidth = (int)((fieldWidth / 1000.0) * GraphicsMx.LogicalPixelsX * 1.0); // width in pixels

                            imageMx.FormattedBitmap = BitmapUtil.ScaleBitmap(imageMx.Value, desiredWidth);
                            ffi.FormattedBitmap     = imageMx.FormattedBitmap;
                        }

                        else if (imageMx.IsRetrievingValue)                         // already retrieving?
                        {
                            ffi.FormattedBitmap = (Bitmap)RetrievingImageMsg.Image; // put up the processing image
                        }
                        else if (SS.I.AsyncImageRetrieval)                          // start async image retrieval
                        {
                            FormatImageFieldCalls++;
                            GetImageBitmapAsync(ci, dr, e.ListSourceRowIndex, fieldValue, imageMx, callId);
                            ffi.FormattedBitmap = (Bitmap)RetrievingImageMsg.Image;                             // put up the processing image
                        }

                        else                         // do synchronous image retrieval
                        {
                            GetImageBitmap(ci, dr, e.ListSourceRowIndex, fieldValue, imageMx, callId);
                            ffi.FormattedBitmap = imageMx.FormattedBitmap;
                            formatted           = true;
                        }
                    }
                }

                //if (ci.Mc.DataType == MetaColumnType.CompoundId && String.IsNullOrEmpty(fmtdFld.Hyperlink)) ci = ci; // debug
                //if (mdt is CompoundId) mdt = mdt; // debug

                if (e.Column.ColumnEdit is RepositoryItemPictureEdit)
                {
                    if (ffi != null && ffi.FormattedBitmap != null)
                    {
                        e.Value = ffi.FormattedBitmap;
                    }
                    else
                    {
                        e.Value = new Bitmap(1, 1);                              // avoid no-image data message
                    }
                    //ffi.FormattedBitmap.Save(@"c:\download\test.bmp"); // debug
                }

                else
                {
                    e.Value = ffi.FormattedText;                   // non-picture column
                }
                if (ci.DataRowIndex == DataTable.Rows.Count - 1 && // if at end of DataTable && more rows available, request them
                    !Dtm.RowRetrievalComplete)
                {
                    //Progress.Show("Retrieving data..."); // put up progress dialog if not already up

                    //if (WaitForMoreDataStartTime.Equals(DateTime.MinValue)) // say we've started waiting for data
                    //{
                    //  WaitForMoreDataStartTime = DateTime.Now;
                    //  ClientLog.Message("Set WaitForMoreDataStartTime: " + WaitForMoreDataStartTime.ToLongTimeString());
                    //}

                    if (Dtm.RowRetrievalState == RowRetrievalState.Paused)
                    {
                        Dtm.StartRowRetrieval();                         // .ReadNextRowsFromQueryEngine(); // restart retrieval
                    }
                }

                else if (Lex.StartsWith(Progress.GetCaption(), "Retrieving data...") || Lex.IsUndefined(Progress.GetCaption()))
                {                 // hide any "Retrieving data..." message
                    Progress.Hide();
                    //SystemUtil.Beep();
                }

                Grid.LastRowRendered = e.ListSourceRowIndex;

                if (DebugDetails)
                {
                    debugMsg =
                        "Grid.GetData: " + callId + ", e.Row = " + e.ListSourceRowIndex +
                        ", e.Col = " + e.Column.AbsoluteIndex + ", Formatted = " + (formatted ? "T" : "F") + ", Time(ms) = " + TimeOfDay.Delta(t0) +
                        ", ColLabel = " + ci.Qc.ActiveLabel;
                    debugMsg += ", FieldValue = ";
                    if (fieldValue != null)
                    {
                        debugMsg += fieldValue.ToString();
                    }
                    debugMsg += ", e.Value = ";
                    if (e.Value != null)
                    {
                        debugMsg += e.Value.ToString();
                    }
                    else
                    {
                        debugMsg += "null";
                    }
                    ClientLog.Message(debugMsg);
                }

                // TODO: This does a some unnecessary hides which cause flashing of the window frame
                // This happens when we are not at the end of the DataTable but don't know if any additional requests
                // for rendering will occur. May be better to move this to DataTableManger when we detect
                // that we have retrieved a row that is below the level of those displayed in the grid or all rows have been retrieved.
                // Also maybe in MoleculeGridControl.RetrievalMonitorTimer_Tick
            }

            catch (Exception ex)
            {
                if (e.Column.ColumnEdit is RepositoryItemPictureEdit)
                {
                    e.Value = new Bitmap(1, 1);                     // avoid no-image data message
                }
                else
                {
                    e.Value = ex.Message;
                }

                string msg = "ColumnView_CustomUnboundColumnData Exception";
                if (ci.Rfld != null)
                {
                    msg += ",  MetaColumn: " + ci.Rfld.MetaColumn.MetaTable.Name + "." + ci.Rfld.MetaColumn.Name;
                }
                msg += ",  DataColIndex: " + ci.DataColIndex + ",  DataRowIndex: " + ci.DataRowIndex;
                if (fieldValue != null)
                {
                    msg += ",  Value: " + fieldValue.ToString();
                }
                ClientLog.Message(msg);
            }


            //			t0 = TimeOfDay.Milliseconds() - t0;
            //			ClientLog.Message("CustomUnboundColumnData event time: " + t0);
        }
 private void CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column.AbsoluteIndex >= 3)
     {
         e.Value = data[e.ListSourceRowIndex][e.Column.AbsoluteIndex+2];
     }
     else
     {
         e.Value = data[e.ListSourceRowIndex][e.Column.AbsoluteIndex];
     }
 }
Beispiel #36
0
 public static void GetUnboundColumnData(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList)
 {
     if (propertyList != null)
     {
         if (e.IsGetData)
         {
             if (propertyList.HasProperty(e.Column.FieldName))
             {
                 if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(string))
                 {
                     e.Value = propertyList.GetValue <string>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(double))
                 {
                     e.Value = propertyList.GetValue <double>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(double?))
                 {
                     e.Value = propertyList.GetValue <double?>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(decimal))
                 {
                     e.Value = propertyList.GetValue <decimal>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(decimal?))
                 {
                     e.Value = propertyList.GetValue <decimal?>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(int))
                 {
                     e.Value = propertyList.GetValue <int>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(int?))
                 {
                     e.Value = propertyList.GetValue <int?>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(DateTime))
                 {
                     e.Value = propertyList.GetValue <DateTime>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(DateTime?))
                 {
                     e.Value = propertyList.GetValue <DateTime?>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(Quantity))
                 {
                     e.Value = propertyList.GetValue <Quantity>(e.Column.FieldName);
                 }
                 else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(bool))
                 {
                     e.Value = propertyList.GetValue <bool>(e.Column.FieldName);
                 }
                 else
                 {
                     throw new PhuLiException(
                               string.Format("Type [{0}] not handled. Please add this type to the function.",
                                             propertyList.GetPropertyType(e.Column.FieldName)));
                 }
             }
             else
             {
                 Debug.Assert(false, string.Format("Property [{0}] not found in list", e.Column.FieldName));
             }
         }
         else if (e.IsSetData)
         {
             throw new PhuLiException("Please call SetUnboundColumnData");
         }
     }
 }
Beispiel #37
0
 protected override void OnCustomUnboundColumnData(CustomColumnDataEventArgs e)
 {
     var row = e.Column.View.DataController.GetRowByListSourceIndex(e.ListSourceRowIndex) as IOwnedObject;
     if (e.IsGetData && row != null)
         e.Value = row.Person;
 }
Beispiel #38
0
 public static void SetUnboundColumnData(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList)
 {
     SetUnboundColumnData(e, propertyList, true);
 }
Beispiel #39
0
        private void pledgesView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (pledges == null) return;	//Still initializing

            if (e.Column.FieldName.StartsWith("Seat/", StringComparison.OrdinalIgnoreCase)) {
                var field = e.Column.FieldName.Substring("Seat/".Length);
                var pledge = pledges.Rows[e.ListSourceRowIndex];
                var seat = pledge.Person.MelaveMalkaSeats.FirstOrDefault(s => s.Year == journal.Year);

                if (e.IsGetData) {
                    e.Value = seat == null ? null : seat[field];	//No reservation means unsure
                } else {	//Modify the existing seating row or add a new one
                    if (seat != null) {
                        seat[field] = e.Value;
                        if (seat.MensSeats == null && seat.WomensSeats == null)
                            seat.RemoveRow();
                    } else {					//There isn't an existing seat row
                        if (e.Value == null)	//If it's still null, don't change anything
                            return;
                        else {
                            seat = new MelaveMalkaSeat {
                                Year = journal.Year,
                                Person = pledge.Person,
                                DateAdded = DateTime.Now
                            };
                            seat[field] = e.Value;
                            Program.Table<MelaveMalkaSeat>().Rows.Add(seat);
                        }
                    }
                }
            }
        }
Beispiel #40
0
        public static void SetUnboundColumnData(CustomColumnDataEventArgs e, IDynamicPropertyList propertyList,
                                                bool allowNullValue)
        {
            if (e.IsGetData)
            {
                throw new PhuLiException("Please call GetUnboundColumnData");
            }
            if (e.IsSetData)
            {
                if (propertyList.HasProperty(e.Column.FieldName))
                {
                    if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(string))
                    {
                        propertyList.SetValue(e.Column.FieldName, Convert.ToString(e.Value));
                        //get value from property, to reflect changes during set function
                        e.Value = propertyList.GetValue <string>(e.Column.FieldName);
                    }
                    else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(double))
                    {
                        if (e.Value != null)
                        {
                            double newValue;
                            bool   parseOk = double.TryParse(e.Value.ToString(), out newValue);
                            if (parseOk)
                            {
                                propertyList.SetValue(e.Column.FieldName, newValue);
                                //get value from property, to reflect changes during set function
                                e.Value = propertyList.GetValue <double>(e.Column.FieldName);
                            }
                        }
                    }
                    else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(decimal))
                    {
                        if (e.Value != null)
                        {
                            decimal newValue;
                            bool    parseOk = decimal.TryParse(e.Value.ToString(), out newValue);
                            if (parseOk)
                            {
                                propertyList.SetValue(e.Column.FieldName, newValue);
                                //get value from property, to reflect changes during set function
                                e.Value = propertyList.GetValue <decimal>(e.Column.FieldName);
                            }
                        }
                    }
                    else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(int))
                    {
                        if (e.Value != null)
                        {
                            int  newValue;
                            bool parseOk = int.TryParse(e.Value.ToString(), out newValue);
                            if (parseOk)
                            {
                                propertyList.SetValue(e.Column.FieldName, newValue);
                                //get value from property, to reflect changes during set function
                                e.Value = propertyList.GetValue <int>(e.Column.FieldName);
                            }
                        }
                    }
                    else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(Quantity))
                    {
                        if (e.Value != null)
                        {
                            var      oldQty = propertyList.GetValue <Quantity>(e.Column.FieldName);
                            Quantity newQty = Quantity.TryConvert(oldQty, e.Value);

                            if (!allowNullValue)
                            {
                                if (newQty == null && oldQty != null)
                                {
                                    newQty = Quantity.TryConvert(oldQty, 0m);
                                }
                            }

                            propertyList.SetValue(e.Column.FieldName, newQty);
                            //get value from property, to reflect changes during set function
                            e.Value = propertyList.GetValue <Quantity>(e.Column.FieldName);
                        }
                    }
                    else if (propertyList.GetPropertyType(e.Column.FieldName) == typeof(DateTime) ||
                             propertyList.GetPropertyType(e.Column.FieldName) == typeof(DateTime?))
                    {
                        if (e.Value != null)
                        {
                            DateTime newValue;
                            bool     parseOk = DateTime.TryParse(e.Value.ToString(), out newValue);
                            if (parseOk)
                            {
                                propertyList.SetValue(e.Column.FieldName, newValue);
                                //get value from property, to reflect changes during set function
                                e.Value = propertyList.GetValue <DateTime>(e.Column.FieldName);
                            }
                        }
                    }
                    else
                    {
                        throw new PhuLiException(
                                  string.Format("Type [{0}] not handled. Please add this type to the function.",
                                                propertyList.GetPropertyType(e.Column.FieldName)));
                    }
                }
                else
                {
                    Debug.Assert(false, "Property doesn't exist in dynamic property list.");
                }
            }
        }
        private void gvDrawings_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            var hierDraw = (HierarchyNumberDrawing)e.Row;

            if (e.IsGetData)
            {
                if (hierDraw != null)
                {
                    var rec =
                        _techOpersToDrawings.FirstOrDefault(
                            x =>
                                x.Item1 == hierDraw.Id &&
                                x.Item2 == Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)));

                    e.Value = rec != null && rec.Item3;
                }
                else
                {
                    e.Value = false;
                }
            }
            else
            {
                if (hierDraw != null)
                {
                    var rec =
                        _techOpersToDrawings.FirstOrDefault(
                            x =>
                                x.Item1 == hierDraw.Id &&
                                x.Item2 == Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)));

                    if (rec != null)
                    {
                        _techOpersToDrawings.Remove(rec);
                    }

                    _techOpersToDrawings.Add(new Tuple<int, int, bool>(hierDraw.Id.Value, Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)), (bool)e.Value));
                }
            }
        }
        private void данныеТаблицыИстории_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            List <ЭлементПросмотраЗаписиИсторииСборки> list = this.ТекущийСписокЭлементов;

            if (((list != null) && (((e.Column != null) && (e.Column.Tag != null)) && !string.IsNullOrEmpty(e.Column.Tag.ToString()))) && ((e.ListSourceRowIndex >= 0) && (e.ListSourceRowIndex < list.Count)))
            {
                string key  = string.Format("{0}:{1}", e.Column.Name, e.ListSourceRowIndex);
                object obj2 = e.Value;
                if (this.значенияЯчеек.ContainsKey(key))
                {
                    obj2 = this.значенияЯчеек[key];
                }
                else
                {
                    string str3;
                    string str2 = e.Column.Tag.ToString().Trim().ToLower();
                    ЭлементПросмотраЗаписиИсторииСборки сборки = list[e.ListSourceRowIndex];
                    if (str2.StartsWith("значение_столбца_источника_"))
                    {
                        str3 = str2.Substring(0x1b).Trim();
                        obj2 = this.ОписаниеТекущегоУровня.ПолучитьЗначениеПоляИсточника(сборки, str3);
                        if (obj2 == null)
                        {
                            obj2 = 0M;
                        }
                        else if (obj2 is ОбщийЧисловойТип)
                        {
                            obj2 = (obj2 as ОбщийЧисловойТип).Значение;
                            if (obj2 == null)
                            {
                                obj2 = 0.00M;
                            }
                        }
                    }
                    else if (str2.StartsWith("значение_столбца_приемника_"))
                    {
                        str3 = str2.Substring(0x1b).Trim();
                        obj2 = this.ОписаниеТекущегоУровня.ПолучитьЗначениеПоляТекущейТаблицы(сборки, str3);
                        if (obj2 == null)
                        {
                            obj2 = 0M;
                        }
                        else if (obj2 is ОбщийЧисловойТип)
                        {
                            obj2 = (obj2 as ОбщийЧисловойТип).Значение;
                            if (obj2 == null)
                            {
                                obj2 = 0.00M;
                            }
                        }
                    }
                    else
                    {
                        obj2 = сборки.ПолучитьЗначениеПараметра(str2);
                        if (obj2 is ОбщийЧисловойТип)
                        {
                            obj2 = (obj2 as ОбщийЧисловойТип).Значение;
                            if (obj2 == null)
                            {
                                obj2 = 0.00M;
                            }
                        }
                        decimal num = 0.00M;
                        if (!(obj2 is decimal))
                        {
                            try
                            {
                                if (Конвертер.ПопробоватьВЧисло(obj2.ToString(), out num))
                                {
                                    obj2 = num;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    this.значенияЯчеек.Add(key, obj2);
                }
                e.Value = obj2;
            }
        }
 private void CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column.AbsoluteIndex == 3)
     {
         e.Value = (int)data[e.ListSourceRowIndex][e.Column.AbsoluteIndex] == 1 ? "Настройки" : "Доступны";
     }
     else
     {
         if (e.Column.AbsoluteIndex < 3)
         {
             e.Value = data[e.ListSourceRowIndex][e.Column.AbsoluteIndex];
         }
         else
         {
             e.Value = string.Empty;
         }
     }
 }
Beispiel #44
0
        private void gvDrawings_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            var hierDraw = (HierarchyNumberDrawing)e.Row;

            if (e.IsGetData)
            {
                if (hierDraw != null)
                {
                    var rec =
                        Madeds.FirstOrDefault(
                            x =>
                                x.Drawing.Id == hierDraw.Id &&
                                x.TechOperation.Id ==
                                Convert.ToInt32(e.Column.Name.Replace(ColumnTechOperStart, string.Empty)));

                    e.Value = rec != null ? (object)rec.CountProduced : null;
                }
                else
                {
                    e.Value = null;
                }
            }
            if (e.IsSetData)
            {
            }
        }
        private void gridViewUnAdHours_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
          if (e.Column == gc_DayOfWeek)
            {
                if (e.IsGetData)
                {
                    int idx = e.ListSourceRowIndex;
                    if (idx >= 0 && idx < ListOfUnavAddHours.Count)
                    {
                        CountryAdditionalHour AdHours = ListOfUnavAddHours[e.ListSourceRowIndex];
                        e.Value = daysOfWeek[AdHours.WeekDay];
                    }
                } 
            }           
            
            if (e.Column == gc_StartTime)
            {
                if (e.IsGetData)
                {
                    int idx = e.ListSourceRowIndex;
                    if (idx >= 0 && idx < ListOfUnavAddHours.Count)
                    {
                        CountryAdditionalHour AdHours = ListOfUnavAddHours[e.ListSourceRowIndex];
                        e.Value = ConvertShortToDateTime(AdHours.BeginTime).ToShortTimeString();
                    }
                }
            }

            if (e.Column == gc_FinishTime)
            {
                if (e.IsGetData)
                {
                    int idx = e.ListSourceRowIndex;
                    if (idx >= 0 && idx < ListOfUnavAddHours.Count)
                    {
                        CountryAdditionalHour AdHours = ListOfUnavAddHours[e.ListSourceRowIndex];
                        e.Value = ConvertShortToDateTime(AdHours.EndTime).ToShortTimeString();
                    }
                }
            }
        }
 ///<summary>Raises the CustomUnboundColumnData event.</summary>
 protected override void RaiseCustomUnboundColumnData(CustomColumnDataEventArgs e)
 {
     var column = e.Column as SmartGridColumn;
     if (column != null && column.Controller != null)
         column.Controller.OnCustomUnboundColumnData(e);
     base.RaiseCustomUnboundColumnData(e);
 }
Beispiel #47
0
 private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     e.Value = gridView1.GetRowHandle(e.ListSourceRowIndex) + 1;
 }
Beispiel #48
0
 private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.IsGetData)
         e.Value = GetCost(e.Row);
    
     //if (e.IsSetData)
     //    _Cache.SetValue(e.Row, e.Value);
 }
Beispiel #49
0
 private void gridViewLunch_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == gc_typeLunchModel)
     {
         if (e.IsGetData)
         {
             int idx = e.ListSourceRowIndex;
             if (idx >= 0 && idx < _listEntities.Count)
             {
                 WorkingModel wm = _listEntities[e.ListSourceRowIndex];
                 if (wm.IsDurationTime)
                     e.Value = GetLocalized("DurationTime");
                 else
                     e.Value = GetLocalized("DurationWorkingDay");
             }
         }
     }
 }
 private void bandedGridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
 }
Beispiel #51
0
 private void projectsGridView_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.IsGetData)
     {
         if (e.Column == statusGridColumn)
         {
             ProjectWrapper projectWrapper = (ProjectWrapper)projectsDataSource[e.ListSourceRowIndex];
             byte[] imgBytes = iconsByKey[projectWrapper.Project.Status.Key];
             e.Value = imgBytes;
         }
     }
 }
 private void gvPlayers_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (!e.IsGetData) return;
       var server = (ServerRow) this.gvServers.GetFocusedRow();
       var player = (Player) e.Row;
       if (server != null && player != null)
     e.Value = server.GameExtension.GetPlayerCellValue(server, player, e.Column.FieldName);
 }
 ///<summary>Allows the controller to provide data for an unbound column.</summary>
 protected internal virtual void OnCustomUnboundColumnData(CustomColumnDataEventArgs e)
 {
 }
        private void gvServers_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (e.IsSetData)
              {
            if (e.Column == this.colFavServer)
            {
              var server = (ServerRow) e.Row;
              if ((bool) e.Value)
            this.favServers[server.EndPoint] = server.Name;
              else
            this.favServers.Remove(server.EndPoint);
            }
            return;
              }

              var row = (ServerRow) e.Row;
              if (e.Column == this.colFavServer)
            e.Value = this.favServers.ContainsKey(row.EndPoint);
              else if (e.Column == this.colEndPoint)
            e.Value = GetServerAddress(row);
              else if (e.Column == this.colName)
            e.Value = row.ServerInfo?.Name.Trim() ?? (showAddressMode == 0 ? GetServerAddress(row) : null);
              else if (e.Column.FieldName.StartsWith(CustomNumericRuleColumnPrefix))
              {
            var fieldName = e.Column.FieldName.Substring(CustomNumericRuleColumnPrefix.Length);
            e.Value = row.GetExtenderCellValue(fieldName);
            try { e.Value = Convert.ToDecimal(e.Value); }
            catch
            {
            }
              }
              else
            e.Value = row.GetExtenderCellValue(e.Column.FieldName);
        }
Beispiel #55
0
 private void gridView2_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.IsGetData)
         e.Value = GetCost(e.Row);
 }
Beispiel #56
0
 ///<summary>Allows the controller to provide data for an unbound column.</summary>
 protected internal virtual void OnCustomUnboundColumnData(CustomColumnDataEventArgs e)
 {
 }