protected void gridInflirovanieCpi_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
        {
            foreach (GridViewColumn column in gridInflirovanieCpi.Columns)
            {
                var dataColumn = column as GridViewDataColumn;
                if (dataColumn == null) continue;

                if (dataColumn.FieldName == "CpiRepublic")
                {
                    if (e.NewValues[dataColumn.FieldName] == null)
                    {
                        e.Errors[dataColumn] = "Недопускаюется пустое значения для этого поля";
                    }
                }
            }

            if (e.Errors.Count > 0)
                e.RowError = "Пожалуйста заполните обязательные поля.";
            
            if(!e.IsNewRow)
            {
                var referenceBook = new HyperinflationCpiActions();

                int indexLastMonth = 0, indexLastYear = 0;
                indexLastMonth = referenceBook.GetLastMonthIndex();
                indexLastYear = referenceBook.GetLastYearIndex();

                if (e.NewValues["Month"] != null && e.NewValues["Year"] != null)
                {
                    int indexCurrMonth = Convert.ToInt16(e.NewValues["Month"].ToString());
                    int indexCurrYear = Convert.ToInt16(e.NewValues["Year"].ToString());

                    if (indexLastMonth != indexCurrMonth || indexLastYear != indexCurrYear)
                    {
                        e.RowError = "Редактирование запрещено.";
                    }

                }
            }

        }
        protected void gridInflirovanieCpi_OnInitNewRow(object sender,
            DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
        {
            var referenceBook = new HyperinflationCpiActions();

            int indexLastMonth=0, indexLastYear=0;
            indexLastMonth = referenceBook.GetLastMonthIndex();
            indexLastYear = referenceBook.GetLastYearIndex();

            if (indexLastMonth == 12)
            {
                indexLastMonth = 1;
                ++indexLastYear;
            }
            else
            {
                ++indexLastMonth;
            }
            e.NewValues["Month"] = indexLastMonth;
            e.NewValues["Year"] = indexLastYear;
        }