예제 #1
0
파일: Placement.cs 프로젝트: Ring-r/opt
 public BindingSource ObjectsBusy_BindingSource()
 {
     BindingSource bs = new BindingSource();
     for (int i = 0; i < objects_busy_numbers.Count; i++)
         bs.Add(new Rectangle { Pole = objects_busy_points[i].Copy, Vector = objects_sizes[objects_busy_numbers[i]].Copy });
     return bs;
 }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewPorts = new BindingSource();
            windows = new BindingSource();
            viewPorts.DataSource = typeof(ViewPort);
            windows.DataSource = typeof(ViewPortForm);

            if (File.Exists(configFile))
            {
                loadedCfg = Helpers.LoadConfig(configFile);
                viewPorts.DataSource = (BindingList<ViewPort>)loadedCfg.ViewPorts;

            }
            else
            {// should move this to helper
                MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
                   , MessageBoxOptions.ServiceNotification);
                this.Close();
            }

            foreach (ViewPort vp in viewPorts)
            {
                ViewPortForm vpWindow = new ViewPortForm(vp);
                vpWindow.Size = new Size(vp.SizeX, vp.SizeY);
                vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                vpWindow.Text = vp.Name;
                vpWindow.Show();
                vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
                windows.Add(vpWindow);
            }

        }
예제 #3
0
파일: Placement.cs 프로젝트: Ring-r/opt
 public BindingSource Objects_BindingSource()
 {
     BindingSource bs = new BindingSource();
     for (int i = 0; i < sort.Count; i++)
         bs.Add(objects_sizes[sort[i]]);
     return bs;
 }
 private void AddData(string sPathEn, string sPathVi)
 {
     try
     {
         string[] filePathEn = Directory.GetFiles(sPathEn, "*.ini");
         string[] filePathVi = Directory.GetFiles(sPathVi, "*.ini");
         var bindingSource = new BindingSource();
         data = new List<SimpleDataFile>();
         for (int i = 0; i < filePathEn.Length; i++)
         {
             string[] aPathVi = filePathVi.Where(w => (Path.GetFileName(w).Remove(0, 6) == Path.GetFileName(filePathEn[i]).Remove(0, 6))).ToArray();
             string pathvi = "";
             string Tenfilevi = "";
             if (aPathVi.Length > 0)
             {
                 pathvi = aPathVi[0];
                 Tenfilevi = Path.GetFileName(aPathVi[0]);
                 keyLang = Tenfilevi.Split('.')[0];
             }
             bindingSource.Add(new SimpleDataFile { Chon = false, TenFileEn = Path.GetFileName(filePathEn[i]), TenFileVi = Tenfilevi, PathEn = filePathEn[i], PathVi = pathvi });
             data.Add(new SimpleDataFile { Chon = false, TenFileEn = Path.GetFileName(filePathEn[i]), TenFileVi = Tenfilevi, PathEn = filePathEn[i], PathVi = pathvi });
         }
         gvEn.DataSource = bindingSource;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Có lỗi xảy ra khi load dữ liệu");
     }
 }
예제 #5
0
파일: Form1.cs 프로젝트: ergoe/MusicWizard
        private void button1_Click(object sender, EventArgs e)
        {
            //NavigateDirs nav = new NavigateDirs();

            nav.WalkDirectoryTree(di, FileTypes.FileExtensions.mp3);
            MusicFiles mList = nav.MusicFileList;
            BindingSource bindingSource = new BindingSource();

            foreach (MusicFile f in mList)
            {
                bindingSource.Add(f);
            }
            songGrid.AutoSize = true;
            songGrid.AutoResizeColumns();

            //Add checkbox Column
            DataGridViewColumn column = new DataGridViewCheckBoxColumn();
            column.DataPropertyName = "Copy";
            column.Name = "Copy Song";

            songGrid.Columns.Add(column);
            songGrid.Columns["songFormat"].Visible = false;
            songGrid.Columns["songLocation"].Visible = false;

            songGrid.DataSource = bindingSource;
        }
