private void txtConsulta_TextChanged(object sender, EventArgs e)
        {
            if (txtConsulta.Text.Contains(":"))
            {
                txtConsulta.Text = txtConsulta.Text.Replace(":", "@");
            }


            if (txtConsulta.Text.Contains("@"))
            {
                var consulta = txtConsulta.Text.Trim();
                var possicoes = txtConsulta.Text.AllIndexesOf("@");

                _parametros = new BindingList<DadosStoredProceduresParameters>();

                foreach (var posicao in possicoes)
                {
                    var nomeParametro = consulta.Substring(posicao, RetornaPosicaoFinalNomeParametro((posicao + 1), consulta));

                    if (_parametros.Count(p => p.ParameterName == nomeParametro)==0)
                    {
                        _parametros.Add(new DadosStoredProceduresParameters
                        {
                            ParameterName = nomeParametro,
                            DefineNull = true
                        });                        
                    }
                }
            }
            CarregaGridViewParametros();
        }
Ejemplo n.º 2
0
        public static BindingList<Employee> GenerateHardCodedEmployees ()
        {
            Employee em1 = new Employee("Jari", "Korppunen");
            em1.EmployeeId = 1;
            em1.SocialID = "120467-872J";
            em1.Title = "Toimitusjohtaja";
            em1.Salary = 4650;
            em1.ContractType = (int)Employee.ContractTypes.Permanent;
            em1.DateOfBirth = new DateTime(1967, 4, 12);
            em1.DateOfWorkStarted = new DateTime(1993, 2, 19);

            Employee em2 = new Employee("Eino", "Leino");
            em2.EmployeeId = 2;
            em2.SocialID = "01021920-852A";
            em2.Title = "Apulaissihteerin sijainen";
            em2.Salary = 1200;
            em2.ContractType = (int)Employee.ContractTypes.Permanent;
            em2.DateOfBirth = new DateTime(1920, 2, 1);
            em2.DateOfWorkStarted = new DateTime(1999, 2, 2);

            Employee em3 = new Employee("Kalervo", "Kullervo");
            em3.SocialID = "051293-1238";
            em3.EmployeeId = 3;
            em3.ContractType = (int)Employee.ContractTypes.PartTime;
            em3.DateOfBirth = new DateTime(1993, 12, 5);
            em3.DateOfWorkStarted = new DateTime(2014, 2, 9);

            BindingList<Employee> em = new BindingList<Employee>();
            em.Add(em1);
            em.Add(em2);
            em.Add(em3);

            return em;
        }
        //Input data into the list box
        public void updateListBox()
        {
            objectsInScene = new BindingList<object>();

            //Gets all objects from the input panel
            pointsInScene = getPoints();
            linesInScene = getLines();
            anglesInScene = getAngles();

            //Adds each object to one Binding List
            foreach (Point p in pointsInScene)
            {
                objectsInScene.Add(p);
            }
            foreach (Line l in linesInScene)
            {
                objectsInScene.Add(l);
            }
            foreach (Angle a in anglesInScene)
            {
                objectsInScene.Add(a);
            }

            //Converts the Binding List to appropriate strings, and puts this data in the list for the user
            objectListBox.DataSource = convertToString(objectsInScene);
        }
Ejemplo n.º 4
0
 public void TestDataBindingSubList()
 {
     var boundDataGridView = new BoundDataGridView
                                 {
                                     BindingContext = new BindingContext(),
                                     DataSource = new BindingListSource(),
                                 };
     using (boundDataGridView)
     {
         var columnIds = new[]
                             {
                                 PropertyPath.Root,
                                 PropertyPath.Parse("Sequence"),
                                 PropertyPath.Parse("AminoAcidsList!*.Code"),
                                 PropertyPath.Parse("Molecule!*"),
                             };
         var viewSpec = new ViewSpec()
             .SetColumns(columnIds.Select(id => new ColumnSpec().SetPropertyPath(id)))
             .SetSublistId(PropertyPath.Parse("AminoAcidsList!*"));
         var viewInfo = new ViewInfo(new DataSchema(), typeof (LinkValue<Peptide>), viewSpec);
         // ReSharper disable once UseObjectOrCollectionInitializer
         var innerList = new BindingList<LinkValue<Peptide>>();
         innerList.Add(new LinkValue<Peptide>(new Peptide("AD"), null));
         ((BindingListSource)boundDataGridView.DataSource).SetViewContext(new TestViewContext(viewInfo.DataSchema, new[]{new RowSourceInfo(innerList, viewInfo)}));
         Assert.AreEqual(2, boundDataGridView.Rows.Count);
         innerList.Add(new LinkValue<Peptide>(new Peptide("TISE"), null));
         Assert.AreEqual(6, boundDataGridView.Rows.Count);
     }
 }
Ejemplo n.º 5
0
        public IList<Material> AssembleWorkPegging()
        {
            IList<Material> MH = new BindingList<Material>();
            Material mh = new Material();
            Material mh1 = new Material();
            Material mh2 = new Material();

            //mh.name = "汽车";
            //mh.number = "1200";
            //mh.type = "21";
            //mh.versions = "";
            //mh.status = "";

            //mh1.name = "飞机";
            //mh1.number = "2200";
            //mh1.type = "213";
            //mh1.versions = "";
            //mh1.status = "";

            //mh2.name = "轮船";
            //mh2.number = "3200";
            //mh2.type = "211";
            //mh2.versions = "";
            //mh2.status = "";

            MH.Add(mh);
            MH.Add(mh1);
            MH.Add(mh2);
            return MH;
        }
Ejemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            var loadProviderDLLs = (ConfigurationManager.AppSettings["LoadProviderDLLs"] ?? "")
                .Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var dll in loadProviderDLLs)
                try
                {
                    Assembly.LoadFrom(dll);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Can't load: " + dll + "\n" + ex.ToString());
                }

            _connections = new BindingList<GeneratorConfig.Connection>();
            _tables = new BindingList<string>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
                _connections.Add(connection);

            if (!config.WebProjectFile.IsEmptyOrNull())
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
        }
Ejemplo n.º 7
0
        public IList<Material> AP()
        {
            IList<Material> Me = new BindingList<Material>();
            Material me = new Material();
            Material me1 = new Material();
            Material me2 = new Material();

            //me.name = "孙悟空";
            //me.number = "1101";
            //me.type = "异种";
            //me.versions = "老大";

            //me1.name = "猪八戒";
            //me1.number = "1201";
            //me1.type = "元帅";
            //me1.versions = "老二";

            //me2.name = "沙和尚";
            //me2.number = "1302";
            //me2.type = "将军";
            //me2.versions = "老三";

            Me.Add(me);
            Me.Add(me1);
            Me.Add(me2);
            return Me;
        }
Ejemplo n.º 8
0
 private void MealTime_Load(object sender, EventArgs e)
 {
     try
     {
         if (Equals(null, _controller))
         {
             foreach (Control control in this.Controls)
             {
                 if (0 != String.Compare(control.Text, "Cancel", false))
                     control.Enabled = false;
             }
             return;
         }
         BindingList<Nom> noms = new BindingList<Nom>();
         if (_meal.MyCat.DietIsRestricted)
         {
             foreach (Nom nom in _meal.MyCat.NomsAsList)
                 noms.Add(nom);
             _selectNom.DropDownStyle = ComboBoxStyle.DropDownList;
         }
         else
         {
             foreach (Nom nom in _controller.GetNoms())
                 noms.Add(nom);
             _selectNom.DropDownStyle = ComboBoxStyle.DropDown;
         }
         _selectNom.DataSource = noms;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         Debug.WriteLine(ex.StackTrace);
     }
 }
Ejemplo n.º 9
0
 public TestSuiteState()
 {
     Variables = new BindingList<string>();
     ConnectionStringNames = new BindingList<string>();
     TestCases = new DataTable();
     Tests = new LargeBindingList<Test>();
     Settings = new BindingList<Setting>();
     Settings.Add(new Setting() { Name = "Default - System-under-test" });
     Settings.Add(new Setting() { Name = "Default - Assert" });
 }
 BindingList<PersonRegistration> CreateData()
 {
     BindingList<PersonRegistration> res = new BindingList<PersonRegistration>();
         res.Add(AddPersonRegistration(res.Count + 1, "Andrew", "Fuller", 42, "*****@*****.**", DateTime.Today.AddDays(-32)));
         res.Add(AddPersonRegistration(res.Count + 1, "Nancy", "Davolio", 34, "*****@*****.**", DateTime.Today.AddDays(4)));
         res.Add(AddPersonRegistration(res.Count + 1, "Margaret", "Peackop", 48, "margaret.peackop.devexpress.com", DateTime.Today.AddDays(6)));
         res.Add(AddPersonRegistration(res.Count + 1, "Robert", "K", 29, "*****@*****.**", DateTime.Today.AddDays(5)));
         res.Add(AddPersonRegistration(res.Count + 1, "Anne", "Dodsworth", 17, "*****@*****.**", DateTime.Today.AddDays(4)));
         return res;
 }
Ejemplo n.º 11
0
        private BindingList<Customer> GetCustomers()
        {
            BindingList<Customer> customers = new BindingList<Customer>();
            customers.Add(new Customer("David"));
            customers.Add(new Customer("Andrew"));
            customers.Add(new Customer("Bob"));
            customers.Add(new Customer("Chris"));

            return customers;
        }
Ejemplo n.º 12
0
 void InitGrid()
 {
     BindingList<Person> gridDataList = new BindingList<Person>();
     gridDataList.Add(new Person("John", "Smith"));
     gridDataList.Add(new Person("Gabriel", "Smith"));
     gridDataList.Add(new Person("Ashley", "Smith", "some comment"));
     gridDataList.Add(new Person("Adrian", "Smith", "some comment"));
     gridDataList.Add(new Person("Gabriella", "Smith", "some comment"));
     gridControl.DataSource = gridDataList;
 }
 public SqlLoginPage()
 {
     InitializeComponent();
     BindingList<AutheticationMapper> autheticationmapper = new BindingList<AutheticationMapper>();
     autheticationmapper.Add(new AutheticationMapper("Window Authentication", 1));
     autheticationmapper.Add(new AutheticationMapper("SQL Server Authentication", 2));
     drpAuthenticationType.DataSource = autheticationmapper;
     drpAuthenticationType.DisplayMember = "AuthType";
     drpAuthenticationType.ValueMember = "ID";
 }
