public override bool Save() { string sql; if (NewItem) { sql = "INSERT INTO models (name, mark_id) " + "VALUES (@name, @mark_id)"; } else { sql = "UPDATE models SET name = @name, mark_id = @mark_id WHERE id = @id"; } logger.Info("Запись модели..."); QSMain.CheckConnectionAlive(); try { MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB); cmd.Parameters.AddWithValue("@id", Itemid); cmd.Parameters.AddWithValue("@name", entryName.Text); cmd.Parameters.AddWithValue("@mark_id", DBWorks.ValueOrNull(Mark_id > 0, Mark_id)); cmd.ExecuteNonQuery(); logger.Info("Ok"); return(true); } catch (Exception ex) { QSMain.ErrorMessageWithLog("Ошибка записи модели!", logger, ex); } return(false); }
public void LoadDataFromDB(int id) { if (usedTable.Fields.Count < 1) { logger.Info("Нет полей для загрузки."); return; } logger.Info("Загружаем данные настраиваемых полей для id={0}", id); this.id = id; DBWorks.SQLHelper sql = new DBWorks.SQLHelper("SELECT "); foreach (CFFieldInfo field in usedTable.Fields) { sql.AddAsList(String.Format("{0}.{1}", usedTable.DBName, field.ColumnName)); } ; sql.Add(" FROM {0} WHERE {0}.id = @id ", usedTable.DBName); logger.Debug(sql.Text); try { MySqlCommand cmd = new MySqlCommand(sql.Text, (MySqlConnection)QSMain.ConnectionDB); cmd.Parameters.AddWithValue("@id", id); using (MySqlDataReader rdr = cmd.ExecuteReader()) { rdr.Read(); foreach (CFFieldInfo field in usedTable.Fields) { switch (field.FieldType) { case FieldTypes.TString: Entry stringWid = (Entry)FieldWidgets[field.ID]; stringWid.Text = DBWorks.GetString(rdr, field.ColumnName, ""); break; case FieldTypes.TCurrency: SpinButton moneyWid = (SpinButton)FieldWidgets[field.ID]; moneyWid.Value = DBWorks.GetDouble(rdr, field.ColumnName, 0); break; } } } logger.Info("Ок"); }catch (Exception ex) { string mes = "Ошибка чтения данных для настраиваемых полей!"; logger.Error(ex, mes); throw new ApplicationException(mes, ex); } }
public void SaveToDB(MySqlTransaction trans) { if (usedTable.Fields.Count < 1) { return; } logger.Info("Сохраняем данные настраиваемых полей для id={0}", id); DBWorks.SQLHelper sql = new DBWorks.SQLHelper("UPDATE {0} SET ", usedTable.DBName); foreach (CFFieldInfo field in usedTable.Fields) { sql.AddAsList(String.Format("{0} = @{0}", field.ColumnName)); } ; sql.Add(" WHERE id = @id "); try { MySqlCommand cmd = new MySqlCommand(sql.Text, (MySqlConnection)QSMain.ConnectionDB, trans); cmd.Parameters.AddWithValue("@id", id); foreach (CFFieldInfo field in usedTable.Fields) { switch (field.FieldType) { case FieldTypes.TString: Entry stringWid = (Entry)FieldWidgets[field.ID]; cmd.Parameters.AddWithValue(field.ColumnName, DBWorks.ValueOrNull(stringWid.Text != "", stringWid.Text)); break; case FieldTypes.TCurrency: SpinButton moneyWid = (SpinButton)FieldWidgets[field.ID]; cmd.Parameters.AddWithValue(field.ColumnName, moneyWid.Value); break; } } cmd.ExecuteNonQuery(); logger.Info("Записано."); }catch (Exception ex) { string mes = "Ошибка чтения данных для настраиваемых полей!"; logger.Error(ex, mes); throw new ApplicationException(mes, ex); } }
public static void LoadReadFeed() { logger.Info("Получаем таблицу прочитанных пользователем новостей..."); if (NewsFeeds == null) { NewsFeeds = new List <NewsFeed> (); } string sql = "SELECT * FROM `read_news` WHERE user_id = @user_id"; DbCommand cmd = QSMain.ConnectionDB.CreateCommand(); cmd.CommandText = sql; DbParameter param = cmd.CreateParameter(); param.ParameterName = "@user_id"; param.Value = QSMain.User.Id; cmd.Parameters.Add(param); using (DbDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { NewsFeed feed = NewsFeeds.Find(f => f.Id == DBWorks.GetString(rdr, "feed_id", "")); if (feed != null) { feed.FirstRead = false; feed.DataBaseId = DBWorks.GetInt(rdr, "id", -1); string[] items = DBWorks.GetString(rdr, "items", "").Split(','); feed.ReadItems = new List <string> (items); } else { logger.Warn("В базе найден feed_id={0}, но в программе он не настроен.", DBWorks.GetString(rdr, "feed_id", "")); } } } logger.Info("Ok"); }
public void Fill(int id) { Itemid = id; NewItem = false; logger.Info("Запрос модели №{0}...", id); string sql = "SELECT models.*, marks.name as mark FROM models " + "LEFT JOIN marks ON marks.id = models.mark_id WHERE models.id = @id"; QSMain.CheckConnectionAlive(); try { MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB); cmd.Parameters.AddWithValue("@id", id); using (MySqlDataReader rdr = cmd.ExecuteReader()) { rdr.Read(); labelId.Text = rdr["id"].ToString(); entryName.Text = rdr["name"].ToString(); entryMark.Text = rdr["mark"].ToString(); Mark_id = DBWorks.GetInt(rdr, "mark_id", -1); logger.Info("Ok"); } this.Title = entryName.Text; } catch (Exception ex) { QSMain.ErrorMessageWithLog("Ошибка получения информации о модели!", logger, ex); this.Respond(Gtk.ResponseType.Reject); } TestCanSave(); }
void ConfigureDlg() { AutofacScope = MainClass.AppDIContainer.BeginLifetimeScope(); interactive = AutofacScope.Resolve <IInteractiveMessage>(); navigation = AutofacScope.Resolve <INavigationManager>(); orderMessages = AutofacScope.Resolve <OrderMessagesModel>(new TypedParameter(typeof(WorkOrder), Entity)); validator = AutofacScope.Resolve <IValidator>(); labelCreated.LabelProp = $"{Entity.CreatedDate} - {Entity.CreatedBy?.Name}"; this.Title = String.Format(GetTitleFormat(Entity.OrderTypeClass), UoW.IsNew ? "???" : Entity.Id.ToString(), Entity.Date, Entity.Hour); comboStatus.ItemsList = OrderStateRepository.GetStates(UoW, Entity.OrderTypeClass); comboStatus.Binding.AddBinding(Entity, e => e.OrderState, w => w.SelectedItem).InitializeFromSource(); comboMark.ItemsList = UoW.GetAll <CarBrand>(); if (Entity.CarModel != null) { comboMark.SelectedItem = Entity.CarModel.Brand; } comboModel.Binding.AddBinding(Entity, e => e.CarModel, w => w.SelectedItem).InitializeFromSource(); if (Entity.OrderTypeClass.IsShowAdditionalWidgets) { comboManufacturer.ShowSpecialStateNot = true; comboManufacturer.ItemsList = UoW.GetAll <Manufacturer>(); comboStock.ShowSpecialStateNot = true; comboStock.ItemsList = UoW.GetAll <Warehouse>(); } else { labelGlass.Visible = labelManufacturer.Visible = comboManufacturer.Visible = labelStock.Visible = comboStock.Visible = labelEurocode.Visible = entryEurocode.Visible = false; } comboYear.Model = new ListStore(typeof(string)); comboYear.TextColumn = 0; for (int year = 1980; year <= DateTime.Today.Year; year++) { comboYear.AppendText(year.ToString()); } comboYear.Binding.AddBinding(Entity, e => e.CarYearText, w => w.Entry.Text).InitializeFromSource(); comboManufacturer.Binding.AddBinding(Entity, e => e.Manufacturer, w => w.SelectedItem).InitializeFromSource(); comboStock.Binding.AddBinding(Entity, e => e.Stock, w => w.SelectedItem).InitializeFromSource(); entryPhone.Binding.AddBinding(Entity, e => e.Phone, w => w.Text).InitializeFromSource(); entryEurocode.Binding.AddBinding(Entity, e => e.Eurocode, w => w.Text).InitializeFromSource(); textviewComment.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource(); yradioInstallNone.BindValueWhenActivated = yradioTintingNone.BindValueWhenActivated = yradioArmoringNone.BindValueWhenActivated = yradioPastingNone.BindValueWhenActivated = Warranty.None; yradioInstall6Month.BindValueWhenActivated = yradioTinting6Month.BindValueWhenActivated = yradioArmoring6Month.BindValueWhenActivated = yradioPasting6Month.BindValueWhenActivated = Warranty.SixMonth; yradioInstall1Year.BindValueWhenActivated = yradioTinting1Year.BindValueWhenActivated = yradioArmoring1Year.BindValueWhenActivated = yradioPasting1Year.BindValueWhenActivated = Warranty.OneYear; yradioInstall2Year.BindValueWhenActivated = yradioTinting2Year.BindValueWhenActivated = yradioArmoring2Year.BindValueWhenActivated = yradioPasting2Year.BindValueWhenActivated = Warranty.TwoYear; yradioInstall3Year.BindValueWhenActivated = yradioTinting3Year.BindValueWhenActivated = yradioArmoring3Year.BindValueWhenActivated = yradioPasting3Year.BindValueWhenActivated = Warranty.ThreeYear; yradioInstallIndefinitely.BindValueWhenActivated = yradioTintingIndefinitely.BindValueWhenActivated = yradioArmoringIndefinitely.BindValueWhenActivated = yradioPastingIndefinitely.BindValueWhenActivated = Warranty.Indefinitely; yradioInstallNoWarranty.BindValueWhenActivated = yradioTintingNoWarranty.BindValueWhenActivated = yradioArmoringNoWarranty.BindValueWhenActivated = yradioPastingNoWarranty.BindValueWhenActivated = Warranty.NoWarranty; yradioInstallNone.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstall6Month.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstall1Year.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstall2Year.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstall3Year.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstallIndefinitely.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioInstallNoWarranty.Binding.AddBinding(Entity, e => e.WarrantyInstall, w => w.BindedValue).InitializeFromSource(); yradioTintingNone.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTinting6Month.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTinting1Year.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTinting2Year.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTinting3Year.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTintingIndefinitely.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioTintingNoWarranty.Binding.AddBinding(Entity, e => e.WarrantyTinting, w => w.BindedValue).InitializeFromSource(); yradioArmoringNone.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoring6Month.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoring1Year.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoring2Year.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoring3Year.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoringIndefinitely.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioArmoringNoWarranty.Binding.AddBinding(Entity, e => e.WarrantyArmoring, w => w.BindedValue).InitializeFromSource(); yradioPastingNone.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPasting6Month.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPasting1Year.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPasting2Year.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPasting3Year.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPastingIndefinitely.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); yradioPastingNoWarranty.Binding.AddBinding(Entity, e => e.WarrantyPasting, w => w.BindedValue).InitializeFromSource(); CellRendererToggle CellPay = new CellRendererToggle(); CellPay.Activatable = true; CellPay.Toggled += onCellPayToggled; Gtk.CellRendererSpin CellCost = new CellRendererSpin(); CellCost.Editable = true; CellCost.Digits = 2; Adjustment adjCost = new Adjustment(0, 0, 100000000, 100, 1000, 0); CellCost.Adjustment = adjCost; CellCost.Edited += OnCostSpinEdited; treeviewCost.AppendColumn("", CellPay, "active", 1); treeviewCost.AppendColumn("Название", new CellRendererText(), "text", 2); treeviewCost.AppendColumn("Стоимость", CellCost, RenderPriceColumn); setInTablePerformers(); ((CellRendererToggle)treeviewCost.Columns[0].CellRenderers[0]).Activatable = true; treeviewCost.Model = ServiceListStore; treeviewCost.ShowAll(); //fixme Изменить запрос var sql = "SELECT ser.id, ser.name, ser.price FROM services ser " + "JOIN service_order_type ordt on ser.id = ordt.id_service " + "JOIN order_type ord on ord.id = ordt.id_type_order " + "WHERE ord.name = @order_type ORDER BY ord.name"; var cmd = new MySqlCommand(sql, QSMain.connectionDB); cmd.Parameters.AddWithValue("@order_type", Entity.OrderTypeClass.Name.ToString()); using (MySqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { ServiceListStore.AppendValues(rdr.GetInt32("id"), false, rdr.GetString("name"), DBWorks.GetDouble(rdr, "price", 0), (long)-1, false, false, false ); } } ytreeOtherOrders.ColumnsConfig = ColumnsConfigFactory.Create <WorkOrder>() .AddColumn("Тип").AddTextRenderer(x => x.OrderTypeClass.Name) // x.OrderType.GetEnumTitle() .AddColumn("Состояние").AddTextRenderer(x => x.OrderState != null ? x.OrderState.Name : null) .AddSetter((c, x) => c.Background = x.OrderState != null ? x.OrderState.Color : null) .AddColumn("Дата").AddTextRenderer(x => x.Date.ToShortDateString()) .AddColumn("Марка").AddTextRenderer(x => x.CarModel != null ? x.CarModel.Brand.Name : null) .AddColumn("Модель").AddTextRenderer(x => x.CarModel != null ? x.CarModel.Name : null) .AddColumn("Еврокод").AddTextRenderer(x => x.Eurocode) .AddColumn("Производитель").AddTextRenderer(x => x.Manufacturer != null ? x.Manufacturer.Name : null) .AddColumn("Сумма").AddTextRenderer(x => x.Pays.Sum(p => p.Cost).ToString("C")) .AddColumn("Комментарий").AddTextRenderer(x => x.Comment) .AddColumn("Номер").AddTextRenderer(x => x.Id.ToString()) .Finish(); ytreeEuroCode.ColumnsConfig = ColumnsConfigFactory.Create <StoreItem>() .AddColumn("Еврокод").AddTextRenderer(x => x.EuroCode) .AddColumn("Производитель").AddTextRenderer(x => x.Manufacturer.Name) .AddColumn("Количество").AddNumericRenderer(x => x.Amount) .AddColumn("Цена").AddNumericRenderer(x => x.Cost) .Finish(); buttonPrint.Sensitive = !Entity.OrderTypeClass.IsOtherType; buttonSMSHistory.Visible = orderMessages.CountSentMessages() > 0; TestCanSave(); SetEuroCode(); Entity.PropertyChanged += Entity_PropertyChanged; }
private void RefreshCalendar(OrdersCalendar calendar) { if (0 != Interlocked.Exchange(ref calendar.InUpdatingState, 1)) { return; } try { var items = new ItemsList(); using (var connection = new MySqlConnection(QSMain.ConnectionString)) { connection.Open(); logger.Info("Запрос заказов на {0:d}", calendar._StartDate); string sql = "SELECT orders.*, models.name as model, marks.name as mark, status.color, stocks.name as stock, stocks.color as stockcolor, " + "status.name as status, manufacturers.name as manufacturer, tablesum.sum, order_type.name as order_type_name, " + "(SELECT COUNT(*) FROM sms_history WHERE sms_history.order_id = orders.id) as sent_messages " + "FROM orders " + "LEFT JOIN order_type ON order_type.id = orders.id_order_type " + "LEFT JOIN models ON models.id = orders.car_model_id " + "LEFT JOIN marks ON marks.id = models.mark_id " + "LEFT JOIN status ON status.id = orders.status_id " + "LEFT JOIN stocks ON stocks.id = orders.stock_id " + "LEFT JOIN manufacturers ON manufacturers.id = orders.manufacturer_id " + "LEFT JOIN (" + "SELECT order_id, SUM(cost) as sum FROM order_pays GROUP BY order_id) as tablesum " + "ON tablesum.order_id = orders.id " + "WHERE date BETWEEN @start AND @end " + "AND point_number = @point " + "AND calendar_number = @calendar "; MySqlCommand cmd = new MySqlCommand(sql, connection); cmd.Parameters.AddWithValue("@start", calendar._StartDate); cmd.Parameters.AddWithValue("@end", calendar._StartDate.AddDays(6)); cmd.Parameters.AddWithValue("@point", calendar.PointNumber); cmd.Parameters.AddWithValue("@calendar", calendar.CalendarNumber); using (MySqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { CalendarItem order = new CalendarItem( rdr.GetDateTime("date"), rdr.GetInt32("hour") ); order.id = rdr.GetInt32("id"); order.MessageCount = rdr.GetUInt32("sent_messages"); if (!QSMain.User.Permissions["worker"]) { order.FullText = String.Format("{9}\nСостояние: {0}\nАвтомобиль: {1} {2}\nЕврокод: {3}\nПроизводитель: {4}\nСклад:{5}\nТелефон: {6}\nСтоимость: {7:C}\n{8}", rdr["status"], rdr["mark"], rdr["model"], rdr["eurocode"], rdr["manufacturer"], rdr["stock"], rdr["phone"], DBWorks.GetDecimal(rdr, "sum", 0), rdr["comment"], rdr["order_type_name"] ); order.Text = String.Format("{0} {1}\n{2}\n{3}", rdr["mark"], rdr["model"], rdr["phone"], rdr["comment"]); order.DeleteOrder += OnDeleteOrder; order.OpenOrder += OnOpenOrder; order.TimeChanged += OnChangeTimeOrderEvent; } else { order.FullText = String.Format("{7}\nСостояние: {0}\nАвтомобиль: {1} {2}\nЕврокод: {3}\nПроизводитель: {4}\nСклад: {5}\n{6}", rdr["status"], rdr["mark"], rdr["model"], rdr["eurocode"], rdr["manufacturer"], rdr["stock"], rdr["comment"], rdr["order_type_name"] ); var firstStr = rdr["mark"] + " " + rdr["model"] + "\n"; var secondStr = rdr["eurocode"] + " " + rdr["manufacturer"] + " " + rdr["comment"]; String[] words = secondStr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); order.Text = firstStr; foreach (var word in words) { order.Text += word + "\n"; } } order.Color = DBWorks.GetString(rdr, "color", ""); order.TagColor = DBWorks.GetString(rdr, "stockcolor", ""); if (rdr["stock"].ToString().Length > 0 && rdr["stockcolor"] != DBNull.Value) { order.Tag = rdr["stock"].ToString().Substring(0, 1); } order.Calendar = calendar; int day = (order.Date - calendar._StartDate).Days; order.TypeItemButton = TypeItemOrButton.Order; items.AddItem(day, order.Hour, order); } } logger.Info($"Получено {items.Count} заказов"); logger.Info("Запрос расписания работы сотрудников на {0:d}...", calendar.StartDate); sql = "select shw.id, shw.date_work " + "from shedule_works shw " + "WHERE shw.date_work BETWEEN @start AND @end " + "AND shw.point_number = @point AND shw.calendar_number = @calendar"; List <CalendarItem> calendarItemsShedule = new List <CalendarItem>(); cmd = new MySqlCommand(sql, connection); cmd.Parameters.AddWithValue("@start", calendar.StartDate); cmd.Parameters.AddWithValue("@end", calendar.StartDate.AddDays(6)); cmd.Parameters.AddWithValue("@point", calendar.PointNumber); cmd.Parameters.AddWithValue("@calendar", calendar.CalendarNumber); using (MySqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { CalendarItem shedule = new CalendarItem(rdr.GetDateTime("date_work"), 23); shedule.id = rdr.GetInt32("id"); shedule.Tag = ""; shedule.Color = shedule.TagColor = GetBgColor(calendar); shedule.Calendar = calendar; shedule.DeleteOrder += OnDeleteShedule; shedule.OpenOrder += OnOpenSheduleWork; shedule.TypeItemButton = TypeItemOrButton.Shedule; calendarItemsShedule.Add(shedule); } } foreach (var sh in calendarItemsShedule) { sh.Text = getEmployeeInShedule(sh.id, connection); items.AddItem((sh.Date - calendar._StartDate).Days, 23, sh); } logger.Info("Запрос заметок на {0:d}...", calendar.StartDate); sql = "select id, date, message " + "FROM note " + "WHERE date BETWEEN @start AND @end " + "AND point_number = @point AND calendar_number = @calendar"; cmd = new MySqlCommand(sql, connection); cmd.Parameters.AddWithValue("@start", calendar.StartDate); cmd.Parameters.AddWithValue("@end", calendar.StartDate.AddDays(6)); cmd.Parameters.AddWithValue("@point", calendar.PointNumber); cmd.Parameters.AddWithValue("@calendar", calendar.CalendarNumber); using (MySqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { CalendarItem calendarItemNote = new CalendarItem(DateTime.Parse(rdr["date"].ToString()), 22); calendarItemNote.id = rdr.GetInt32("id"); calendarItemNote.Tag = ""; calendarItemNote.Color = calendarItemNote.TagColor = GetBgColor(calendar); calendarItemNote.Calendar = calendar; calendarItemNote.DeleteOrder += OnDeleteNote; calendarItemNote.OpenOrder += OnOpenNote; if (rdr["message"].ToString().Length > 400) { calendarItemNote.Text = rdr["message"].ToString().Substring(0, 400); } else { calendarItemNote.Text = rdr["message"].ToString(); } int day = (DateTime.Parse(rdr["date"].ToString()) - calendar._StartDate).Days; calendarItemNote.TypeItemButton = TypeItemOrButton.Note; items.AddItem(day, 22, calendarItemNote); } } logger.Info("Ok"); } Application.Invoke(delegate { calendar.Items = items; calendar.QueueDraw(); frmClientCalendar.QueueDraw(); }); } finally { Interlocked.Exchange(ref calendar.InUpdatingState, 0); } }