예제 #6
0
파일: SalesForm.cs 프로젝트: ErickMC/Llama
 private void clientIdComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     BindingSource clientBS = new BindingSource();
     clientBS.Add(clientLogic.GetClientByID( (int) clientIdComboBox.SelectedValue));
     showClient.DataSource = clientBS;
     refreshOrderBindings();
 }
예제 #7
0
 public BindingSource vincula(string itemCB)
 {
     eventoAplicacao evento = new eventoAplicacao();
     BindingSource novoEvento = new BindingSource();
     novoEvento.Add(evento.selectDTWhere(itemCB));
     return novoEvento;
 }
        /// <summary>
        /// Constructs the PlayersForm from a PlayerList
        /// </summary>
        /// <param name="list">contains a list of the players</param>
        public PlayersForm(PlayerList list)
        {
            InitializeComponent();
            playerList = list;
            source = new BindingSource();

            // Because PlayerComponents do not encapsulate all of their data within fields, we must adapt them to
            // do so that the UI can bind itself to the data source.
            // The adapter merely places all of the relevant data in fields, and allows us to change the player list before
            // commiting the changes to the actual player list.
            foreach (PlayerComponent player in list.GetChildren())
            {
                PlayerDataGridAdapter adapter = new PlayerDataGridAdapter(player, playerList);
                source.Add(adapter);
            }

            // Initialize Player List to bind data properly.
            uiPlayerList.AutoGenerateColumns = false;
            uiPlayerList.AutoSize = true;
            uiPlayerList.DataSource = source;

            name.DataPropertyName = "Player_Name";
            race.DataPropertyName = "RaceMember";
            gold.DataPropertyName = "GoldMember";
            wood.DataPropertyName = "WoodMember";
            metal.DataPropertyName = "MetalMember";
        }
 private void bTranslate_Click(object sender, EventArgs e)
 {
     Translator t = new Translator();
     var bindingSource = new BindingSource();
     pBar.Maximum = obj.List.Count;
     pBar.Value = 1;
     pBar.Step = 1;
     for (int i = 0; i < obj.List.Count; i++)
     {
         SimpleData temp = (SimpleData)obj.List[i];
         if (chkIsEmpty.Checked && temp.Vi == string.Empty)
         {
             temp = TranslateLang(t, temp);
             temp.Chon = true;
         }
         else if(chkFull.Checked)
         {
             temp = TranslateLang(t, temp);
         }
         bindingSource.Add(temp);
         pBar.PerformStep();
         pBar.Update();
     }
     gvData.DataSource = bindingSource;
     obj = bindingSource;
     gvData.Update();
 }
예제 #10
0
파일: Placement.cs 프로젝트: Ring-r/opt
 public BindingSource ObjectsFree_BindingSource()
 {
     BindingSource bs = new BindingSource();
     for (int i = 0; i < objects_free_numbers.Count; i++)
         bs.Add(objects_sizes[objects_free_numbers[i]]);
     return bs;
 }
 private void RefreshTable()
 {
     var paymentRequirements = _paymentRequirementService.GetAll();
     _paymentRequirementBindingSource = new BindingSource();
     paymentRequirements.ForEach(insurance => _paymentRequirementBindingSource.Add(insurance));
     paymentRequirementDataGridView.AutoGenerateColumns = true;
     paymentRequirementDataGridView.DataSource = _paymentRequirementBindingSource;
     paymentRequirementDataGridView.ReadOnly = true;
 }
 private void RefreshTable()
 {
     var insuranceCategories = _insuranceCategoryService.GetAll();
     _insuranceCategoryBindingSource = new BindingSource();
     insuranceCategories.ForEach(insuranceCase => _insuranceCategoryBindingSource.Add(insuranceCase));
     categoriesDataGridView.AutoGenerateColumns = true;
     categoriesDataGridView.DataSource = _insuranceCategoryBindingSource;
     categoriesDataGridView.ReadOnly = true;
 }