Ejemplo n.º 14
0
        public static BindingList<ComboboxData> GetGioiTinh()
        {
            BindingList<ComboboxData> ls = new BindingList<ComboboxData>();
            ComboboxData data1 = new ComboboxData("Nam", "1");
            ComboboxData data2 = new ComboboxData("Nữ", "0");

            ls.Add(data1);
            ls.Add(data2);
            return ls;
        }
Ejemplo n.º 15
0
        public static BindingList<ComboboxData> GetKhuVucSong()
        {
            BindingList<ComboboxData> ls = new BindingList<ComboboxData>();
            ComboboxData data1 = new ComboboxData("K1", "K1");
            ComboboxData data2 = new ComboboxData("K2", "K2");
            ComboboxData data3 = new ComboboxData("K3", "K3");

            ls.Add(data1);
            ls.Add(data2);
            ls.Add(data3);
            return ls;
        }
    public BondStructureFwdAnalysis(BondStructure structure_)
    {
      m_asOfAte = CarbonHistoricRetriever.GetDateForward(DateTime.Today, -1);
      m_fwdDate = CarbonHistoricRetriever.GetDateForward(AsOfSettleDate, 1, Symmetry.Carbon.Model.DateUnit.M);
      m_structure = structure_;

      Lines = new BindingList<BondStructureFwdAnalysisLine>();
      foreach (var v in structure_.Components)
        Lines.Add(new BondStructureFwdAnalysisLine(this,v));
      Lines.Add(CombinedLine= new BondStructureFwdAnalysisLine("Combined"));

    }
Ejemplo n.º 17
0
 public IList<Menus> findRelatedMenu(int roleId)
 {
     IList<Menus> list = new BindingList<Menus>();
     Menus menu = new Menus();
     menu.Id = 1;
     menu.Name = "系统管理工具";
     Menus menu1 = new Menus();
     menu1.Id = 2;
     menu1.Name = "项目管理";
     list.Add(menu);
     list.Add(menu1);
     return list;
 }
Ejemplo n.º 18
0
 public IList<Operation> findRelatedOperation(int roleId)
 {
     IList<Operation> list = new BindingList<Operation>();
     Operation operation = new Operation();
     operation.Id = 1;
     operation.Name = "删除";
     Operation operation1 = new Operation();
     operation1.Id = 1;
     operation1.Name = "添加";
     list.Add(operation);
     list.Add(operation1);
     return list;
 }
Ejemplo n.º 19
0
        private void InitializeListOfParts()
        {
            parts = new BindingList<Part>
            {
                AllowNew = true,
                AllowRemove = false,
                RaiseListChangedEvents = true,
                AllowEdit = false
            };

            // Add a couple of parts to the list.
            parts.Add(new Part("Widget", 1234));
            parts.Add(new Part("Gadget", 5647));
        }
Ejemplo n.º 20
0
        public Statistics()
        {
            InitializeComponent();
            //Initializing Lists
            AllHistory = new BindingList<RunEntry>();
            ANSHistory = new BindingList<RunEntry>();
            KXRHistory = new BindingList<RunEntry>();
            TREHistory = new BindingList<RunEntry>();
            TRSHistory = new BindingList<RunEntry>();

            foreach (RunEntry entry in ComponentTestSelect.PassedHistory)
            {
                AllHistory.Add(entry);
            }
            foreach (RunEntry entry in ComponentTestSelect.FailedHistory)
            {
                AllHistory.Add(entry);
            }
            foreach(RunEntry entry in AllHistory)
            {
                if(entry.FileName.EndsWith(".ans", StringComparison.OrdinalIgnoreCase))
                {
                    ANSHistory.Add(entry);
                }
                else if (entry.FileName.EndsWith(".kxr", StringComparison.OrdinalIgnoreCase))
                {
                    KXRHistory.Add(entry);
                }
                else if (entry.FileName.EndsWith(".tre", StringComparison.OrdinalIgnoreCase))
                {
                    TREHistory.Add(entry);
                }
                else if (entry.FileName.EndsWith(".trs", StringComparison.OrdinalIgnoreCase))
                {
                    TRSHistory.Add(entry);
                }
                else
                {

                }
            }

            this.AllHistoryBox.DataSource = AllHistory;
            this.ANSHistoryBox.DataSource = ANSHistory;
            this.KXRHistoryBox.DataSource = KXRHistory;
            this.TREHistoryBox.DataSource = TREHistory;
            this.TRSHistoryBox.DataSource = TRSHistory;

            _processStats();
        }
 protected void OnPathChanged()
 {
     Files = new BindingList<FileObject>();
     if(Directory.Exists(Path)) {
         var directories  =  Directory.GetDirectories(Path);
         foreach(var item in directories) {
             Files.Add(new FileObject() { Name = item });
         }
         var files = Directory.GetFiles(Path);
         foreach(var item in directories) {
             Files.Add(new FileObject() { Name = item });
         }
     }
 }
        public void TestSaveAndLoadJointShows()
        {
            BindingList<IJointShow> shows = new BindingList<IJointShow>();
            IJointShow testShow1 = new JointShow("Test show 1");
            IJointShow testShow2 = new JointShow("Test show 2");
            IJointShow testShow3 = new JointShow("Test show 3");
            shows.Add(testShow1);
            shows.Add(testShow2);
            shows.Add(testShow3);

            _loader.StoreJointShows(SaveName, shows);

            BindingList<IJointShow> loadedShows = _loader.LoadJointShows(SaveName);
            AssertMatchShows(shows, loadedShows);
        }
Ejemplo n.º 23
0
        public IList<Material> GetMaterialcsMessage()
        {
            IList<Material> list = new BindingList<Material>();
            Material M = new Material();
            Material Ma = new Material();
            Material Mb = new Material();
            //M.number = "1";
            //Ma.number = "2";
            //Mb.number = "3";

            list.Add(M);
            list.Add(Ma);
            list.Add(Mb);
            return list;
        }
Ejemplo n.º 24
0
        // Set the languages for the selected project within the languages UI list
        private void AddNewLanguages(ProjectDetails selectedProject)
        {
            try
            {
                var selectedProjectToExport = _projectsDataSource?.FirstOrDefault(e => e.ShouldBeExported && e.ProjectName.Equals(selectedProject.ProjectName));

                if (selectedProjectToExport?.ProjectLanguages != null)
                {
                    foreach (var language in selectedProjectToExport.ProjectLanguages.ToList())
                    {
                        var languageDetails = _languages?.FirstOrDefault(n => n.LanguageName.Equals(language.Key));
                        if (languageDetails == null)
                        {
                            var newLanguage = new LanguageDetails {
                                LanguageName = language.Key, IsChecked = true
                            };
                            _languages?.Add(newLanguage);
                        }
                    }
                }

                languagesListBox.DataSource    = _languages;
                languagesListBox.DisplayMember = "LanguageName";
                languagesListBox.ValueMember   = "IsChecked";
            }
            catch (Exception ex)
            {
                Log.Logger.Error($"AddNewLanguages method: {ex.Message}\n {ex.StackTrace}");
            }
        }
		private void MakeMaterialsPage()
			{
			Materials = new BindingList<MaterialDataBinder>();
			foreach( MaterialData material in Application.OpenedProject.Materials )
				Materials.Add( new MaterialDataBinder( new MaterialData( material ) ) );
			listBoxMedium.DataSource = Materials;
			}
        /// <summary>
        /// Converts a value. 
        /// </summary>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            AudioTrack track = value as AudioTrack;
            if (track != null && track.ScannedTrack != null)
            {
                HBAudioEncoder encoder =
                    HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder));

                BindingList<HBMixdown> mixdowns = new BindingList<HBMixdown>();
                foreach (HBMixdown mixdown in HandBrakeEncoderHelpers.Mixdowns)
                {
                    if (HandBrakeEncoderHelpers.MixdownIsSupported(
                        mixdown,
                        encoder,
                        track.ScannedTrack.ChannelLayout))
                    {
                        mixdowns.Add(mixdown);
                    }
                }

                return mixdowns;
            }

            return value;
        }
Ejemplo n.º 27
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyApp = new Excel.Application();
            MyApp.Visible = false;
            MyBook = MyApp.Workbooks.Open(path);
            MySheet = (Excel.Worksheet)MyBook.Sheets[1];
            lastrow = MySheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Row;

            BindingList<Dompet> DompetList = new BindingList<Dompet>();

            for (int index = 2; index <= lastrow; index++)
            {
                System.Array MyValues = 
                    (System.Array)MySheet.get_Range
                    ("A" + index.ToString(),"F" + index.ToString()).Cells.Value;
                DompetList.Add(new Dompet {
                    JmlPemesanan = MyValues.GetValue(1,1).ToString(),
                    JmlPekerja = MyValues.GetValue(1,2).ToString(),
                    Peralatan = MyValues.GetValue(1,3).ToString(),
                    JenisKulit = MyValues.GetValue(1,4).ToString(),
                    ModelDompet = MyValues.GetValue(1,5).ToString(),
                    Prediksi = MyValues.GetValue(1,6).ToString()
                });
            }
            dataGridView1.DataSource = (BindingList<Dompet>)DompetList;
            dataGridView1.AutoResizeColumns();
        }
Ejemplo n.º 28
0
        public SchemaDesignContext(FdoConnection conn)
        {
            _spatialContexts = new BindingList<SpatialContextInfo>();

            if (conn == null)
            {
                _schemas = new FeatureSchemaCollection(null);
                _mappings = new PhysicalSchemaMappingCollection();
            }
            else
            {
                using (var svc = conn.CreateFeatureService())
                {
                    _schemas = svc.DescribeSchema();
                    _mappings = svc.DescribeSchemaMapping(true);
                    if (_mappings == null)
                        _mappings = new PhysicalSchemaMappingCollection();

                    var spatialContexts = svc.GetSpatialContexts();
                    foreach (var sc in spatialContexts)
                    {
                        _spatialContexts.Add(sc);
                    }
                }
            }

            this.Connection = conn;

            EvaluateCapabilities();
        }
