public DataGridViewIncomeRow()
     : base()
 {
     IncomeItem item = new IncomeItem();
     if (this.Date != DateTime.MinValue)
     {
         item.IDate = this.Date.Date;
     }
     this._item = item;
     RowIsEditing = false;
 }
        public void UpdateCell(int columnIndex)
        {
            if (this._item == null)
            {
                this._item = new IncomeItem(this._date);
            }
            switch (columnIndex)
            {
                case 1:
                    this._item.IFilter = this.Cells[1].Value as long?;
                    break;

                case 2:
                    this._item.Summary = ParseNumericCell(this.Cells[2] as DataGridViewTextBoxCell);
                    this.Cells[2].Value = this._item.Summary;
                    if (IncomeSummaryChanged != null) IncomeSummaryChanged(this, new EventArgs());
                    break;

                case 3:
                    string description = this.Cells[3].Value as string;
                    this._item.Description = description != null ? description : string.Empty;
                    break;
            }
            if (!this.Item.IsEmpty)
            {
                if (!this.Item.Id.HasValue)
                {
                    if (!DB.DBManager.IncomeData.ContainsKey(this.Date.Date))
                    {
                        DB.DBManager.IncomeData.Add(this.Date.Date, new List<IncomeItem>());
                    }
                    DB.DBManager.IncomeData[this.Date.Date].Add(this.Item);
                }
                DB.DBManager.CreateOrUpdateItem(this.Item);
            }
        }