예제 #13
0
 private static BindingSource CreateBindingSource(IEnumerable<Session> sessions)
 {
     var bindingSource = new BindingSource();
       foreach(var s in sessions)
       {
     bindingSource.Add(s);
       }
       return bindingSource;
 }
예제 #14
0
 private void DataGridView_Load(object sender, EventArgs e)
 {
     var dataSource = new BindingSource();
     foreach (var person in Builder<Person>.CreateListOfSize(50).Build())
     {
         dataSource.Add(person);
     }
     dataGridView1.AutoGenerateColumns = true;
     dataGridView1.DataSource = dataSource;
 }
        public void SetResults(List<AllocationResult> results)
        {
            var bs = new BindingSource();

            foreach (var result in results)
            {
                bs.Add(result);
            }

            this.dataGridView1.DataSource = bs;
        }
예제 #16
0
        public NhapDiem(string ChucNang, string MaLop, BangDiem_ThongTin BD)
        {
            InitializeComponent();
            this.ChucNang = ChucNang;
            try
            {
                cbHocKy.DataSource = cls_HocKy.DanhSachHocKy();
                cbHocKy.DisplayMember = "TenHocKy";
                cbHocKy.ValueMember = "MaHocKy";

                cbMonHoc.DataSource = cls_MonHoc.DanhSachMonHoc();
                cbMonHoc.DisplayMember = "TenMonHoc";
                cbMonHoc.ValueMember = "MaMonHoc";
            }
            catch
            {
                MessageBox.Show("Lỗi kết nối, bạn hãy kiểm tra lại.", "Thông báo lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (ChucNang.Equals("F1"))
            {
                try
                {
                    SinhVien_ThongTin SV = new SinhVien_ThongTin();
                    SV.Lop = MaLop;
                    source = new BindingSource();
                    foreach (DataRow Hang in cls_SinhVien.DanhSachSinhVienCuaLop(SV).Rows)
                    source.Add(Hang);

                    //LẤY RA GIÁ TRỊ ĐẦU TIÊN.
                    source.MoveFirst();
                    ShowRecord();
                    XemDiemTheoKySinhVien();
                }
                catch
                {
                    MessageBox.Show("Lỗi kết nối, bạn hãy kiểm tra lại.", "Thông báo lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (ChucNang.Equals("ChinhSua"))
            {
                BangDiemSTT = BD.Stt;
                txtMaSinhVien.Text = BD.MaSinhVien;
                cbHocKy.SelectedValue = BD.MaHocKy;
                cbMonHoc.SelectedValue = BD.MaMonHoc;
                txtDiemQuaTrinh.Text = BD.DiemQuaTrinh.ToString();
                txtDiemThi.Text = BD.DiemThi.ToString();
                ChinhSua = "1";
                XacNhanXoa = "1";
                btXacNhan_QLD.Enabled = false;
                btChinhSua_QLD.Text = "Lưu lại.";
                txtDiemQuaTrinh.Focus();
            }
            txtDiemQuaTrinh.Focus();
        }
        public void SetResults(List<LocalityResult> results)
        {
            var bs = new BindingSource();

            foreach (var result in results)
            {
                bs.Add(result);
            }

            this.dg_patientlocality.DataSource = bs;
        }
예제 #18
0
        public void BindToObjectCollection <T, K>(ClassGenBindingList <T, K> list) where T : DocSQL_2017_BaseObject
        {
            _objectBound = false;
            if (this.Container != null)
            {
                _bindingSource = new System.Windows.Forms.BindingSource(this.Container);
            }
            else
            {
                _bindingSource = new System.Windows.Forms.BindingSource();
            }

            this.DataSource           = _bindingSource;
            _bindingSource.DataSource = typeof(T);
            //_bindingSource.DataSource = list[0].GetType();
            foreach (object o in list)
            {
                _bindingSource.Add(o);
            }
            _objectBound = true;
        }
예제 #19
0
        private void createAnnotation()
        {
            var whichbar = CurrentBar - ChartControl.LastBarPainted;
            var myt      = DrawText("anntxt" + tagno.ToString(), "x",
                                    whichbar, Low[whichbar] - TickSize,
                                    ChartControl.ChartStyle.Pen.Color);

            ++tagno;
            myt.AutoScale = true;
            myt.Locked    = false;
            bs.Add(new RWT.Annotation(anns.Count + 1, myt));
            ChartControl.ChartPanel.Invalidate(false);
        }
        private void goButton_Click(object sender, EventArgs e)
        {
            var address = addressTextBox.Text;

            var webRequest = WebRequest.Create(address);

            var response = webRequest.GetResponse();

            var bindingSource = new BindingSource();

            foreach (var key in response.Headers.AllKeys)
            {
                bindingSource.Add(new HeaderValue(key, response.Headers[key]));
            }

            headersDataGridView.DataSource = bindingSource;
            headersDataGridView.AutoSize = true;
        }
예제 #21
0
        private void ShowData(object sender, RunWorkerCompletedEventArgs e)
        {
            DoWithWaitingForm(() =>
                {
                    this.dataGridView1.AutoGenerateColumns = true;

                    BindingSource bindingSource = new BindingSource();
                    int numberOfRows = GetNumberOfRows();
                    foreach (Temperatures temperatures in (IEnumerable<Temperatures>)e.Result)
                    {
                        bindingSource.Add(temperatures);
                    }
                    this.dataGridView1.DataSource = bindingSource;

                    ToggleCopyToSqlButtonVisibility();
                }
            );
        }
예제 #22
0
 private void loadMore()
 {
     if (lastResult.TotalPages > lastResult.LastPageNo)
     {
         loading = true;
         BusyMessage.Show("Loading...", this.FindForm());
         var filter = loadFilterBar.Filter;
         using (var uow = UnitOfWorkFactory.CreateUnitOfWork())
         {
             lastResult = uow.GinLoadRepository.GetLoads(filter, pageSize, lastResult.LastPageNo + 1);
             foreach (var item in lastResult.ResultData)
             {
                 loadBindingSource.Add(item);
             }
             BusyMessage.Close();
         }
         loading = false;
     }
 }
예제 #23
0
 private void loadMore()
 {
     if (gridView.RowCount < lastResult.Total)
     {
         loading = true;
         BusyMessage.Show("Loading...", this.FindForm());
         var filter = pickupListFilterBar.Filter;
         using (var uow = UnitOfWorkFactory.CreateUnitOfWork())
         {
             PagedResult <PickupListEntity> result = uow.PickupListRepository.GetLists(filter, pageSize, lastResult.LastPageNo + 1, ConfigHelper.ModulesPerLoad);
             foreach (var list in lastResult.ResultData)
             {
                 listBindingSource.Add(list);
             }
             BusyMessage.Close();
         }
         loading = false;
     }
 }
예제 #24
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (douTotal == douRecibida)
     {
         if (ChekaLlenado())
         {
             var bisTmp = new BindingSource();
             for (var i = 0; i < dgvEntradaCaducidad.Rows.Count - 1; i++)
             {
                 var objTmp = new EntradaDetalle()
                 {
                     //IdEntradaDetalle = (long)dgvEntradaCaducidad[3, i].Value,
                     Articulo = ArticuloActual,
                     NoLote = dgvEntradaCaducidad[0, i].Value.ToString(),
                     Cantidad = Convert.ToDecimal(dgvEntradaCaducidad[1, i].Value.ToString()),
                     Existencia = Convert.ToDecimal(dgvEntradaCaducidad[1, i].Value.ToString()),
                     FechaCaducidad = Convert.ToDateTime(dgvEntradaCaducidad[2, i].Value.ToString()),
                     PrecioEntrada = douPrecioEntrada,
                     Clave = ArticuloActual.Id.CveArt
                 };
                 if (dgvEntradaCaducidad[3, i].Value!=null)
                 {
                     objTmp.IdEntradaDetalle = (long) dgvEntradaCaducidad[3, i].Value;
                 }
                 bisTmp.Add(objTmp);
             }
             FrmEntrada.lstEntradaDetalle.Add(bisTmp);
             bolModificacion = true;
             Close();
         }
         else
         {
             MessageBox.Show(@"Celda en Blanco, Verifique . .",
                            @"Almacenes", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show(@"Cantidad Total Debe ser Igual a la Cantidad Recibida, Verifique . .",
                            @"Almacenes", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #25
0
 private void btnDelete_Ini_Click(object sender, EventArgs e)
 {
     List<int> remove_index = new List<int>();
     foreach (DataGridViewRow row in gvCharExclude.Rows)
     {
         if (Convert.ToBoolean(row.Cells[0].Value) == true)
         {
             remove_index.Add(Convert.ToInt32(row.Cells[1].Value));
         }
     }
     common.RemoveIniDictionary(remove_index.ToArray());
     common.WriteDictionaryToFile(Config_Path + "\\" + Ini_Filename);
     Dictionary<int, string> dic = common.GetFileInfo();
     BindingSource source = new BindingSource();
     foreach (KeyValuePair<int, string> record in common.GetFileInfo())
     {
         source.Add(new IniFileObject(record.Key, record.Value));
     }
     gvCharExclude.DataSource = source;
 }
예제 #26
0
        private void CreateOrderForm_Load(object sender, EventArgs e)
        {
            BindingSource itemsBS = new BindingSource();
            var allItems = itemLogic.GetActiveItems();
            foreach (var item in allItems)
            {
                itemsBS.Add(item);
            }

            showItems.DataSource = itemsBS;

            for (int i = 6; i < 9; i++)
            {

                showItems.Columns[i].Visible = false;
            }
               cartBS= new BindingSource();
            currentCart.DataSource = cartBS;
            cartBS.DataSource = details;
        }
 private void RefreshTable()
 {
     var paymentDecisions = _paymentDecisionService.GetAll().FindAll(decision =>
     {
         if (clientFilter.SelectedItem != null &&
             !decision.PaymentRequirement.Insurance.Client.ToString().Equals(((Client)clientFilter.SelectedItem).ToString()))
             return false;
         if (insuranceNoFilter.SelectedItem != null &&
             !decision.PaymentRequirement.Insurance.InsuranceNo.ToString().Equals(((Insurance)insuranceNoFilter.SelectedItem).ToString()))
         {
             return false;
         }
         return true;
     });
     _paymentDecisionBindingSource = new BindingSource();
     paymentDecisions.ForEach(paymentDecision => _paymentDecisionBindingSource.Add(paymentDecision));
     paymentDecisionDataGridView.AutoGenerateColumns = true;
     paymentDecisionDataGridView.DataSource = _paymentDecisionBindingSource;
     paymentDecisionDataGridView.ReadOnly = true;
 }
예제 #28
0
파일: MainForm.cs 프로젝트: bleemus/YATP
        public MainForm()
        {
            InitializeComponent();

            foreach (var s in Settings.Default.Matchers)
            {
                _matchers.Add(new Matcher(s));
            }

            button2.BackColor = Color.Green;

            backgroundWorker1.WorkerReportsProgress = true;
            backgroundWorker1.DoWork += PulseLog;
            backgroundWorker1.ProgressChanged += BackgroundWorker1OnProgressChanged;

            textBox3.TextChanged += TextBox3OnTextChanged;

            _binder = new BindingSource();
            _matchers.ForEach(a => _binder.Add(a));
        }
예제 #29
0
        private void IniciaGrid()
        {
            grid = new DataGridView();
            grid.Width = 400;
            var clienteBD = new CamadaDAL.Repositorio.ClienteBD();
            var clientes = clienteBD.Listar();
            grid.Columns.AddRange(new DataGridViewColumn[]{
                new DataGridViewTextBoxColumn(){HeaderText = "Id", DataPropertyName = "Id", Width = 30},
                new DataGridViewTextBoxColumn(){HeaderText = "Nome", DataPropertyName = "Nome", Width = 200},
                new DataGridViewTextBoxColumn(){HeaderText = "Cidade", DataPropertyName = "Cidade", Width = 100}
            });

            grid.AutoGenerateColumns = false;
            BindingSource bs = new BindingSource();
            foreach (var c in clientes)
            {
                bs.Add(c);
            }
            grid.DataSource = bs;
            this.Controls.Add(grid);
        }
예제 #30
0
        public static BindingSource getRoles(SqlDataReader dataReader)
        {
            List<RolDTO> ListaRoles = new List<RolDTO>();
            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    RolDTO rol = new RolDTO();

                    rol.IdRol = Convert.ToInt32(dataReader["Id"]);
                    rol.Estado = Convert.ToBoolean(dataReader["Activo"]);
                    rol.NombreRol = Convert.ToString(dataReader["Nombre"]);

                    if (ListaRoles.Contains(rol))
                    {
                        RolDTO rol1 = ListaRoles.Find(delegate(RolDTO rolcito)
                        {
                            return rolcito.Equals(rol);
                        });

                        rol1.ListaFunc.Add(new FuncionalidadDTO(Convert.ToInt32(dataReader["Funcionalidad"]), Convert.ToString(dataReader["Descripcion"])));
                    }
                    else
                    {
                        rol.ListaFunc.Add(new FuncionalidadDTO(Convert.ToInt32(dataReader["Funcionalidad"]), Convert.ToString(dataReader["Descripcion"])));

                        ListaRoles.Add(rol);
                    }
                }
            }
            BindingSource bs = new BindingSource();

            foreach (RolDTO rol in ListaRoles)
            {
                bs.Add(rol);
            }
            dataReader.Close();
            dataReader.Dispose();
            return bs;
        }
예제 #31
0
    protected void ReadConversions()
    {
      string file;
      if (File.Exists("UnitConversions.ini"))
        file = File.ReadAllText("UnitConversions.ini", Encoding.UTF7);
      else if (File.Exists("..\\..\\UnitConversions.ini"))
        file = File.ReadAllText("..\\..\\UnitConversions.ini", Encoding.UTF7); //Allow the database.ini to sit in the same folder as the source files
      else
        throw new Exception("UnitConversions.ini not found.");
      Dictionary<string, Dictionary<string, string>> Units = ReadIni(file, new Dictionary<string, Dictionary<string, string>>());

      foreach (KeyValuePair<string, Dictionary<string, string>> kvp in Units)
      {
        BindingSource current = new BindingSource();
        current.DataSource = typeof(Conversion);

        List<string> OrderedKeys = new List<string>(kvp.Value.Keys);
        OrderedKeys.Sort();
        foreach (string s in OrderedKeys)
          try
          {
            if (s.StartsWith("cnv"))
            {
              Match m = s_ConversionRegex.Match(kvp.Value[s]);
              if (m.Success)
                current.Add(new Conversion(
                    double.Parse(m.Groups["Offset"].Value),
                    double.Parse(m.Groups["Factor"].Value),
                    m.Groups["Name"].Value));
            }
          }
          catch { }

        current.CurrentChanged += new EventHandler(ForceFormatting);
        m_UnitBindings[kvp.Key] = current;
        m_Formatters[kvp.Key] = new FormatterParserProvider(current);
      }
      m_FrmUnitSelection.UnitBindings = m_UnitBindings;
    }
예제 #32
0
        private void AddToDataToBindingSource(MasterType masterType, BindingSource source, ListBox listBox)
        {
            var universalMasterCreateForm = GlobalUtility.GetFormObject<UniversalMasterCreateForm>(FormConstants.UNIVERASAL_MASTER_CREATE_FORM);
            universalMasterCreateForm.IsNeedClosing = true;
            universalMasterCreateForm.MasterType = masterType;
            universalMasterCreateForm.ShowDialog();

            object obj = universalMasterCreateForm.CreatedItem;
            if (obj != null)
            {
                int index = 0;
                switch (masterType)
                {
                    case MasterType.PRODUCT_COLOR:
                        foreach (ProductColor type in source)
                        {
                            if (type.ColorId.Equals(((ProductColor)obj).ColorId))
                            {
                                listBox.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.PRODUCT_SIZE:
                        foreach (ProductSize type in source)
                        {
                            if (type.SizeId.Equals(((ProductSize)obj).SizeId))
                            {
                                listBox.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                }
                source.Add(obj);
                listBox.SelectedIndex = source.Count - 1;
                switch (masterType)
                {
                    case MasterType.PRODUCT_COLOR:
                        if(colorSelectedIndices!=null)
                        {
                            colorSelectedIndices.Add(source.Count - 1);
                        }
                        break;
                    case MasterType.PRODUCT_SIZE:
                        if(sizeSelectedIndices!=null)
                        {
                            sizeSelectedIndices.Add(source.Count -1 );
                        }
                        break;
                }
                Refresh();
            }
        }
예제 #33
0
        private void AddToDataToComboBox(MasterType masterType, ComboBox cbb1, BindingSource s)
        {
            var universalMasterCreateForm = GlobalUtility.GetFormObject<UniversalMasterCreateForm>(FormConstants.UNIVERASAL_MASTER_CREATE_FORM);
            universalMasterCreateForm.IsNeedClosing = true;
            universalMasterCreateForm.MasterType = masterType;
            universalMasterCreateForm.ShowDialog();

            object obj = universalMasterCreateForm.CreatedItem;
            if (obj != null)
            {
                int index = 0;
                switch (masterType)
                {
                    case MasterType.PRODUCT_TYPE:
                        foreach (ProductType type in cbb1.Items)
                        {
                            if (type.TypeId.Equals(((ProductType)obj).TypeId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.PRODUCT_SIZE:
                        foreach (ProductSize type in cbb1.Items)
                        {
                            if (type.SizeId.Equals(((ProductSize)obj).SizeId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.PRODUCT_COLOR:
                        foreach (ProductColor type in cbb1.Items)
                        {
                            if (type.ColorId.Equals(((ProductColor)obj).ColorId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.COUNTRY:
                        foreach (Country type in cbb1.Items)
                        {
                            if (type.CountryId.Equals(((Country)obj).CountryId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.DISTRIBUTOR:
                        foreach (Distributor type in cbb1.Items)
                        {
                            if (type.DistributorId.Equals(((Distributor)obj).DistributorId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.MANUFACTURER:
                        foreach (Manufacturer type in cbb1.Items)
                        {
                            if (type.ManufacturerId.Equals(((Manufacturer)obj).ManufacturerId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                    case MasterType.PACKAGER:
                        foreach (Packager type in cbb1.Items)
                        {
                            if (type.PackagerId.Equals(((Packager)obj).PackagerId))
                            {
                                cbb1.SelectedIndex = index;
                                return;
                            }
                            index++;
                        }
                        break;
                }
                s.Add(obj);
                cbb1.SelectedIndex = s.Count - 1;
                Refresh();
            }
        }
예제 #34
0
 private void SalePointSubStock_Load(object sender, EventArgs e)
 {
     SalePointEventArgs ea = new SalePointEventArgs();
     EventUtility.fireEvent(LoadDepartmentsEvent,this,ea);
     if(ea.DepartmentList!= null && ea.DepartmentList.Count > 0 )
     {
         cboDepartments.Items.Clear();
         BindingSource bdsDepartment = new BindingSource();
         bdsDepartment.DataSource = typeof(Department);
         foreach (Department department in ea.DepartmentList)
         {
             bdsDepartment.Add(department);
         }
         cboDepartments.DataSource = bdsDepartment;
         cboDepartments.DisplayMember = "DepartmentName";
     }
 }