Ejemplo n.º 29
0
        public BindingList<RowModel> ReadData()
        {
            var list = new BindingList<RowModel>();

            string text = File.ReadAllText(FileName);

            string[] lines = text.Split('\n');

            foreach (var line in lines)
            {
                if (string.IsNullOrEmpty(line.Trim()))
                {
                    continue;
                }

                var values = line.Split(',');

                var id = int.Parse(values[0].Trim().Trim('\r'));
                var description = values[1].Trim().Trim('\r');
                var state = (State)Enum.Parse(typeof(State), values[2].Trim().Trim('\r'));
                var isCompleted = bool.Parse(values[3].Trim().Trim('\r'));

                var model = new RowModel
                {
                    Id = id,
                    Description = description,
                    State = state,
                    IsCompleted = isCompleted,
                };

                list.Add(model);
            }

            return list;
        }
Ejemplo n.º 30
0
        public BindingList<GiftCard> GetAll(Cliente clienteOrigen)
        {
            var result = SqlDataAccess.ExecuteDataTableQuery(ConfigurationManager.ConnectionStrings["GrouponConnectionString"].ToString(),
                "GRUPO_N.GetGiftCardCliente", SqlDataAccessArgs
                .CreateWith("@ID_Cliente", clienteOrigen.UserID).Arguments);
            var data = new BindingList<GiftCard>();
            if (result != null && result.Rows != null)
            {
                foreach (DataRow row in result.Rows)
                {
                    data.Add(new GiftCard()
                    {
                        Credito = double.Parse(row["Credito"].ToString()),
                        Fecha = Convert.ToDateTime(row["Fecha"]),
                        ClienteOrigen = new Cliente()
                        {
                            UserName = row["ClienteOrigen"].ToString()
                        },
                        ClienteDestino = new Cliente()
                        {
                            UserName = row["ClienteDestino"].ToString()
                        }
                    });
                }
            }

            return data;
        }
Ejemplo n.º 31
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create and populate the list of DemoCustomer objects
            // which will supply data to the DataGridView.
            BindingList<DemoCustomer> customerList = new BindingList<DemoCustomer>();
            customerList.Add(DemoCustomer.CreateNewCustomer());
            customerList.Add(DemoCustomer.CreateNewCustomer());
            customerList.Add(DemoCustomer.CreateNewCustomer());

            // Bind the list to the BindingSource.
            this.customersBindingSource.DataSource = customerList;

            // Attach the BindingSource to the DataGridView.
            this.customersDataGridView.DataSource =
                this.customersBindingSource;
        }
Ejemplo n.º 32
0
 public static void AddRange <T>(this BindingList <T> list, IEnumerable <T> items)
 {
     _ = items ?? throw new ArgumentNullException(nameof(items));
     foreach (T item in items)
     {
         list?.Add(item);
     }
 }
Ejemplo n.º 33
0
        private void btnToStorage_Click(object sender, EventArgs e)
        {
            if (lbIngredients.SelectedItem == null)
                return;

            int calory = int.Parse(tbCalories.Text);
            calory -= ((Product)lbIngredients.SelectedItem).Calories;
            tbCalories.Text = calory.ToString();

            _productsList?.Add((Product)lbIngredients.SelectedItem);
            _ingList?.Remove((Product)lbIngredients.SelectedItem);
        }
Ejemplo n.º 34
0
 public void AddNewPlan(Plan plan)
 {
     _plans?.Add(plan);
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Listar las Tripulaciones registradas en el sistema.
        /// </summary>
        /// <returns>Lista de las Tripulaciones registradas en el sistema</returns>
        public BindingList <Tripulacion> listarTripulaciones(string b, DateTime f)
        {
            BindingList <Tripulacion> tripulaciones = new BindingList <Tripulacion>();

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectTripulaciones");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@filtro", b, SqlDbType.VarChar);
            _manejador.agregarParametro(comando, "@fecha", f, SqlDbType.Date);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    short  id_tripulacion = (short)datareader["ID_Tripulacion"];
                    int    ruta           = (int)datareader["Ruta"];
                    string descripcion    = (string)datareader["Descripcion"];
                    string observaciones  = (string)datareader["Observaciones"];



                    int    id_chofer               = (int)datareader["ID_Chofer"];
                    string nombre_chofer           = (string)datareader["Nombre_Chofer"];
                    string primer_apellido_chofer  = (string)datareader["PrimerApellido_Chofer"];
                    string segundo_apellido_chofer = (string)datareader["SegundoApellido_Chofer"];
                    string identificacion_chofer   = (string)datareader["Identificacion_Chofer"];

                    int    id_custodio               = (int)datareader["ID_Custodio"];
                    string nombre_custodio           = (string)datareader["Nombre_Custodio"];
                    string primer_apellido_custodio  = (string)datareader["PrimerApellido_Custodio"];
                    string segundo_apellido_custodio = (string)datareader["SegundoApellido_Custodio"];
                    string identificacion_custodio   = (string)datareader["Identificacion_Custodio"];

                    int    id_portavalor               = (int)datareader["ID_Portavalor"];
                    string nombre_portavalor           = (string)datareader["Nombre_Portavalor"];
                    string primer_apellido_portavalor  = (string)datareader["PrimerApellido_Portavalor"];
                    string segundo_apellido_portavalor = (string)datareader["SegundoApellido_Portavalor"];
                    string identificacion_portavalor   = (string)datareader["Identificacion_Portavalor"];


                    int    id_usuario               = (int)datareader["ID_Usuario"];
                    string nombre_usuario           = (string)datareader["Nombre_Usuario"];
                    string primer_apellido_usuario  = (string)datareader["PrimerApellido_Usuario"];
                    string segundo_apellido_usuario = (string)datareader["SegundoApellido_Usuario"];
                    string identificacion_usuario   = (string)datareader["Identificacion_Usuario"];


                    Colaborador chofer     = new Colaborador(id_chofer, nombre_chofer, primer_apellido_chofer, segundo_apellido_chofer, identificacion_chofer);
                    Colaborador custodio   = new Colaborador(id_custodio, nombre_custodio, primer_apellido_custodio, segundo_apellido_custodio, identificacion_custodio);
                    Colaborador portavalor = new Colaborador(id_portavalor, nombre_portavalor, primer_apellido_portavalor, segundo_apellido_portavalor, identificacion_portavalor);
                    Colaborador usuario    = new Colaborador(id_usuario, nombre_usuario, primer_apellido_usuario, segundo_apellido_usuario, identificacion_usuario);


                    short       id_atm                  = (short)datareader["ID_Vehiculo"];
                    string      modelo                  = (string)datareader["Modelo"];
                    string      placa                   = (string)datareader["Placa"];
                    int         numeroasoc              = (Int32)datareader["NumeroAsociado"];
                    int         ordensalida             = (Int32)datareader["OrdenSalida"];
                    int         id_dispositivo          = (Int32)datareader["ID_Dispositivo"];
                    string      serial                  = (string)datareader["Serial"];
                    string      descripcion_dispositivo = (string)datareader["Descripcion_Dispositivo"];
                    Vehiculo    vehiculo                = new Vehiculo(placa: placa, modelo: modelo, numeroasociado: numeroasoc, id: id_atm);
                    Dispositivo dispositivo             = new Dispositivo(nombre: serial, id: id_dispositivo, descripcion: descripcion_dispositivo);

                    AsignacionEquipo asignacion = null;

                    if (datareader["ID_Asignacion"] != DBNull.Value)
                    {
                        int idasignacion = (int)datareader["ID_Asignacion"];

                        asignacion = new AsignacionEquipo(id: idasignacion);
                    }


                    Tripulacion tripulacion = new Tripulacion(nombre: descripcion, ruta: ruta, chofer: chofer, custodio: custodio, portavalor: portavalor, id: id_tripulacion, usuario: usuario, observaciones: observaciones, v: vehiculo, ordenSalida: ordensalida, disp: dispositivo);
                    tripulacion.Asignaciones = asignacion;
                    tripulaciones.Add(tripulacion);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(tripulaciones);
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Obtiene los datos de los equipos asignados a un colaborador
        /// </summary>
        /// <param name="asignado">Objeto Colaborador con los datos del colaborador a buscar</param>
        /// <param name="asignacion">ID de la asignacion de equipos para esa tripulacion y ese dia</param>
        public void listarEquiposColaborador(ref Colaborador asignado, int asignacion)
        {
            BindingList <Equipo> equipos = new BindingList <Equipo>();

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectColaboradorEquipos");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@asignaciones", asignacion, SqlDbType.Int);
            _manejador.agregarParametro(comando, "@colaborador", asignado, SqlDbType.Int);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    int    id           = (int)datareader["pk_ID"];
                    string serie        = (string)datareader["Serie"];
                    string codigobarras = (string)datareader["Codigo_Barras"];
                    string idasignacion = (string)datareader["Codigo_Asignado"];

                    ATM atm = null;


                    if (datareader["ID_ATM"] != DBNull.Value)
                    {
                        short         id_atm           = (short)datareader["ID_ATM"];
                        short         numero           = (short)datareader["Numero"];
                        TiposCartucho tipo             = (TiposCartucho)datareader["Tipo"];
                        byte          cartuchos        = (byte)datareader["Cartuchos"];
                        bool          externo          = (bool)datareader["Externo"];
                        bool          full             = (bool)datareader["ATM_Full"];
                        bool          ena              = (bool)datareader["ENA"];
                        bool          vip              = (bool)datareader["VIP"];
                        bool          cartucho_rechazo = (bool)datareader["Cartucho_Rechazo"];
                        string        codigo           = (string)datareader["Codigo"];
                        string        oficinas         = (string)datareader["Oficinas"];
                        byte?         periodo_carga    = datareader["Periodo_Carga"] as byte?;

                        EmpresaTransporte empresa_encargada = null;

                        if (datareader["ID_Transportadora"] != DBNull.Value)
                        {
                            byte   id_empresa_encargada = (byte)datareader["ID_Transportadora"];
                            string nombre = (string)datareader["Nombre_Transportadora"];

                            empresa_encargada = new EmpresaTransporte(nombre, id: id_empresa_encargada);
                        }

                        Sucursal sucursal = null;



                        Ubicacion ubicacion = null;

                        if (datareader["ID_Ubicacion"] != DBNull.Value)
                        {
                            short  id_ubicacion = (short)datareader["ID_Ubicacion"];
                            string oficina      = (string)datareader["Oficina"];
                            string direccion    = (string)datareader["Direccion"];

                            ubicacion = new Ubicacion(oficina, direccion, id: id_ubicacion);
                        }

                        atm = new ATM(id: id_atm, numero: numero, empresa_encargada: empresa_encargada, tipo: tipo,
                                      cartuchos: cartuchos, externo: externo, full: full, ena: ena,
                                      vip: vip, cartucho_rechazo: cartucho_rechazo, codigo: codigo,
                                      oficinas: oficinas, periodo_carga: periodo_carga, sucursal: sucursal,
                                      ubicacion: ubicacion);
                    }



                    Colaborador colaborador = null;

                    if (datareader["Colaborador"] != DBNull.Value)
                    {
                        int    id_colaborador   = (int)datareader["ID_Colaborador"];
                        string nombre           = (string)datareader["Nombre"];
                        string primer_apellido  = (string)datareader["Primer_Apellido"];
                        string segundo_apellido = (string)datareader["Segundo_Apellido"];
                        string identificacion   = (string)datareader["Identificacion"];
                        string cuenta           = datareader["Cuenta"] as string;


                        colaborador = new Colaborador(id: id, nombre: nombre, primer_apellido: primer_apellido,
                                                      segundo_apellido: segundo_apellido, identificacion: identificacion,
                                                      cuenta: cuenta);
                    }



                    Manojo manojo = null;

                    if (datareader["Manojo"] != DBNull.Value)
                    {
                        int    id_manojo          = (int)datareader["ID_Manojo"];
                        string descripcion_manojo = (string)datareader["Descripcion_Manojo"];

                        manojo = new Manojo(id: id_manojo, descripcion: descripcion_manojo);
                    }

                    TipoEquipo tipoequipo = null;

                    if (datareader["TipoEquipo"] != DBNull.Value)
                    {
                        int    tipoequipoid           = (int)datareader["TipoEquipo"];
                        string tipoequipo_descripcion = (string)datareader["TipoEquipoDescripcion"];
                        bool   obligatorio            = (bool)datareader["TipoEquipoObligatorio"];

                        tipoequipo = new TipoEquipo(id: tipoequipoid, descripcion: tipoequipo_descripcion, obligatorio: obligatorio);
                    }

                    int id_asignacion_equipo = 0;

                    if (datareader["ID_Asignacion_Equipo"] != DBNull.Value)
                    {
                        id_asignacion_equipo = (int)datareader["ID_Asignacion_Equipo"];
                    }

                    Equipo equipo = new Equipo(id: id, serie: serie, idasignacion: idasignacion, atm: atm, col: colaborador, man: manojo, codigobarras: codigobarras, tipoequipo: tipoequipo, idasignacionequipo: id_asignacion_equipo);

                    equipos.Add(equipo);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            asignado.Equipos = equipos;
        }
