private void button4_Click(object sender, EventArgs e)
        {
            if (client == null || !client.IsConnected) {
                MessageBox.Show(@"Не удалось выполнить операцию: нет подключения к сервису.");
                return;
            }

            for (var i = 0; i < dataGridView1.Rows.Count; ++i) {
                var row = dataGridView1.Rows[i];
                var mask = Convert.ToInt32(row.Cells["Mask"].Value);
                if ((mask & (int) ModifiedMask.DELETED) != 0) {
                    var sId = row.Cells["Id"].Value.ToString();
                    try {
                        if (!string.IsNullOrEmpty(sId)) {
                            var id = Convert.ToInt32(sId);
                            client.RemoveStandartSize(id);
                        }
                    }
                    catch (Exception ex) {
                        MessageBox.Show(@"Не удалось удалить типо-размер. Исключение: " + ex.Message);
                    }
                }
                else if ((mask & (int) ModifiedMask.ADDED) != 0) {
                    try {
                        var standartSize = new StandartSize();
                        standartSize.Length = Convert.ToDouble(row.Cells["Length"].Value);
                        standartSize.Width = Convert.ToDouble(row.Cells["Width"].Value);
                        standartSize.Height = Convert.ToDouble(row.Cells["Height"].Value);
                        client.AddStandartSize(standartSize);
                    }
                    catch (Exception ex) {
                        MessageBox.Show(@"Не удалось добавить типо-размер. Исключение: " + ex.Message);
                    }
                }
                else if ((mask & (int)ModifiedMask.CHANGED) != 0) {
                    try {
                        var standartSize = new StandartSize();
                        standartSize.Id = Convert.ToInt32(row.Cells["Id"].Value);
                        standartSize.Length = Convert.ToDouble(row.Cells["Length"].Value);
                        standartSize.Width = Convert.ToDouble(row.Cells["Width"].Value);
                        standartSize.Height = Convert.ToDouble(row.Cells["Height"].Value);
                        client.EditStandartSize(standartSize);
                    }
                    catch (Exception ex) {
                        MessageBox.Show(@"Не удалось изменить типо-размер. Исключение: " + ex.Message);
                    }
                }
            }

            this.Close();
        }
Esempio n. 2
0
 public int AddStandartSize(long aSessionId, StandartSize aStandartSize)
 {
     try {
         logger.Debug("Сессия: " + aSessionId + " " +
                      "Запрос AddStandartSize(" + aStandartSize + ")");
         return gcsServer.AddStandartSize(aStandartSize);
     }
     catch (Exception ex) {
         logger.Error("Сессия: " + aSessionId + " Ошибка: " + ex.Message);
         return -1;
     }
 }
Esempio n. 3
0
 public void EditStandartSize(long aSessionId, StandartSize aStandartSize)
 {
     try {
         logger.Debug("Сессия: " + aSessionId + " " +
                      "Запрос EditStandartSize(" + aStandartSize + ")");
         gcsServer.EditStandartSize(aStandartSize);
     }
     catch (Exception ex) {
         logger.Error("Сессия: " + aSessionId + " Ошибка: " + ex.Message);
     }
 }
Esempio n. 4
0
        public void EditStandartSize(StandartSize aStandartSize)
        {
            standartSizes = null;
            var standartSize = new StandartSizeImpl {
                Id = aStandartSize.Id,
                Width = aStandartSize.Width,
                Height = aStandartSize.Height,
                Length = aStandartSize.Length
            };

            standartSizeReaderWriter.EditStandartSize(standartSize);
        }
Esempio n. 5
0
        public int AddStandartSize(StandartSize aStandartSize)
        {
            standartSizes = null;
            var standartSize = new StandartSizeImpl {
                Width = aStandartSize.Width,
                Height = aStandartSize.Height,
                Length = aStandartSize.Length
            };

            return standartSizeReaderWriter.AddStandartSize(standartSize);
        }
Esempio n. 6
0
        public void EditStandartSize(StandartSize aStandartSize)
        {
            standartSizes = null;
            var standartSize = new StandartSizeImpl {
                Id = aStandartSize.Id,
                Diameter = aStandartSize.Diameter
            };

            standartSizeReaderWriter.EditStandartSize(standartSize);
        }
Esempio n. 7
0
        public int AddStandartSize(StandartSize aStandartSize)
        {
            standartSizes = null;
            var standartSize = new StandartSizeImpl {
                Diameter = aStandartSize.Diameter
            };

            return standartSizeReaderWriter.AddStandartSize(standartSize);
        }