Пример #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);
            }
        }
Пример #2
0
        public static DateFieldParts GetDateFieldParts(string dateFieldName)
        {
            DateFieldParts dateFieldParts = null;

            if (IsDateFieldParts(dateFieldName))
            {
                dateFieldParts = new DateFieldParts(dateFieldName);
            }

            return(dateFieldParts);
        }
Пример #3
0
        public void SetDateAmount(DateFieldParts dateFieldParts, double amount)
        {
            MonthMap monthMap;
            DayMap   dayMap;

            if (GetMonthMapFromYear(dateFieldParts.Year, out monthMap))
            {
                if (monthMap.GetDayMapFromMonth(dateFieldParts.Month, out dayMap))
                {
                    dayMap.SetAmountForDay(dateFieldParts.Day, amount);
                }
            }
        }
Пример #4
0
        public double GetDateAmount(DateFieldParts dateFieldParts)
        {
            double   amount = 0;
            MonthMap monthMap;
            DayMap   dayMap;

            if (GetMonthMapFromYear(dateFieldParts.Year, out monthMap))
            {
                if (monthMap.GetDayMapFromMonth(dateFieldParts.Month, out dayMap))
                {
                    dayMap.GetAmountFromDay(dateFieldParts.Day, out amount);
                }
            }
            return(amount);
        }
Пример #5
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);
            }
        }