Ejemplo n.º 37
0
        private void LireNoeud_Complement(XmlNode pNode, BindingList <TComplement> pListe)
        {
            TComplement complement = new TComplement();

            pListe.Add(complement);

            foreach (XmlNode nodeChamp in pNode.ChildNodes)
            {
                if (nodeChamp.Name == "IdComplement")
                {
                    complement.IdComplement = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "NomCommercial")
                {
                    complement.NomCommercial = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "Marque")
                {
                    complement.Marque = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "FormeGalenique")
                {
                    complement.FormeGalenique = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "ResponsableEtiquetage")
                {
                    complement.ResponsableEtiquetage = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "DoseJournaliere")
                {
                    complement.DoseJournaliere = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "ModeEmploi")
                {
                    complement.ModeEmploi = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "Gamme")
                {
                    complement.Gamme = nodeChamp.ChildNodes[0].InnerText;
                }
                if (nodeChamp.Name == "Aromes")
                {
                    complement.Aromes = nodeChamp.ChildNodes[0].InnerText;
                }

                if (nodeChamp.Name == "ObjectifsEffets")
                {
                    LireNoeud_ObjectifsEffets(nodeChamp, complement.ObjectifsEffets);
                }
                if (nodeChamp.Name == "Ingredients")
                {
                    LireNoeud_Ingredients(nodeChamp, complement);
                }
                if (nodeChamp.Name == "PopulationsArisques")
                {
                    LireNoeud_PopulationsARisque(nodeChamp, complement.PopulationsARisque);
                }
                if (nodeChamp.Name == "PopulationsCibles")
                {
                    LireNoeud_PopulationsCibles(nodeChamp, complement.PopulationsCible);
                }
            }
        }
Ejemplo n.º 38
0
        private void LoadLists()
        {
            BindingList <CalculationItemViewModel> itemsDS = new BindingList <CalculationItemViewModel>();

            foreach (var i in _sender.Items)
            {
                CalculationItemViewModel item = new CalculationItemViewModel
                {
                    ID    = i.ID,
                    Name  = i.ItemName,
                    isSum = false
                };
                itemsDS.Add(item);
                if (i.WithSum == 1)
                {
                    CalculationItemViewModel itemWithSum = new CalculationItemViewModel
                    {
                        ID    = i.ID,
                        Name  = i.ItemName + "[sum]",
                        isSum = true
                    };
                    itemsDS.Add(itemWithSum);
                }
            }

            lb_items.DisplayMember = "Name";
            lb_items.ValueMember   = "ID";
            lb_items.DataSource    = itemsDS;

            BindingList <CalculationConstant> constantsDS = new BindingList <CalculationConstant>();

            foreach (var i in _sender.Constants)
            {
                constantsDS.Add(i);
            }

            lb_constants.DisplayMember = "Name";
            lb_constants.ValueMember   = "ID";
            lb_constants.DataSource    = constantsDS;

            Dictionary <string, string> attrsDS = new Dictionary <string, string>();

            attrsDS.Add("price", "Цена");
            attrsDS.Add("count", "Кол-во");
            attrsDS.Add("TNVEDCode", "Код ТНВЭД");
            attrsDS.Add("TNVEDValue", "Ставка ТНВЭД");
            lb_attrs.DisplayMember = "Value";
            lb_attrs.ValueMember   = "Key";
            lb_attrs.DataSource    = new BindingSource(attrsDS, null);


            BindingList <DynamicConstant> dynamicDS = new BindingList <DynamicConstant>();

            foreach (var i in _sender.Dynamics)
            {
                dynamicDS.Add(i);
            }
            lb_dynamics.DisplayMember = "Name";
            lb_dynamics.ValueMember   = "ID";
            lb_dynamics.DataSource    = dynamicDS;
        }
    public static BindingList <FlowTube> Parse(string filename)
    {
        int       failureCount  = 0;
        int       sleepTime     = 2000;
        bool      success       = false;
        Exception lastException = null;
        XDocument x             = null;

        do
        {
            try
            {
                x       = XDocument.Load(filename);
                success = true;
            }
            catch (Exception ex)
            {
                lastException = ex;
                System.Threading.Thread.Sleep(sleepTime);
                failureCount++;
            }
        }while (!success && failureCount < 10);


        if (!success)
        {
            throw lastException;
        }

        XNamespace ns      = x.Root.GetDefaultNamespace();
        var        persons = from data in x.Descendants(ns + "Person")
                             select new
        {
            PersonID = (string)data.Element(ns + "PersonId"),
            MRN      = (string)data.Element(ns + "MRN"),
            Name     = (string)data.Element(ns + "NameFullFormatted"),
        };

        foreach (var p in persons)
        {
            System.Diagnostics.Debug.WriteLine(p.ToString());
        }

        var Persons = persons.ToDictionary(o => o.PersonID, o => o);

        var containers = from data in x.Descendants(ns + "Container")
                         select new
        {
            ContainerId     = (string)data.Element(ns + "ContainerId"),
            ContainerSuffix = (string)data.Element(ns + "ContainerSuffix"),
            ContainerAccessionNumberFormatted   = (string)data.Element(ns + "ContainerAccessionNumber").Element(ns + "Formatted"),
            ContainerAccessionNumberUnformatted = (string)data.Element(ns + "ContainerAccessionNumber").Element(ns + "Unformatted"),
            TubeLabel = (string)data.Element(ns + "SpecimenType").Element(ns + "Display"),
        };

        var Containers = containers.ToDictionary(o => o.ContainerId, o => o);

        foreach (var c in containers)
        {
            System.Diagnostics.Debug.WriteLine(c.ToString());
        }

        var tubes = from data in x.Descendants(ns + "Cell")
                    select new
        {
            SeqNbr      = (int)data.Element(ns + "SeqNbr"),
            BatchItemId = (string)data.Element(ns + "BatchItemId"),
        };

        foreach (var t in tubes)
        {
            System.Diagnostics.Debug.WriteLine(t.ToString());
        }

        var Tubes = tubes.ToDictionary(o => o.SeqNbr, o => o);

        var batches = from data in x.Descendants(ns + "BatchItem")
                      select new
        {
            BatchItemId = (string)data.Element(ns + "BatchItemId"),
            ContainerId = (string)data.Element(ns + "ContainerId"),
            OrderId     = (string)data.Element(ns + "OrderId"),
        };

        foreach (var b in batches)
        {
            System.Diagnostics.Debug.WriteLine(b.ToString());
        }

        var Batches = batches.ToDictionary(o => o.BatchItemId, o => o);

        var orders = from data in x.Descendants(ns + "Order")
                     select new
        {
            OrderId  = (string)data.Element(ns + "OrderId"),
            PersonId = (string)data.Element(ns + "PersonId"),
        };

        foreach (var o in orders)
        {
            System.Diagnostics.Debug.WriteLine(o.ToString());
        }

        var Orders = orders.ToDictionary(o => o.OrderId, o => o);

        List <int> sequenceNumbers = Tubes.Keys.ToList();

        sequenceNumbers.Sort();
        BindingList <FlowTube> items = new BindingList <FlowTube>();


        foreach (int sequenceNumber in sequenceNumbers)
        {
            FlowTube item = new FlowTube();
            item.SeqNbr          = sequenceNumber;
            item.MRN             = Persons[Orders[Batches[Tubes[sequenceNumber].BatchItemId].OrderId].PersonId].MRN;
            item.Name            = Persons[Orders[Batches[Tubes[sequenceNumber].BatchItemId].OrderId].PersonId].Name;
            item.AccessionNumber = Containers[Batches[Tubes[sequenceNumber].BatchItemId].ContainerId].ContainerAccessionNumberFormatted +
                                   Containers[Batches[Tubes[sequenceNumber].BatchItemId].ContainerId].ContainerSuffix;
            item.TubeLabel = Containers[Batches[Tubes[sequenceNumber].BatchItemId].ContainerId].TubeLabel;
            items.Add(item);
        }

        return(items);
    }
 public void Add(IClipboardItem item)
 {
     _bindingList.Add(item);
 }
