Ejemplo n.º 1
0
        protected void Grid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e)
        {
            DateFieldParts dateFieldParts = DateFieldParts.GetDateFieldParts(e.Column.FieldName);

            if (dateFieldParts != null)
            {
                DateAmountMap dateAmountMap = JsonConvert.DeserializeObject <DateAmountMap>(Convert.ToString(e.GetListSourceFieldValue("AmountDateMap")));
                e.Value = dateAmountMap.GetDateAmount(dateFieldParts);
            }
        }
Ejemplo n.º 2
0
        private void ProcessUpdateValues(List <ASPxDataUpdateValues> updateValues)
        {
            foreach (ASPxDataUpdateValues updateInfo in updateValues)
            {
                SampleData item = ModelRepository.GetData().Find(i => i.ID == Convert.ToInt32(updateInfo.Keys[0]));
                item.Text = Convert.ToString(updateInfo.NewValues["Text"]);

                DateAmountMap dateAmountMap = JsonConvert.DeserializeObject <DateAmountMap>(item.AmountDateMap);

                foreach (string fieldName in updateInfo.NewValues.Keys)
                {
                    DateFieldParts dateFieldParts = DateFieldParts.GetDateFieldParts(fieldName);
                    if (dateFieldParts != null)
                    {
                        dateAmountMap.SetDateAmount(dateFieldParts, Convert.ToDouble(updateInfo.NewValues[fieldName]));
                    }
                }

                item.AmountDateMap = JsonConvert.SerializeObject(dateAmountMap);
            }
        }