Ejemplo n.º 41
0
        private void btnCart_Click(object sender, EventArgs e)
        {
            try
            {
                List <StockModels> stList      = getSelectedItemFromStock();
                StockModels        itemForSale = null;
                if (cmbUnit.DataSource != null)
                {
                    itemForSale = stList.Where(st => st.Weight == cmbUnit.Text).ToList()[0];
                }
                else
                {
                    itemForSale = stList[0];
                }
                //master stock list manage
                stockList.ForEach(st => { if (st.ID == itemForSale.ID)
                                          {
                                              st.Stock = (Convert.ToInt32(st.Stock) - Convert.ToInt32(txtUnit.Text)).ToString();
                                          }
                                  });

                SalesModel slModel = new SalesModel();

                slModel.ID          = stList[0].ID;
                slModel.ProductName = stList[0].ProductName;
                slModel.Company     = stList[0].Company;
                slModel.Quantity    = txtUnit.Text;
                slModel.Weight      = cmbUnit.Text;
                slModel.Details     = stList[0].Details;
                slModel.MRP         = stList[0].MRP;
                slModel.Rate        = stList[0].Rate;
                slModel.CGST        = stList[0].CGST;
                slModel.SGST        = stList[0].SGST;
                slModel.IGST        = stList[0].IGST;
                slModel.Total       = (decimal)calculateTotal(Convert.ToInt32(txtUnit.Text), !string.IsNullOrEmpty(slModel.SGST) ? Convert.ToDouble(slModel.SGST) : 0,
                                                              !string.IsNullOrEmpty(slModel.SGST) ? Convert.ToDouble(slModel.SGST) : 0,
                                                              !string.IsNullOrEmpty(slModel.SGST) ? Convert.ToDouble(slModel.SGST) : 0,
                                                              Convert.ToDouble(slModel.Rate), 0);
                if (saleItemList.ToList().Exists(slm => slm.ID == stList[0].ID))
                {
                    saleItemList.ToList().ForEach(slm =>
                    {
                        if (slm.ID == stList[0].ID)
                        {
                            slm.Quantity = Convert.ToString(Convert.ToInt32(slm.Quantity) + Convert.ToInt32(slModel.Quantity));
                            slm.Total    = slm.Total + slModel.Total;
                        }
                    });
                }
                else
                {
                    saleItemList.Add(slModel);
                }
                gridSale.DataSource = null;
                gridSale.DataSource = saleItemList;
                gridSale.ClearSelection();

                txtUnit.Text       = "";
                lblStock.Text      = "";
                cmbCompany.Text    = "";
                cmbProduct.Text    = "";
                txtUnit.Enabled    = false; btnCart.Enabled = false;
                cmbUnit.DataSource = null;
                cmbUnit.Enabled    = false;

                getSaleItemGrandTotalAmt();
                MakeInvoiceGenerationEnable();
            }
            catch (Exception ex)
            {
                Logger.WriteErrorMessage(ex);
            }
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Ligar un sobre a la inconsistencia.
 /// </summary>
 /// <param name="sobre">Sobre a agregar</param>
 public void agregarSobre(Sobre sobre)
 {
     _sobres.Add(sobre);
 }
Ejemplo n.º 43
0
        public void agregarFichaTecnica(FichaTecnica ficha)
        {
            BindingList <FichaTecnica> fichas = (BindingList <FichaTecnica>)dgvFichasTecnicas.DataSource;

            fichas.Add(ficha);
        }
Ejemplo n.º 44
0
        /// <summary>
        /// Listar todas las gestiones terminadas registradas en el sistema en un periodo de tiempo.
        /// </summary>
        /// <param name="i">Fecha inicial del periodo de tiempo</param>
        /// <param name="i">Fecha final del periodo de tiempo</param>
        /// <returns>Lista de las gestiones registradas en el sistema</returns>
        public BindingList <Gestion> listarGestionesTerminadas(DateTime i, DateTime f)
        {
            BindingList <Gestion> gestiones = new BindingList <Gestion>();

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectGestionesTerminadas");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@fecha_inicio", i, SqlDbType.DateTime);
            _manejador.agregarParametro(comando, "@fecha_fin", f, SqlDbType.DateTime);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    int      id_gestion                  = (int)datareader["ID_Gestion"];
                    DateTime fecha                       = (DateTime)datareader["Fecha"];
                    DateTime fecha_finalizacion          = (DateTime)datareader["Fecha_Finalizacion"];
                    string   comentario                  = (string)datareader["Comentario"];
                    decimal  monto                       = (decimal)datareader["Monto"];
                    ClasificacionesGestion clasificacion = (ClasificacionesGestion)datareader["Clasificacion"];

                    short  id_cliente     = (short)datareader["ID_Cliente"];
                    string nombre_cliente = (string)datareader["Nombre_Cliente"];

                    short  id_punto_venta     = (short)datareader["ID_Punto_Venta"];
                    string nombre_punto_venta = (string)datareader["Nombre_Punto_Venta"];

                    byte   id_tipo         = (byte)datareader["ID_Tipo"];
                    string nombre_tipo     = (string)datareader["Nombre_Tipo"];
                    short  tiempo_esperado = (short)datareader["Tiempo"];

                    byte      id_causa         = (byte)datareader["ID_Causa"];
                    string    descripcion      = (string)datareader["Descripcion"];
                    Causantes causante         = (Causantes)datareader["Causante"];
                    string    comentario_causa = (string)datareader["Comentario_Causa"];

                    Cliente      cliente     = new Cliente(id_cliente, nombre_cliente);
                    PuntoVenta   punto_venta = new PuntoVenta(id_punto_venta, nombre_punto_venta, cliente);
                    TipoGestion  tipo        = new TipoGestion(id_tipo, nombre_tipo, tiempo_esperado);
                    CausaGestion causa       = new CausaGestion(id_causa, descripcion, causante);

                    Gestion gestion = new Gestion(id: id_gestion, punto_venta: punto_venta, monto: monto, tipo: tipo,
                                                  causa: causa, comentario_causa: comentario_causa, fecha: fecha,
                                                  fecha_finalizacion: fecha_finalizacion, clasificacion: clasificacion,
                                                  comentario: comentario);

                    gestiones.Add(gestion);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(gestiones);
        }
Ejemplo n.º 45
0
        public FormProduits()
        {
            InitializeComponent();
            _listeProduits     = new BindingList <Produit>();
            _produitsAjoutés   = new BindingList <Produit>();
            _produitsSupprimés = new BindingList <Produit>();

            btAjoutProduit.Click += (object sender, EventArgs e) =>
            {
                using (FormSaisieProduit formSaisie = new FormSaisieProduit())
                {
                    DialogResult result = formSaisie.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        try//Faire çà dans la DAL d'abord, puis renvoyer l'exception par un throx new exception
                        //On peut se créer une classe d'exception d'erreurs métier qui traduiront les erreurs techniques
                        {
                            //Ajout ligne par ligne
                            //DAL.AjouterProduitBD(formSaisie.ProduitSaisi);
                            //formSaisie.ProduitSaisi.IdProduit = DAL.GetIdProduit(formSaisie.ProduitSaisi);
                            //_listeProduits.Add(formSaisie.ProduitSaisi);

                            //Ajout de masse
                            _produitsAjoutés.Add(formSaisie.ProduitSaisi);
                            _listeProduits.Add(formSaisie.ProduitSaisi);
                        }
                        catch (SqlException ex)
                        {
                            if (ex.Number == 547)
                            {
                                DialogResult msg = MessageBox.Show("Attention, le fournisseur entré n'existe pas!",
                                                                   "Erreur", MessageBoxButtons.OK);
                            }
                            else
                            {
                                throw;
                            }
                        }
                    }
                }
            };

            btSuprProduit.Click += (object sender, EventArgs e) =>
            {
                Produit prod = (Produit)dgvAfichProduit.CurrentRow.DataBoundItem;
                //Suppression produit ligne par ligne
                //_listeProduits.Remove(prod);//par souci d'économie, il vaut mieux passer en paramètre l'id du produit

                //Suppression de masse
                if (_produitsAjoutés.Contains(prod))
                {
                    _produitsAjoutés.Remove(prod);
                    _listeProduits.Remove(prod);
                }
                else
                {
                    _produitsSupprimés.Add(prod);
                    _listeProduits.Remove(prod);
                }


                try
                {
                    //Suppression produit ligne par ligne
                    //DAL.RemoveProduitBD(prod);
                }
                catch (SqlException ex)
                {
                    if (ex.Number == 547)
                    {
                        DialogResult msg = MessageBox.Show("Attention, ce produit est reférencé dans une commande!",
                                                           "Erreur", MessageBoxButtons.OK);
                    }
                    else
                    {
                        throw;
                    }
                }
            };

            btEnrListProduits.Click += BtEnrListProduits_Click;
        }
Ejemplo n.º 46
0
        private void AddPayroll_Load(object sender, EventArgs e)
        {
            try
            {
                txtRunBy.Text   = _User.UserName;
                txtDateRun.Text = DateTime.Today.ToShortDateString();

                cbEmployer.ValueMember   = "Id";
                cbEmployer.DisplayMember = "Name";
                cbEmployer.DataSource    = de.GetEmployers();

                var months = new BindingList <KeyValuePair <int, string> >();
                months.Add(new KeyValuePair <int, string>(1, "January"));
                months.Add(new KeyValuePair <int, string>(2, "February"));
                months.Add(new KeyValuePair <int, string>(3, "March"));
                months.Add(new KeyValuePair <int, string>(4, "April"));
                months.Add(new KeyValuePair <int, string>(5, "May"));
                months.Add(new KeyValuePair <int, string>(6, "June"));
                months.Add(new KeyValuePair <int, string>(7, "July"));
                months.Add(new KeyValuePair <int, string>(8, "August"));
                months.Add(new KeyValuePair <int, string>(9, "September"));
                months.Add(new KeyValuePair <int, string>(10, "October"));
                months.Add(new KeyValuePair <int, string>(11, "November"));
                months.Add(new KeyValuePair <int, string>(12, "December"));

                cboPeriod.DataSource    = months;
                cboPeriod.ValueMember   = "Key";
                cboPeriod.DisplayMember = "Value";
                cboPeriod.SelectedValue = DateTime.Today.Month;

                txtYear.Text = DateTime.Today.Year.ToString();
            }
            catch (Exception ex)
            {
                Utils.ShowError(ex);
            }
        }
Ejemplo n.º 47
0
        private void AddActivityBtn_Click(object sender, EventArgs e)
        {
            if (AddActivityBtn.Text.Equals("Ajouter Activitée"))
            {
                // Enable form to user
                ActivityFormEnabled(true);
                SeanceFormEnabled(false);

                // Change UI
                ActivityFormColors(Color.WhiteSmoke);

                // default text
                ActivityFormInitializeText();

                // Change button text
                AddActivityBtn.Text = "Sauvegarder";

                // disable other buttons
                DeleteActivityBtn.Enabled = false;
                ModifySeanceBtn.Enabled   = false;
                // Load Activities from db
                using (ClubDbContext context = new ClubDbContext())
                {
                    var activityNamesInDb = context.Activites.ToList();
                    foreach (var activity in activityNamesInDb)
                    {
                        activities.Add(activity.Nom);
                    }
                }
                // bind data to the cb collection of values
                ActivitiesCB.DataSource = activities;

                // Add a new field to the binding source
                activiteBindingSource.Add(new Activite());
                activiteBindingSource.MoveLast();
            }
            else if (AddActivityBtn.Text.Equals("Sauvegarder"))
            {
                // Perform Add Logic
                if (ActivitiesCB.SelectedValue.ToString() != "Activités" &&
                    ActivitiesCB.SelectedValue != null)
                {
                    var current = activiteBindingSource.Current as Activite;
                    using (ClubDbContext context = new ClubDbContext())
                    {
                        // Pick the activity object from db from cb selected activity name
                        current = context.Activites
                                  .SingleOrDefault(a => a.Nom == ActivitiesCB.SelectedValue.ToString());

                        // add the activity to current adherent prefered activities
                        context.Adherents.SingleOrDefault(a => a.CodeAdh == currentUser.AdherentId)
                        .PreferredActivities.Add(current);

                        context.SaveChanges();
                    }
                }
                Activities_Load(sender, e);
                // Disable form to user
                ActivityFormEnabled(false);
                SeanceFormEnabled(true);

                // Change Ui
                ActivityFormColors(Color.FromArgb(95, 77, 221));

                // Change button text
                AddActivityBtn.Text = "Ajouter Activitée";

                // Enable other buttons
                DeleteActivityBtn.Enabled = true;
                ModifySeanceBtn.Enabled   = true;
            }
        }
Ejemplo n.º 48
0
 public void AddPlayer(Player player)
 {
     players.Add(player);
     numPlayers++;
 }
Ejemplo n.º 49
0
        /// <summary>
        /// Handles the RunWorkerCompleted event of the bgw control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param>
        private static void BgwSingle_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            scrapeCount--;

            postProcess.Add(e.Result as MovieModel);
        }
Ejemplo n.º 50
0
        private void GetFiles()
        {
            INFOFileHeader * fileHeader;
            INFOFileEntry *  fileEntry;
            RuintList *      entryList;
            INFOGroupHeader *group;
            INFOGroupEntry * gEntry;
            RSARFileNode     n;
            DataSource       source;
            RSARHeader *     rsar = Header;

            //sounds, banks, types, files, groups

            //Get ruint collection from info header
            VoidPtr infoCollection = rsar->INFOBlock->_collection.Address;
            //Convert to ruint buffer
            ruint *groups = (ruint *)infoCollection;
            //Get file ruint list at file offset (groups[3])
            RuintList *fileList = (RuintList *)((uint)groups + groups[3]);
            //Get the info list
            RuintList *groupList = rsar->INFOBlock->Groups;

            //Loop through the ruint offsets to get all files
            for (int x = 0; x < fileList->_numEntries; x++)
            {
                //Get the file header for the file info
                fileHeader = (INFOFileHeader *)(infoCollection + fileList->Entries[x]);
                entryList  = fileHeader->GetList(infoCollection);
                if (entryList->_numEntries == 0)
                {
                    //Must be external file.
                    n      = new RSARExtFileNode();
                    source = new DataSource(fileHeader, 0);
                }
                else
                {
                    //Use first entry
                    fileEntry = (INFOFileEntry *)entryList->Get(infoCollection, 0);
                    //Find group with matching ID
                    group = (INFOGroupHeader *)groupList->Get(infoCollection, fileEntry->_groupId);
                    //Find group entry with matching index
                    gEntry = (INFOGroupEntry *)group->GetCollection(infoCollection)->Get(infoCollection, fileEntry->_index);

                    //Create node and parse
                    source = new DataSource((int)rsar + group->_headerOffset + gEntry->_headerOffset, gEntry->_headerLength);
                    if ((n = NodeFactory.GetRaw(source) as RSARFileNode) == null)
                    {
                        n = new RSARFileNode();
                    }
                    n._audioSource = new DataSource((int)rsar + group->_waveDataOffset + gEntry->_dataOffset, gEntry->_dataLength);
                    n._infoHdr     = fileHeader;
                }
                n._fileIndex   = x;
                n._entryNumber = fileHeader->_entryNumber;
                n._parent      = this; //This is so that the node won't add itself to the child list.
                n.Initialize(this, source);
                _files.Add(n);
            }

            //foreach (ResourceNode r in _files)
            //    r.Populate();
        }
        public SpecialPageListProvider()
        {
            InitializeComponent();

            if (ListItems.Count == 0)
            {
                ListItems.Add(new PrefixIndexSpecialPageProvider());
                ListItems.Add(new AllPagesSpecialPageProvider());
                ListItems.Add(new AllCategoriesSpecialPageProvider());
                ListItems.Add(new AllFilesSpecialPageProvider());
                ListItems.Add(new AllRedirectsSpecialPageProvider());
                ListItems.Add(new RecentChangesSpecialPageProvider());
                ListItems.Add(new LinkSearchSpecialPageProvider());
                ListItems.Add(new RandomRedirectsSpecialPageProvider());
                ListItems.Add(new PagesWithoutLanguageLinksSpecialPageProvider());
                ListItems.Add(new ProtectedPagesSpecialPageProvider());
                ListItems.Add(new GalleryNewFilesSpecialPageProvider());
                ListItems.Add(new DisambiguationPagesSpecialPageProvider());
            }

            cmboSourceSelect.DataSource    = ListItems;
            cmboSourceSelect.DisplayMember = "DisplayText";
            cmboSourceSelect.ValueMember   = "DisplayText";
        }
Ejemplo n.º 52
0
        private void btnOuvrir_Click(object sender, EventArgs e)
        {
            if (!OuvrirFichier())
            {
                return;
            }

            complements = new BindingList <TComplement>();

            //TObjectifEffet
            datasourceObjectifsEffets.Clear();
            datasourceObjectifsEffets.Add(new TObjectifEffet()
            {
                ObjectifEffet = "_Tous_"
            });
            //TIngredientAutre
            datasourceIngredientAutre.Clear();
            datasourceIngredientAutre.Add(new TIngredientAutre()
            {
                IdentIngredientAutre = "-1", NomIngredientAutre = "_Tous_"
            });
            //TPlante
            datasourcePlantes.Clear();
            datasourcePlantes.Add(new TPlante()
            {
                IdPlante = "-1", NomPlante = "_Toutes_"
            });
            //TMicroOrganisme
            datasourceMicroOrganisme.Clear();
            datasourceMicroOrganisme.Add(new TMicroOrganisme()
            {
                IdMicroOrga = "-1", GenreMicroOrga = "_Tous_"
            });
            //TPopulationARisque
            datasourcePopulationARisque.Clear();
            datasourcePopulationARisque.Add(new TPopulationARisque()
            {
                PopulationARisque = "_Toutes_"
            });
            //TPopulationCible
            datasourcePopulationCible.Clear();
            datasourcePopulationCible.Add(new TPopulationCible()
            {
                PopulationCible = "_Toutes_"
            });

            XmlDocument doc = new XmlDocument();

            Cursor = Cursors.WaitCursor;
            try
            {
                XmlTextReader reader = new XmlTextReader(cheminFichierXML);
                while (reader.Read())
                {
                    if (reader.Name.Equals("Complements"))
                    {
                        LireNoeud_Complements(doc.ReadNode(reader));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erreur de lecture du fichier : " + ex.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }

            this.BSComplements.DataSource = complements.OrderBy(x => x.LongIdComplent).ToList();
            gridCtrl.RefreshDataSource();

            //Plantes
            this.BSPlantes.DataSource = datasourcePlantes.OrderBy(x => x.NomPlante).ToList();;
            cbxPlantes.Refresh();
            //Objectifs
            this.BSObjectifs.DataSource = datasourceObjectifsEffets.OrderBy(x => x.ObjectifEffet).ToList();;
            cbxObjectifs.Refresh();
            //Ingredients
            this.BSIngredients.DataSource = datasourceIngredientAutre.OrderBy(x => x.NomIngredientAutre).ToList();;
            cbxIngredients.Refresh();
            //MicroOrganismes
            this.BSMicroOrganismes.DataSource = datasourceMicroOrganisme.OrderBy(x => x.GenreEspeceMicroOrganisme).ToList();;
            cbxMicroOrganismes.Refresh();
            //population à risque
            this.BSPopulationARisque.DataSource = datasourcePopulationARisque.OrderBy(x => x.PopulationARisque).ToList();;
            cbxPopulationARisque.Refresh();
            //population cible
            this.BSPopulationCible.DataSource = datasourcePopulationCible.OrderBy(x => x.PopulationCible).ToList();;
            cbxPopulationCible.Refresh();

            Filtrer();
        }
Ejemplo n.º 53
0
        /// <summary>
        /// Only support the ComboBox control from WinForm/Visual WebGUI
        /// </summary>
        /// <param name="ddList">the ComboBox control from WinForm/Visual WebGUI</param>
        /// <param name="TextField">e.g. new string[]{"FieldName1", "FieldName2", ...}</param>
        /// <param name="TextFormatString">e.g. "{0} - {1}"</param>
        /// <param name="SwitchLocale">Can be localized, if the FieldName has locale suffix, e.g. '_chs'</param>
        /// <param name="BlankLine">add blank label text to ComboBox or not</param>
        /// <param name="BlankLineText">the blank label text</param>
        /// <param name="WhereClause">Where Clause for SQL Statement. e.g. "FieldName = 'SomeCondition'"</param>
        /// <param name="OrderBy">Sorting order, string array, e.g. {"FieldName1", "FiledName2"}</param>
        public static void LoadCombo(ref ComboBox ddList, string[] TextField, string TextFormatString, bool SwitchLocale, bool BlankLine, string BlankLineText, string WhereClause, string[] OrderBy)
        {
            ddList.DataSource = null;
            ddList.Items.Clear();

            #region 轉換 orderby:方便 SQL Server 做 sorting,中文字排序可參考:https://dotblogs.com.tw/jamesfu/2013/06/04/collation
            if (SwitchLocale && OrderBy.Length > 0)
            {
                for (int i = 0; i < OrderBy.Length; i++)
                {
                    if (OrderBy[i] == "GradeName")
                    {
                        OrderBy[i] = CookieHelper.CurrentLocaleId == LanguageHelper.AlternateLanguage2.Key ?
                                     "GradeName_Cht" : CookieHelper.CurrentLocaleId == LanguageHelper.AlternateLanguage1.Key ?
                                     "GradeName_Chs" :
                                     "GradeName";
                    }
                }
            }
            var orderby = String.Join(",", OrderBy.Select(x => "[" + x + "]"));
            #endregion

            #region 轉換 TextField language
            if (SwitchLocale && TextField.Length > 0)
            {
                for (int i = 0; i < TextField.Length; i++)
                {
                    if (TextField[i] == "GradeName")
                    {
                        TextField[i] = CookieHelper.CurrentLocaleId == LanguageHelper.AlternateLanguage2.Key ?
                                       "GradeName_Cht" : CookieHelper.CurrentLocaleId == LanguageHelper.AlternateLanguage1.Key ?
                                       "GradeName_Chs" :
                                       "GradeName";
                    }
                }
            }
            var textField = String.Join(",", TextField.Select(x => "[" + x + "]"));
            #endregion

            using (var ctx = new EF6.RT2020Entities())
            {
                var list = ctx.StaffGroup.SqlQuery(
                    String.Format(
                        "Select * from StaffGroup Where {0} Order By {1}",
                        String.IsNullOrEmpty(WhereClause) ? "1 = 1" : WhereClause,
                        orderby
                        ))
                           .AsNoTracking()
                           .ToList();

                BindingList <KeyValuePair <Guid, string> > data = new BindingList <KeyValuePair <Guid, string> >();
                if (BlankLine)
                {
                    data.Insert(0, new KeyValuePair <Guid, string>(Guid.Empty, ""));
                }

                foreach (var item in list)
                {
                    var text = GetFormatedText(item, TextField, TextFormatString);
                    data.Add(new KeyValuePair <Guid, string>(item.GroupId, text));
                }

                ddList.DataSource    = data.ToList();
                ddList.ValueMember   = "Key";
                ddList.DisplayMember = "Value";
            }
            if (ddList.Items.Count > 0)
            {
                ddList.SelectedIndex = 0;
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = _data;

            if (_data.Type == 0)
            {
                Accomplished.Visibility = Visibility.Visible;
            }
            ;

            _listdetails      = new BindingList <Trips>();
            ReceivedMoneyData = new SeriesCollection()
            {
            };
            ExpensesData = new SeriesCollection()
            {
            };
            Photo.ItemsSource = _listdetails;
            RoutesItemsControl.ItemsSource = _listdetails;
            string folder = AppDomain.CurrentDomain.BaseDirectory;

            folder = folder + $"\\List\\{_data.Name}\\";
            var trip = new Trips()
            {
                ReceivedMoney = new ObservableCollection <Cash>(),
                Expenses      = new ObservableCollection <Cash>(),
                Routes        = new BindingList <string>(),
                Images        = new BindingList <string>()
            };

            //Images
            string fileImages     = folder + "Images.txt";
            var    dataFileImages = File.ReadAllLines(fileImages);

            for (int i = 0; i < dataFileImages.Length; i++)
            {
                trip.Images.Add(folder + dataFileImages[i]);
            }
            ;

            //Receive Money
            string fileReceivedMoney = folder + "Members.txt";
            var    dataFileMember    = File.ReadAllLines(fileReceivedMoney);
            int    fileMemberCount   = dataFileMember.Count() / 2;

            for (int i = 0; i < fileMemberCount; i++)
            {
                var line1     = dataFileMember[i * 2];
                int line2     = int.Parse(dataFileMember[i * 2 + 1]);
                var chartData = new PieSeries()
                {
                    Title  = line1,
                    Values = new ChartValues <int> {
                        line2
                    }
                };
                var cash = new Cash()
                {
                    Name  = line1,
                    Value = line2
                };
                trip.ReceivedMoney.Add(cash);
                ReceivedMoneyData.Add(chartData);
            }
            ;

            // Expenses
            string fileExpenses      = folder + "Expenses.txt";
            var    dataFileExpenses  = File.ReadAllLines(fileExpenses);
            int    fileExpensesCount = dataFileExpenses.Count() / 2;

            for (int i = 0; i < fileExpensesCount; i++)
            {
                var line1     = dataFileExpenses[i * 2];
                int line2     = int.Parse(dataFileExpenses[i * 2 + 1]);
                var chartData = new PieSeries()
                {
                    Title  = line1,
                    Values = new ChartValues <int> {
                        line2
                    }
                };
                var cash = new Cash()
                {
                    Name  = line1,
                    Value = line2
                };
                trip.Expenses.Add(cash);
                ExpensesData.Add(chartData);
            }

            //Routes
            string fileRoutes     = folder + "Location.txt";
            var    dataFileRoutes = File.ReadAllLines(fileRoutes);

            for (int i = 0; i < dataFileRoutes.Length; i++)
            {
                trip.Routes.Add(dataFileRoutes[i]);
            }
            ;
            _listdetails.Add(trip);

            RoutesPanel.Visibility         = Visibility.Visible;
            ButtonPanel.Visibility         = Visibility.Visible;
            ExpensesChart.DataContext      = ExpensesData;
            ReceivedMoneyChart.DataContext = ReceivedMoneyData;
            dataMembers.Visibility         = Visibility.Visible;
            dataMembers.ItemsSource        = _listdetails[0].ReceivedMoney;
        }
Ejemplo n.º 55
0
        private void button7_Click(object sender, EventArgs e)
        {
            Hoja nueva = new Hoja(ruta3, listBox5.Items[listBox5.SelectedIndex].ToString());

            nueva.obtenBasketMaestra();

            archivo3.listaHojas.Add(nueva);
            int            ren = 0;
            Modelo_canasta modeloC;

            dataGridView3.Rows.Clear();
            listBox3.Items.Clear();
            listBox4.Items.Clear();
            superlista.Clear();
            try
            {
                for (int j = 0; j < archivo2.listaHojas.Count; j++)
                {
                    Modelo_canasta gabinete = new Modelo_canasta();
                    gabinete.Area = archivo2.listaHojas[j].Nombre;
                    superlista.Add(gabinete);
                    ren++;
                    archivo2.listaHojas[j].obtenTabla();
                    foreach (Parte par2 in archivo2.listaHojas[j].modelos)
                    {
                        foreach (Modelo_canasta mod in archivo3.listaHojas[archivo3.listaHojas.Count - 1].basketMaestra)
                        {
                            if (mod.Model.Contains(par2.parte))
                            {
                                modeloC                 = new Modelo_canasta();
                                modeloC.Area            = mod.Area;
                                modeloC.Leavel          = mod.Leavel;
                                modeloC.Item            = mod.Item;
                                modeloC.Qty             = par2.cantidad;
                                modeloC.ReqDate         = mod.ReqDate;
                                modeloC.ProductType     = mod.ProductType;
                                modeloC.Model           = mod.Model;
                                modeloC.AuxSpec1        = mod.AuxSpec1;
                                modeloC.Description     = mod.Description;
                                modeloC.LongDescription = mod.LongDescription;
                                modeloC.EachList        = mod.EachList;
                                modeloC.EachNet         = mod.EachNet;
                                modeloC.TotalList       = mod.EachList;
                                modeloC.Discount        = mod.Discount;
                                modeloC.TotalNet        = mod.TotalNet;
                                modeloC.EachXferList    = mod.EachXferList;
                                modeloC.EachXferNet     = mod.EachXferNet;
                                modeloC.TotXferList     = mod.TotXferList;
                                modeloC.XferDisc        = mod.XferDisc;
                                modeloC.TotXferNet      = mod.TotXferNet;
                                modeloC.EachInitialXfer = mod.EachInitialXfer;
                                modeloC.TotInitialXfer  = mod.TotInitialXfer;
                                modeloC.VendorCode      = mod.VendorCode;
                                modeloC.Weight          = mod.Weight;
                                modeloC.MarketGroup     = mod.MarketGroup;
                                modeloC.setNet          = mod.setNet;
                                modeloC.DiscountA       = mod.DiscountA;
                                modeloC.DiscountB       = mod.DiscountB;
                                modeloC.DiscountC       = mod.DiscountC;
                                modeloC.DiscountD       = mod.DiscountD;
                                modeloC.DiscountE       = mod.DiscountE;
                                modeloC.LeadTime        = mod.LeadTime;
                                modeloC.LifeCycle       = mod.LifeCycle;
                                modeloC.Country         = mod.Country;
                                modeloC.LineItem        = mod.LineItem;
                                modeloC.MfgCurrency     = mod.MfgCurrency;
                                modeloC.TagSet          = mod.TagSet;
                                modeloC.TagQty          = mod.TagQty;
                                modeloC.ModeloJornadas  = mod.ModeloJornadas;
                                modeloC.EEC             = mod.EEC;
                                modeloC.areaP           = mod.areaP;
                                modeloC.Sistema         = mod.Sistema;
                                superlista.Add(modeloC);
                                break;
                            }
                        }
                    }

                    Modelo_canasta total = new Modelo_canasta();
                    total.EachNet = "Process Level Total";


                    superlista.Add(total);
                }
                cambiaLista();
                dataGridView3.DataSource = superlista;
            }
            catch (Exception)
            {
                MessageBox.Show("Selecciona un elemento de ambas listas");
            }
        }
Ejemplo n.º 56
0
        private void ModifySeanceBtn_Click(object sender, EventArgs e)
        {
            // Perform Modify Logic
            var seanceToAdd = seanceBindingSource.Current as Seance;

            if (seanceToAdd != null)
            {
                seanceToAdd.DebutSeance = SeanceDate.Value.Date + SeanceTime.Value.TimeOfDay;

                DateTime min = new DateTime(seanceToAdd.DebutSeance.Year
                                            , seanceToAdd.DebutSeance.Month
                                            , seanceToAdd.DebutSeance.Day
                                            , 7
                                            , 0
                                            , 0);
                DateTime max = new DateTime(seanceToAdd.DebutSeance.Year
                                            , seanceToAdd.DebutSeance.Month
                                            , seanceToAdd.DebutSeance.Day
                                            , 21
                                            , 0
                                            , 0);

                if (seanceToAdd.DebutSeance < min || seanceToAdd.DebutSeance > max)
                {
                    UserErrors.Add("Les Seances doivent respecter les horaires du club: \n" +
                                   "Ouverture: 7h00\n" +
                                   "Fermeture: 21h00.");
                }
                if (UserErrors.Count > 0)
                {
                    MetroFramework.MetroMessageBox.Show(this,
                                                        string.Join("\n", UserErrors),
                                                        "Données Non Valides",
                                                        MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                    // Clear errors for another use and quit
                    UserErrors.Clear();
                    return;
                }
                using (ClubDbContext context = new ClubDbContext())
                {
                    var seanceInDb = context.Adherents.Include(a => a.Seances)
                                     .SingleOrDefault(a => a.CodeAdh == currentUser.AdherentId)
                                     .Seances
                                     .SingleOrDefault(s => s.CodeSeance == seanceToAdd.CodeSeance);
                    seanceInDb.DebutSeance = seanceToAdd.DebutSeance;
                    context.SaveChanges();
                }
                Activities_Load(sender, e);
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this,
                                                    "Vous n'avez pas séléctionné une séance ou bien aucune séance ne vous est afféctée!",
                                                    "Aucune séance n'est séléctionnée",
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);
                // Clear errors for another use and quit
                UserErrors.Clear();
            }
        }
Ejemplo n.º 57
0
        /// <summary>
        /// 当前盒完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_BoxNumber_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (!RegexHelper.regExpNumber.IsMatch(this.textBox_DoNumber.Text))
                {
                    MessageBox.Show("完成的数量应该是数字");
                    return;
                }

                byte doNumber = Convert.ToByte(this.textBox_DoNumber.Text);

                DialogResult dialogResult = MessageBox.Show("当前盒完成数量:" + doNumber, "询问", MessageBoxButtons.OKCancel);

                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }

                using (_dbcontext = new FlowManageSystemEntities())
                {
                    orderBoxRepository = new OrderBoxRepository(_dbcontext);

                    var boxNumber = this.textBox_BoxNumber.Text.Trim();

                    //通过盒号找到订单号
                    var id = orderBoxRepository.GetOrderId(boxNumber);

                    List <string> boxNumbersNeedFinished = null;

                    //根据订单号 找到需要完成的所有盒号
                    if (id != 0)
                    {
                        boxNumbersNeedFinished = orderBoxRepository.GetOrderIdBoxes(id);
                    }
                    else                      //不存在当前盒号 直接退出
                    {
                        MessageBox.Show("不存在的盒号,请联系下单人员,检查是否下单错误!");
                        return;
                    }

                    //根据id找到订单记录
                    orderRepositoy = new OrderRepository(_dbcontext);

                    //设置界面显示当前计划单号
                    var order = orderRepositoy.getOrderByOrderId(id);
                    this.lbPlanNo.Text = order.PlanNo;

                    assembleRepository = new AssembleRepository(_dbcontext);
                    //设置界面已组装好的数量
                    this.lbDoNo.Text = assembleRepository.GetAssembleCount(id).ToString();

                    //获取已完成的盒号
                    var hasFinished = assembleRepository.GetAssembleFinishedBoxNo(id);

                    //在组装完成前 判断是否重复扫
                    if (hasFinished.Contains(this.textBox_BoxNumber.Text.Trim()))
                    {
                        MessageBox.Show("此盒已完成,勿重复扫!");
                        this.textBox_BoxNumber.Select();
                        return;
                    }
                    assembleRepository.assembleOneBox(id, boxNumber, doNumber);
                    assembleRepository.SaveChanges();

                    //获取已完成的盒号
                    hasFinished = assembleRepository.GetAssembleFinishedBoxNo(id);
                    //设置界面ListBox绑定
                    unFinishedBoxes.Clear();
                    boxNumbersNeedFinished.Except(hasFinished).ToList().ForEach(o => unFinishedBoxes.Add(o));
                }
            }
        }
 private void frmDetalle_ItemOK(object sender, Detalle e)
 {
     blDetalle.Add(e);
     Notificar();
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Ligar un valor a la inconsistencia.
 /// </summary>
 /// <param name="valor">Valor a agregar</param>
 public void agregarValor(Valor valor)
 {
     _valores.Add(valor);
 }
Ejemplo n.º 60
0
        /// <summary>
        /// GridGrouping control getting started customization.
        /// </summary>
        private void GridSettings()
        {
            this.gridGroupingControl1.DataSource = employees;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails  = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;

            //used to set multiextended selection mode in gridgrouping control.
            this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;

            this.FormBorderStyle           = FormBorderStyle.Sizable;
            checkBox1.Checked              = true;
            this.checkBox1.CheckedChanged += new EventHandler(checkBox1_CheckedChanged);

            //used to set GridCaptionRowHeight.
            this.gridGroupingControl1.Table.DefaultCaptionRowHeight      = 25;
            this.gridGroupingControl1.Table.DefaultColumnHeaderRowHeight = 30;
            this.gridGroupingControl1.Table.DefaultRecordRowHeight       = 22;
            this.gridGroupingControl1.AllowProportionalColumnSizing      = true;
            this.MetroColor = System.Drawing.Color.Transparent;
            this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
            this.gridGroupingControl1.GridVisualStyles    = Syncfusion.Windows.Forms.GridVisualStyles.Metro;

            //Navigate to other control using tabkey navigation
            this.gridGroupingControl1.WantTabKey = false;

            #region DataSource

            employees.Add(new Employee("Ana Trujillo", Status.Divorced, Context.Employed));
            employees.Add(new Employee("Antonio Moreno", Status.Single, Context.Retired));
            employees.Add(new Employee("Thomas Hardy", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Christina Berglund", Status.Single, Context.Sick));
            employees.Add(new Employee("Hanna Moos", Status.Single, Context.Employed));
            employees.Add(new Employee("Frédérique Citeaux", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Katie Homes", Status.Married, Context.Employed));
            employees.Add(new Employee("Sam Anderson", Status.Married, Context.Sick));
            employees.Add(new Employee("Shan Tait", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Adam Smith", Status.Widow, Context.Retired));
            employees.Add(new Employee("Steve Joseph", Status.Widow, Context.Retired));
            employees.Add(new Employee("Ana Trujillo", Status.Divorced, Context.Employed));
            employees.Add(new Employee("Antonio Moreno", Status.Single, Context.Retired));
            employees.Add(new Employee("Thomas Hardy", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Christina Berglund", Status.Single, Context.Sick));
            employees.Add(new Employee("Hanna Moos", Status.Single, Context.Employed));
            employees.Add(new Employee("Frédérique Citeaux", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Katie Homes", Status.Married, Context.Employed));
            employees.Add(new Employee("Sam Anderson", Status.Married, Context.Sick));
            employees.Add(new Employee("Shan Tait", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Adam Smith", Status.Widow, Context.Retired));
            employees.Add(new Employee("Steve Joseph", Status.Widow, Context.Retired));
            employees.Add(new Employee("Ana Trujillo", Status.Divorced, Context.Employed));
            employees.Add(new Employee("Antonio Moreno", Status.Single, Context.Retired));
            employees.Add(new Employee("Thomas Hardy", Status.Single, Context.OnVacation));
            employees.Add(new Employee("Christina Berglund", Status.Single, Context.Sick));
            employees.Add(new Employee("Hanna Moos", Status.Single, Context.Employed));

            #endregion
        }