Example #1
2
        private void InitTabControlPages()
        {
            foreach(var obj in CardLevels)
            {
                var page = new TabPage { Text = CardLevel.RoleCardLevelName(obj) };
                CardTabControl.TabPages.Add(page);

                var listData        = new BindingList<RoleCard>();
                var list            = new ListBox()
                {
                    Dock                = DockStyle.Fill,
                    ContextMenuStrip    = TabControlContextMenu,
                    DisplayMember       = "Name",
                    ValueMember         = "Id",
                    DataSource          = listData,
                };
                
                list.SelectedIndexChanged += (sender, msg) =>
                {
                    var item = list.SelectedItem as RoleCard;
                    if (ListOfRoleCardList[CardTabControl.SelectedIndex].Contains(item))
                    {
                        SelectedItem = item;

                        cardInfoControl1.BeginModify();
                        cardInfoControl1.Images     = CardImageDictionary[SelectedItem.Id];
                        cardInfoControl1.RoleCard   = SelectedItem;
                        cardInfoControl1.EndModify();
                    }
                };

                page.Controls.Add(list);
                ListOfRoleCardList.Add(listData);
            }
        }
        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();
        }
Example #3
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);
     }
 }
Example #4
0
        public Form1()
        {
            InitializeComponent();
            util = new Utility();
            mainJobList = new BindingList<IndeedDetails>();
            filtered = new List<IndeedDetails>();
            sortKeeper = new GridSortBy();
            //worker stuff
            worker = new BackgroundWorker();

            worker.DoWork += BackgroundWorkerDoWork;
            worker.RunWorkerCompleted +=
               BackgroundWorkerRunWorkerCompleted;

            string file_name = @"C:\Users\apersinger\Documents\Misc\jsonjobs.txt";
            string file_contents = util.OpenFile(file_name);
            if(file_contents.Length > 0) {
                data = util.DeserializeString(file_contents);
                mainJobList = new BindingList<IndeedDetails>(data);
                dataGridView1.DataSource = mainJobList;
            }

            txtURL.Text = "www.indeed.com";
            txtLocation.Text = "california";
            txtJobTitle.Text = "software";

            btnFilterResults.Enabled = false;
        }
        private BindingList<PurchOrder_Receive> CalcPurchOrderLine(Session session)
        {
            BindingList<PurchOrder_Receive> poReceives = new BindingList<PurchOrder_Receive>();

            XPClassInfo poLineClass;
            CriteriaOperator criteria;
            SortingCollection sortProps;
            StringBuilder sbCriteria = new StringBuilder();

            sbCriteria.Append(string.Format("OrderStatus = '{0}'", PurchOrderLine.PurchOrderStatus.Active));

            if (txtItemNo.Text != "")
                sbCriteria.Append(string.Format(" AND Item.ItemNo = '{0}'", txtItemNo.Text));

            if (txtVendor.Text != "")
                sbCriteria.Append(string.Format(" AND Vendor.No = '{0}'", txtVendor.Text));

            poLineClass = session.GetClassInfo(typeof(PurchOrderLine));
            criteria = CriteriaOperator.Parse(sbCriteria.ToString());
            sortProps = new SortingCollection(null);

            ICollection poLines = session.GetObjects(poLineClass, criteria, sortProps, int.MaxValue, false, true);

            foreach (PurchOrderLine poLine in poLines)
            {
                PurchOrder_Receive poReceive = new PurchOrder_Receive();
                poReceive.PurchOrderLine = poLine;
                poReceive.Item = poLine.Item;
                poReceive.ItemType = poLine.Item.ItemType;
                poReceive.ReceivedWarehouse = poLine.Warehouse;
                poReceives.Add(poReceive);
            }

            return poReceives;
        }
Example #6
0
        /// <summary>
        /// Initializes the map with values from parameter.
        /// </summary>
        /// <param name="folderName">Deprecated</param>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="fieldSize"></param>
        /// <param name="hitbox"></param>
        /// <param name="carStartSpeed"></param>
        /// <param name="carStartDirection"></param>
        /// <param name="published"></param>
        /// <param name="carStartPositions"></param>
        /// <param name="roundFinishedPositions"></param>
        /// <param name="forbiddenPositions"></param>
        public Map(
            String folderName, String id, String title, String description,
            int fieldSize, int hitbox, int carStartSpeed,
            String carStartDirection, Boolean published, BindingList<Node> carStartPositions,
            BindingList<Node> roundFinishedPositions, BindingList<Node> forbiddenPositions,
            Image image
            )
        {
            this.FolderName = folderName;

            this.Id = id;
            this.Title = title;
            this.Description = description;

            this.FieldSize = fieldSize;
            this.Hitbox = hitbox;
            this.CarStartSpeed = carStartSpeed;
            this.CarStartDirection = carStartDirection;
            this.Published = published;

            this.CarStartPositions = carStartPositions;
            this.RoundFinishedPositions = roundFinishedPositions;
            this.ForbiddenPositions = forbiddenPositions;

            this.Image = image;
        }
 public RealGridsManagerWindow()
 {
     InitializeComponent();
     _savedList = new List<RealGridData>();
     _gridsList = new BindingList<RealGridData>();
     _gridListView.ItemsSource = _gridsList;
 }
Example #8
0
        public FormIgnores()
        {
            InitializeComponent();

            Opcodes = new BindingList<ushort>(Ignores.I.Values);
            listOpcodes.DataSource = Opcodes;
        }
		private void MakeMaterialsPage()
			{
			Materials = new BindingList<MaterialDataBinder>();
			foreach( MaterialData material in Application.OpenedProject.Materials )
				Materials.Add( new MaterialDataBinder( new MaterialData( material ) ) );
			listBoxMedium.DataSource = Materials;
			}
Example #10
0
		private void SlowDown(BindingList<DebugLine> bindedList, Action<BindingList<DebugLine>> action)
		{
			var uiSynchronyzer = new UISynchronyzer<IList<IEvent<ListChangedEventArgs>>>();
			Observable.FromEvent<ListChangedEventArgs>(bindedList, "ListChanged").BufferWithTime(TimeSpan.FromSeconds(1)).
				Subscribe(uiSynchronyzer);
			uiSynchronyzer.Subscribe(ev => action(bindedList));
		}
Example #11
0
        /// <summary>
        /// Initializes static members of the <see cref="MovieSetManager"/> class.
        /// </summary>
        static MovieSetManager()
        {
            database = new BindingList<MovieSetModel>();
            currentSet = new MovieSetModel();

            database.ListChanged += Database_ListChanged;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsCallback)
        {
            //http://www.codeproject.com/articles/432860/asp-net-plotter-toolkit-html5-charting-for-all
            AlsiDBDataContext dc = new AlsiDBDataContext();
            var data = dc.OHLC_5_Minutes.Take(25000).ToList();
            Label1.Text = data.Count.ToString();
            Curve curve = new Curve();
            var points = new Point[data.Count];

            for (int x = 0; x < data.Count; x++)
            {
                var p = new Point(data[x].Stamp, data[x].C);
                points[x] = p;
            }


            BindingList<Curve> Curves = new BindingList<Curve> { curve };

            curve.Points = points;
            curve.Label = "Dfdfdfdff";

            Dygraph1.Curves = Curves;
         
            Dygraph1.YLowRange = data.Min(z => z.C);//if error check db
            Dygraph1.YHighRange = data.Max(z => z.C);
        }
        
    }
        public VirtualListVewModel(SynchronizationContext bindingContext, DataService service)
        {
            _virtualRequest = new BehaviorSubject<VirtualRequest>(new VirtualRequest(0,10));

            Items = new BindingList<Poco>();

            var sharedDataSource = service
                .DataStream
                .Do(x => Trace.WriteLine($"Service -> {x}"))
                .ToObservableChangeSet()
                .Publish();

            var binding = sharedDataSource
                          .Virtualise(_virtualRequest)
                          .ObserveOn(bindingContext)
                          .Bind(Items)
                          .Subscribe();
            
            //the problem was because Virtualise should fire a noticiation if count changes, but it does not [BUG]
            //Therefore take the total count from the underlying data NB: Count is DD.Count() not Observable.Count()
            Count = sharedDataSource.Count().DistinctUntilChanged();

            Count.Subscribe(x => Trace.WriteLine($"Count = {x}"));

            var connection = sharedDataSource.Connect();
            _disposables = new CompositeDisposable(binding, connection);
        }
Example #14
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();
        }
Example #15
0
 private DomainFacade(IPlugin pPlugin)
 {
     cPlugin = pPlugin;
       cObserverList = new List<IObserver>();
       cRecordList = new BindingList<DNSPoisonRecord>();
       cInfrastructure = InfrastructureFacade.getInstance(pPlugin);
 }
Example #16
0
File: UPT.cs Project: am1guma/PSSC
 private void afiseazaStudentiCazati(object sender, EventArgs e)
 {
     int nr = Convert.ToInt32(textBox3.Text);
     double min = Convert.ToDouble(textBox4.Text);
     double max = Convert.ToDouble(textBox5.Text);
     List<FisaCazare> fise = new List<FisaCazare>();
     foreach (DataRowView drv in studentiBindingSource.List)
     {
         int suma = 0;
         int n = 0;
         foreach (DataRow dr in databaseDataSet.Tables[1].Rows)
             if (drv["Nr_matricol"].ToString().Equals(dr["Nr_matricol"].ToString()))
             {
                 suma += Convert.ToInt32(dr["Nota"].ToString());
                 n++;
             }
         FisaCazare fisa = new FisaCazare(drv["Nume"].ToString(), drv["Prenume"].ToString(), drv["Facultate"].ToString(), Convert.ToInt32(drv["An"].ToString()), Math.Round((double)suma / n,2));
         fise.Add(fisa);
     }
     List<FisaCazare> SortedList = fise.OrderByDescending(o => o.Medie).ToList().FindAll(c => (c.Medie<=max) && (c.Medie>=min));
     while (SortedList.Count > nr)
         SortedList.RemoveAt(SortedList.Count - 1);
     var bindingList = new BindingList<FisaCazare>(SortedList);
     var source = new BindingSource(bindingList, null);
     dataGridView1.DataSource = source;
 }
Example #17
0
        public AddMappingDialog(BindingList<KeyMapping> mappings, ClassDefinition acls, ClassDefinition rcls)
            : this()
        {
            _mappings = mappings;

            lblClass.Text = rcls.QualifiedName;
            lblAssocClass.Text = acls.QualifiedName;

            List<DataPropertyDefinition> aprops = new List<DataPropertyDefinition>();
            List<DataPropertyDefinition> rprops = new List<DataPropertyDefinition>();

            foreach (PropertyDefinition p in acls.Properties)
            {
                if (p.PropertyType == PropertyType.PropertyType_DataProperty)
                    aprops.Add((DataPropertyDefinition)p);
            }

            foreach (PropertyDefinition p in rcls.Properties)
            {
                if (p.PropertyType == PropertyType.PropertyType_DataProperty)
                    rprops.Add((DataPropertyDefinition)p);
            }

            cmbActiveProperty.DataSource = rprops;
            cmbAssociatedProperty.DataSource = aprops;

            cmbActiveProperty.SelectedIndex = 0;
            cmbAssociatedProperty.SelectedIndex = 0;
        }
Example #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     // Load temperature from Service layer
     temperatureService = new System.ServiceModel.ChannelFactory<ServiceContract.MeteoServiceContract>("meteoServiceEndpoint").CreateChannel();
     var meteoDataList = new BindingList<DataContract.MeteoData>(temperatureService.GetMeteoData());
     this.dataGridView1.DataSource = meteoDataList;
 }
Example #19
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;
        }
Example #20
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     this.register.SaveStudents(this.studentList.ToList());
     studentList = new BindingList<Student>(register.GetAllStudents());
     GridViewDetais.DataSource = studentList;
     MessageBox.Show("Successfully Saved.");
 }
Example #21
0
        public BindingList<BatchIntervalMarked> GetMarkedBatchIntervals(int captureBatchId)
        {
            BindingList<BatchIntervalMarked> intervals = new BindingList<BatchIntervalMarked>();

            using (var context = new PacketAnalysisEntity())
            {
                var batchIntervals = from b in context.BatchIntervals
                                     where b.CaptureBatchId == captureBatchId
                                     select new
                                     {
                                         b.BatchIntervalId,
                                         b.CaptureBatchId,
                                         b.IntervalNumber,
                                         b.PacketCount,
                                         b.CaptureBatch.Marked
                                     };

                foreach (var bi in batchIntervals)
                {
                    BatchIntervalMarked bim = new BatchIntervalMarked();
                    bim.BatchIntervalId = bi.BatchIntervalId;
                    bim.CaptureBatchId = bi.CaptureBatchId;
                    bim.IntervalNumber = bi.IntervalNumber;
                    bim.PacketCount = bi.PacketCount;
                    bim.Marked = bi.Marked == true ? CaptureState.Marked : CaptureState.Unmarked;
                    intervals.Add(bim);
                }
            }
            return intervals;
        }
        public BindingList<FacturaDto> ListarFacturas()
        {
            try
            {
                using (BdEntities dbContext = new BdEntities())
                {
                    var Query = (from n in dbContext.factura
                                 select new FacturaDto
                                 {
                                     n_Factura = n.n_Factura,
                                     id_Client = n.id_Client,
                                     Data = n.Data,
                                     Descompte = n.Descompte,
                                     IVA = n.IVA
                                 }).ToList();
                    BindingList<FacturaDto> Result = new BindingList<FacturaDto>(Query);
                    return Result;
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
Example #23
0
        public BaseJointShow(string name)
        {
            _name = name;

            _importedShows = new BindingList<IShow>();
            _showOrderList = new BindingList<IShow>();
        }
Example #24
0
        public MainWindow()
        {
            InitializeComponent();
            TextItems = new BindingList<string>();

            TheItems.ItemsSource = TextItems;
        }
        /// <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;
        }
Example #26
0
 public SelectAction(Hotkey hotkey)
 {
     InitializeComponent();
     _hotkey = hotkey;
     _actions = hotkey.Actions;
     _actionContainer = new ActionContainer();
 }
Example #27
0
        public KeyboardConsumer()
            : base()
        {
            singleStroke = false;

            keymappings = new BindingList<Keymapping>();
            InitKeys();
            _converter = new MovCodeToStringConverter();

            _movsToKeyCodes = new Dictionary<int, VirtualKeyCode>();

            _keyboardControl = new KeyboardControl();
            _keyboardControl.viewModel.keyboardConsumer = this;

            consumerControl = new BaseControl();

            ((BaseControl)consumerControl).viewModel.realtimeConsumer = this;
            ((BaseControl)consumerControl).itemsGrid.Children.Clear();
            ((BaseControl)consumerControl).itemsGrid.Children.Add(_keyboardControl);

            _simulator = new InputSimulator();

            //UpdateKeymappings();

            keymappings.ListChanged += keymappings_ListChanged;

            //Configuring a timer that will call the Keystroke method each 100 milliseconds.
            _timer = new FastTimer(3, 100, Keystroke);
        }
Example #28
0
        public static void DeserializeFromXml(string xml)
        {
            //When there is nothing to deserialize, add default scripts
            if (string.IsNullOrEmpty(xml))
            {
                Scripts = new BindingList<ScriptInfo>();
                AddDefaultScripts();
                return;
            }

            try
            {
                var serializer = new XmlSerializer(typeof(BindingList<ScriptInfo>));
                using (var stringReader = new StringReader(xml))
                using (var xmlReader = new XmlTextReader(stringReader))
                {
                    Scripts = serializer.Deserialize(xmlReader) as BindingList<ScriptInfo>;
                }
            }
            catch (Exception ex)
            {
                Scripts = new BindingList<ScriptInfo>();
                DeserializeFromOldFormat(xml);

                Trace.WriteLine(ex.Message);
            }
        }
 private void loadSomeData()
 {
     ProductAttributeService productAttrService = new ProductAttributeService();
     products = new BindingList<ProductAttributeModel>(productAttrService.GetProductAndAttribute());
     units = new BindingList<MeasurementUnit>(unitService.GetMeasurementUnits());
     if (entranceStock != null)
     {
         txtCode.Text = entranceStock.EntranceCode;
         txtNote.Text = entranceStock.Note;
         txtDate.Text = entranceStock.CreatedDate.ToString(BHConstant.DATE_FORMAT);
         txtUser.Text = entranceStock.SystemUser.FullName;
     }
     else
     {
         if (Global.CurrentUser != null)
         {
             txtUser.Text = Global.CurrentUser.FullName;
         }                
         txtUser.Enabled = false;
         txtDate.Text = BaoHienRepository.GetBaoHienDBDataContext().GetSystemDate().ToString(BHConstant.DATE_FORMAT);
         txtCode.Text = Global.GetTempSeedID(BHConstant.PREFIX_FOR_ENTRANCE);
     }
     txtDate.Enabled = false;
     txtUser.Enabled = false;
 }
 public Points3DManagerWindow()
 {
     InitializeComponent();
     _savedList = new List<Camera3DPoint>();
     _pointList = new BindingList<Camera3DPoint>();
     _pointListView.ItemsSource = _pointList;
 }
Example #31
0
 public ClientesBL()
 {
     _contexto     = new Contexto();
     ListaClientes = new BindingList <Cliente>();
 }
Example #32
0
 public ViajesBL()
 {
     ListadeViajes = new BindingList <Viaje>();
     CargarDatos();
 }
Example #33
0
 public MyRandomBusinessClass(Action <MyRandomBusinessClass, CustomMessage> cba)
 {
     LoggingList         = new BindingList <CustomMessage>();
     this.CallBackAction = cba;
 }
Example #34
0
 public VehiculoBL()
 {
     _contexto     = new Contexto();
     ListaVehiculo = new BindingList <Vehiculo>();
 }
Example #35
0
 public BubbleSort(BindingList <Model> colorList)
 {
     ColorList     = colorList;
     unsortedCount = colorList.Count;
 }
Example #36
0
 public PersonEditorModel()
 {
     Titles = new BindingList <string>();
     UpdateTitles();
 }
Example #37
0
 private void setLanguage(bool bCheck, LanguageModel language)
 {
     BCheckLan     = bCheck;
     languageModel = language;
     if (bCheck)
     {
         if (language != null)
         {
             if (language.StrLanguageID == DefaultLan)
             {
                 DevExpress.XtraEditors.XtraMessageBox.Show("Đây là ngôn ngữ mặc định bạn phải chọn ngôn ngữ khác để thay đổi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 DefaultLan = language.StrLanguageID;
                 //_lstWord = _Word.getLstWord(this.Name);
                 _lstLanWord = _WL.getLstLanguageWord(DefaultLan, this.Name);
                 if (studentModel != null || staffModel != null)
                 {
                     foreach (LanguageWordModel lnword in _lstLanWord)
                     {
                         _wordModel = _Word.getWordSelected(lnword.StrWordID);
                         //_languageModel = _WL.getWordLanguageSelectedByID(lnword.StrID);
                         if (itemStatic.Text == _wordModel.StrWordName)
                         {
                             itemStatic.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemMulLan.Text == _wordModel.StrWordName)
                         {
                             itemMulLan.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (lblType.Text == _wordModel.StrWordName)
                         {
                             lblType.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (btnSetLan.Text == _wordModel.StrWordName)
                         {
                             btnSetLan.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (btnLogin.Text == _wordModel.StrWordName)
                         {
                             btnLogin.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (btnInformation.Text == _wordModel.StrWordName)
                         {
                             btnInformation.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (btnExit.Text == _wordModel.StrWordName)
                         {
                             btnExit.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemDecentralization.Text == _wordModel.StrWordName)
                         {
                             itemDecentralization.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemStatic.Text == _wordModel.StrWordName)
                         {
                             itemStatic.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemMulLan.Text == _wordModel.StrWordName)
                         {
                             itemMulLan.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageProject.Text == _wordModel.StrWordName)
                         {
                             itemManageProject.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManagStaffType.Text == _wordModel.StrWordName)
                         {
                             itemManagStaffType.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageLecturer.Text == _wordModel.StrWordName)
                         {
                             itemManageLecturer.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageStudent.Text == _wordModel.StrWordName)
                         {
                             itemManageStudent.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageStudent.Text == _wordModel.StrWordName)
                         {
                             itemManageStudent.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageFaculty.Text == _wordModel.StrWordName)
                         {
                             itemManageFaculty.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManageClass.Text == _wordModel.StrWordName)
                         {
                             itemManageClass.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                         if (itemManagSubject.Text == _wordModel.StrWordName)
                         {
                             itemManagSubject.Text = _WL.getMeanByID(lnword.StrID, languageModel.StrLanguageID);
                         }
                     }
                     //if(itemStatic.Text == word.StrWordName)
                     //{
                     //    itemStatic.Text = _WL.getMeanByID(word.StrWordId, languageModel.StrLanguageID);
                     //}
                     //if (itemMulLan.Text == word.StrWordName)
                     //{
                     //    itemMulLan.Text = _WL.getMeanByID(word.StrWordId, languageModel.StrLanguageID);
                     //}
                     //lblType.Text = _WL.getMean(lblType.Text, language.StrLanguageID);
                     //btnSetLan.Text = _WL.getMean(btnSetLan.Text, language.StrLanguageID);
                     //btnLogin.Text = _WL.getMean(btnLogin.Text, language.StrLanguageID);
                     //btnInformation.Text = _WL.getMean(btnInformation.Text, language.StrLanguageID);
                     //btnExit.Text = _WL.getMean(btnExit.Text, language.StrLanguageID);
                     //itemDecentralization.Text = _WL.getMean(itemDecentralization.Text, language.StrLanguageID);
                     //itemStatic.Text= _WL.getMean(itemStatic.Text, language.StrLanguageID);
                     //itemMulLan.Text = _WL.getMean(itemMulLan.Text, language.StrLanguageID);
                     //itemManageProject.Text = _WL.getMean(itemManageProject.Text, language.StrLanguageID);
                     //itemManagStaffType.Text = _WL.getMean(itemManagStaffType.Text, language.StrLanguageID);
                     //itemManageLecturer.Text = _WL.getMean(itemManageLecturer.Text, language.StrLanguageID);
                     //itemManageStudent.Text = _WL.getMean(itemManageStudent.Text, language.StrLanguageID);
                     //itemManageFaculty.Text = _WL.getMean(itemManageFaculty.Text, language.StrLanguageID);
                     //itemManageClass.Text = _WL.getMean(itemManageClass.Text, language.StrLanguageID);
                     //itemManagSubject.Text = _WL.getMean(itemManagSubject.Text, language.StrLanguageID);
                 }
                 lstLanguageWord = _WL.getListLanguageWord(language.StrLanguageID);
             }
         }
     }
 }
Example #38
0
        public UcDonHang(Define.LoaiDonHangEnum loaiDonHang, DonHang data = null)
        {
            InitializeComponent();

            DonHang_KhachHangId.DisplayMember = "Ten";
            DonHang_KhachHangId.ValueMember   = "Id";
            var lstKhachHang = new List <KhachHang>();

            if (loaiDonHang == Define.LoaiDonHangEnum.XuatKho)
            {
                lstKhachHang        = CRUD.DbContext.KhachHangs.Where(s => s.LoaiKhachHang != Define.LoaiKhachHangEnum.NhaCungCap.ToString()).ToList();
                lblKhachHangId.Text = "Khách Hàng";
            }
            else
            {
                lstKhachHang = CRUD.DbContext.KhachHangs.Where(s => s.LoaiKhachHang == Define.LoaiKhachHangEnum.NhaCungCap.ToString()).ToList();
            }
            DonHang_KhachHangId.DataSource = new BindingSource((lstKhachHang), null);
            _loaiDonHang = loaiDonHang;
            _domainData  = data;
            if (_domainData == null)
            {
                _domainData = new DonHang();
            }

            Init(_domainData);
            if (_domainData.Id > 0)
            {
                _chiTietDonhang = new BindingList <ChiTietDonHang>(_domainData.ChiTietDonHangs.ToList());
                if (_domainData.KhachHangId == Define.KhachLeId)
                {
                    var khachLe = lstKhachHang.FirstOrDefault(s => s.Id == Define.KhachLeId);
                    if (khachLe != null)
                    {
                        khachLe.Ten = _domainData.Ten;
                    }
                }
                btnDelete.Visible = true;

                _chiTietDonhang.ForEach(s => s.ListChiTietHangHoa = s.ChiTietHangHoas.ToList());
            }
            else
            {
                btnDelete.Visible   = false;
                _domainData.NgayLap = TimeHelper.CurentDateTime();
            }

            // Get list hang hoa
            var dataSource = CRUD.DbContext.KhoHangs
                             .Where(s => s.IsActived == null || s.IsActived == true)
                             .Select(s => new { s.TenHang, s.Id })
                             .Union(CRUD.DbContext.ChiTietDonHangs.Join(CRUD.DbContext.KhoHangs, ctdh => ctdh.HangHoaId, kh => kh.Id,
                                                                        (ctdh, kh) => new { kh.TenHang, kh.Id })).ToList();

            FormBehavior.DecoreateLookEdit(listHangHoa, dataSource, "TenHang");
            listHangHoa.EditValueChanged += listHangHoa_EditValueChanged;

            gridControlChiTiet.DataSource = _chiTietDonhang;
            btnDeleteRow.ButtonClick     += btnDeleteRow_ButtonClick;

            UpdateTongTien();
            UpdateNo();
        }
Example #39
0
        /// <summary>
        /// Searches Bing.com API
        /// </summary>
        /// <param name="query">The QueryString to search against</param>
        /// <param name="urlmatch">Only return URLs containing the following match</param>
        /// <param name="threadID">The thread MovieUniqueId.</param>
        /// <returns>First successful match.</returns>
        public static BindingList <QueryResult> SearchBing(string query, string urlmatch, int threadID, string regexTitle, string regexYear, string regexID, ScraperList scraperList)
        {
            var logCatagory = "Scrape > Bing Search > " + query;

            try
            {
                var queryResults = new BindingList <QueryResult>();

                query = query.Replace("%20", " ");

                using (var service = new BingService())
                {
                    var searchRequest = new SearchRequest
                    {
                        Query   = query,
                        Sources = new[] { SourceType.Web },
                        AppId   = "9A2F2F47CF77629DA4E35E912F4B696217DCFC3C"
                    };

                    var webRequest = new WebRequest
                    {
                        Count           = 10,
                        Offset          = 0,
                        OffsetSpecified = true
                    };
                    searchRequest.Web = webRequest;

                    var response = service.Search(searchRequest);

                    if (response.Web.Results != null)
                    {
                        foreach (var result in response.Web.Results)
                        {
                            if (string.IsNullOrEmpty(result.Url) || result.Url.Contains(urlmatch))
                            {
                                var queryResult = new QueryResult();

                                if (Regex.IsMatch(result.Title, regexTitle))
                                {
                                    if (Regex.IsMatch(result.Url, regexID))
                                    {
                                        switch (scraperList)
                                        {
                                        case ScraperList.Imdb:
                                            queryResult.ImdbID = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.TheMovieDB:
                                            queryResult.TmdbID = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.Allocine:
                                            queryResult.AllocineId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.FilmAffinity:
                                            queryResult.FilmAffinityId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.FilmDelta:
                                            queryResult.FilmDeltaId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.FilmUp:
                                            queryResult.FilmUpId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.FilmWeb:
                                            queryResult.FilmWebId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.Impawards:
                                            queryResult.ImpawardsId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.Kinopoisk:
                                            queryResult.KinopoiskId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.OFDB:
                                            queryResult.OfdbId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.MovieMeter:
                                            queryResult.MovieMeterId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;

                                        case ScraperList.Sratim:
                                            queryResult.SratimId = Regex.Match(result.Url, regexID).Groups["id"].Value;
                                            break;
                                        }
                                    }

                                    queryResult.Title = Regex.Match(result.Title, regexTitle).Groups["title"].Value;
                                    queryResult.Year  = Regex.Match(result.Title, regexYear).Groups["year"].Value.ToInt();
                                }
                                else
                                {
                                    queryResult.Title = result.Title;
                                }

                                queryResult.AdditionalInfo = result.Description;
                                queryResult.URL            = result.Url;

                                queryResults.Add(queryResult);
                            }
                        }
                    }

                    return(queryResults);
                }
            }
            catch (Exception ex)
            {
                Log.WriteToLog(LogSeverity.Error, LoggerName.GeneralLog, logCatagory, ex.Message);
                return(null);
            }
        }
Example #40
0
        private void buttonAnalizar_Click(object sender, EventArgs e)
        {
            var    tokens = new BindingList <Token>();
            string cadena, lexema, token;
            int    i, estado, valor;

            i      = 0;
            estado = 0;
            cadena = textBoxAnalisis.Text;

            while (i <= (cadena.Length - 1) && estado == 0)
            {
                lexema = "";
                token  = "";
                valor  = -1;
                while (i <= (cadena.Length - 1) && estado != -1)
                {
                    if (estado == 0)
                    {
                        if (Char.IsWhiteSpace(cadena, i)) //ignorar espacios
                        {
                            estado = 0;
                        }
                        else if (Char.IsLetter(cadena, i) || cadena[i] == '_') //empieza id
                        {
                            estado  = 1;
                            lexema += cadena[i];
                            token   = "id";
                            valor   = 1;
                        }
                        else if (Char.IsDigit(cadena, i)) //empieza constante
                        {
                            estado  = 2;
                            lexema += cadena[i];
                            token   = "constante";
                            valor   = 13;
                        }
                        else if (cadena[i] == ';') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = ";";
                            valor   = 2;
                            estado  = -1;
                        }
                        else if (cadena[i] == ',') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = ",";
                            valor   = 3;
                            estado  = -1;
                        }
                        else if (cadena[i] == '(') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = "(";
                            valor   = 4;
                            estado  = -1;
                        }
                        else if (cadena[i] == ')') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = ")";
                            valor   = 5;
                            estado  = -1;
                        }
                        else if (cadena[i] == '{') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = "{";
                            valor   = 6;
                            estado  = -1;
                        }
                        else if (cadena[i] == '}') //Solo es un caracter por lo que no necesita estado propio
                        {
                            lexema += cadena[i];
                            token   = "}";
                            valor   = 7;
                            estado  = -1;
                        }
                        else if (cadena[i] == '=') //Puede ser relacional o solo =
                        {
                            estado  = 5;
                            lexema += cadena[i];
                            token   = "=";
                            valor   = 8;
                        }
                        else if (cadena[i] == '<' || cadena[i] == '>') //Relacional
                        {
                            estado  = 5;
                            lexema += cadena[i];
                            token   = "opRelacional";
                            valor   = 17;
                        }
                        else if (cadena[i] == '!') //Es error a menos que siga un '='
                        {
                            estado  = 5;
                            lexema += cadena[i];
                            token   = "error";
                            valor   = -1;
                        }
                        else if (cadena[i] == '+' || cadena[i] == '-') //Solo un caracter no necesita estado
                        {
                            lexema += cadena[i];
                            token   = "opSuma";
                            valor   = 14;
                            estado  = -1;
                        }
                        else if (cadena[i] == '*' || cadena[i] == '/') //No necesita estado
                        {
                            lexema += cadena[i];
                            token   = "opMultiplicacion";
                            valor   = 16;
                            estado  = -1;
                        }
                        else if (cadena[i] == '|' || cadena[i] == '&') //Estado opLogico
                        {
                            lexema += cadena[i];
                            token   = "error";
                            valor   = -1;
                            estado  = 6;
                        }
                        else if (cadena[i] == '$') //No necesita estado
                        {
                            lexema += cadena[i];
                            token   = "$";
                            valor   = 18;
                            estado  = -1;
                        }
                        else
                        {
                            lexema += cadena[i];
                            token   = "error";
                            valor   = -1;
                            estado  = -1;
                        }
                        i++;
                    }
                    else if (estado == 1)  //Estado del id
                    {
                        if (Char.IsLetter(cadena, i) || cadena[i] == '_' || Char.IsDigit(cadena, i))
                        {
                            estado  = 1;
                            lexema += cadena[i];
                            i++;
                        }
                        else //se determina si es palabra reservada
                        {
                            estado = -1;
                            if (lexema == "int" || lexema == "float" || lexema == "char" || lexema == "void")
                            {
                                token = "tipoDeDato";
                                valor = 0;
                            }
                            else if (lexema == "if")
                            {
                                token = lexema;
                                valor = 9;
                            }
                            else if (lexema == "while")
                            {
                                token = lexema;
                                valor = 10;
                            }
                            else if (lexema == "return")
                            {
                                token = lexema;
                                valor = 11;
                            }
                            else if (lexema == "else")
                            {
                                token = lexema;
                                valor = 12;
                            }
                            else
                            {
                                token = "id";
                                valor = 1;
                            }
                        }
                    }
                    else if (estado == 2) //estado de entero (constante)
                    {
                        if (Char.IsDigit(cadena, i))
                        {
                            estado  = 2;
                            lexema += cadena[i];
                            i++;
                        }
                        else if (cadena[i] == '.') // puede ser real (constante)
                        {
                            estado  = 3;
                            lexema += cadena[i];
                            i++;
                            token = "error";
                            valor = -1;
                        }
                        else
                        {
                            estado = -1;
                        }
                    }
                    else if (estado == 3) // Estado de transicion entero a real
                    {
                        if (Char.IsDigit(cadena, i))
                        {
                            estado  = 4;
                            lexema += cadena[i];
                            token   = "constante";
                            valor   = 13;
                            i++;
                        }
                        else
                        {
                            estado = -1;
                        }
                    }
                    else if (estado == 4) // Estado de real (constante)
                    {
                        if (Char.IsDigit(cadena, i))
                        {
                            estado  = 4;
                            lexema += cadena[i];
                            i++;
                        }
                        else
                        {
                            estado = -1;
                        }
                    }
                    else if (estado == 5)     //Estado relacional
                    {
                        if (cadena[i] == '=') //Si llegan a este estado (=,<,>,!) pueden recibir un '=' mas
                        {
                            lexema += cadena[i];
                            token   = "opRelacional"; // '=' se vuelve opRelacional
                            valor   = 17;
                            i++;
                        }
                        estado = -1;      //Si no es un '=' se mantienen igual y sale
                    }
                    else if (estado == 6) //Estado opLogico
                    {
                        if (lexema[0] == cadena[i])
                        {
                            lexema += cadena[i];
                            token   = "opLogico";
                            valor   = 15;
                            i++;
                        }
                        estado = -1;
                    }
                    else //NO DEBERIA DE ENTRAR NUNCA
                    {
                        estado = -1;
                    }
                } // fin while por lexema
                estado = 0;
                tokens.Add(new Token()
                {
                    tipo = token, identificador = valor, lexema = lexema
                });
            } //fin while que recorre la cadena
            dataGridViewLexico.DataSource = tokens;
        }
Example #41
0
        public void SearchFlight(DataGrid dataGrid)
        {
            BindingList <TicketsModel> heltlist = new BindingList <TicketsModel>();

            int valid;

            if ((Town == null || Town == "") && (Searchprice == null || Searchprice == ""))
            {
                for (int i = 0; i < allFlights.Count; i++)
                {
                    if (allFlights[i].DATE_FROM == SearchDate.ToString().Substring(0, 10))
                    {
                        heltlist.Add(allFlights[i]);
                    }
                }
            }
            else if (Town == null || Town == "")
            {
                if (Int32.TryParse(Searchprice, out valid))
                {
                    for (int i = 0; i < allFlights.Count; i++)
                    {
                        if ((allFlights[i].DATE_FROM == SearchDate.ToString().Substring(0, 10)) && (allFlights[i].price == Convert.ToInt32(Searchprice)))
                        {
                            heltlist.Add(allFlights[i]);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Некорректная цена");
                }
            }
            else if (Searchprice == null || Searchprice == "")
            {
                for (int i = 0; i < allFlights.Count; i++)
                {
                    if ((allFlights[i].DATE_FROM == SearchDate.ToString().Substring(0, 10)) && ((allFlights[i].townTo).ToLower() == Town.ToLower()))
                    {
                        heltlist.Add(allFlights[i]);
                    }
                }
            }
            else
            {
                if (Int32.TryParse(Searchprice, out valid))
                {
                    for (int i = 0; i < allFlights.Count; i++)
                    {
                        if ((allFlights[i].DATE_FROM == SearchDate.ToString().Substring(0, 10)) && ((allFlights[i].townTo).ToLower() == Town.ToLower()) && (allFlights[i].price == Convert.ToInt32(Searchprice)))
                        {
                            heltlist.Add(allFlights[i]);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Некорректная цена");
                }
            }
            dataGrid.ItemsSource = heltlist;
        }
Example #42
0
 public Search(BindingList <ToDoTask> toDo)
 {
     InitializeComponent();
     _toDoLists = toDo;
     //DataGridListSearch.ItemsSource = _toDoLists;
 }
Example #43
0
        /// <summary>
        /// Form Loaded
        /// </summary>
        private void Evt_Loaded(object sender, EventArgs e)
        {
            //文件
            Config = ConfigHelper.ReadAllConfig <ConfigData>();

            if (String.IsNullOrEmpty(Config.LastOpenendPath))
            {
                Config.LastOpenendPath = "SimpleColor.fx";
            }
            if (String.IsNullOrEmpty(Config.TexturePath))
            {
                Config.TexturePath = "texture01.jpg";
            }


            //applyconfig

            //Create MonoGame Wnd for 3D display
            // Can't change parent windows !?
            m_game = new Game1();

            m_game.IsMouseVisible           = true;
            m_game.Window.AllowUserResizing = false;
            m_game.Window.AllowAltF4        = false;

            m_game.RunOneFrame();


            //Create Primitives List
            var gd = m_game.GraphicsDevice;

            m_primitivesList = new BindingList <GeometricPrimitive>();
            m_primitivesList.Add(new CubePrimitive(gd));
            m_primitivesList.Add(new SpherePrimitive(gd));
            m_primitivesList.Add(new CylinderPrimitive(gd));
            m_primitivesList.Add(new TorusPrimitive(gd));
            m_primitivesList.Add(new TeapotPrimitive(gd));


            //UI init
            toolStripComboBoxModel.ComboBox.DataSource = m_primitivesList;
            textureSlotsUserControl1.Game1             = m_game;

            //Load default textures
            textureSlotsUserControl1.SetTextureSlot(0, Config.TexturePath);

            //IDLE event for 3D Drawing
            Application.Idle += Application_Idle;

            //Start Default effect
            using (var stream = File.OpenText(Config.LastOpenendPath))
            {
                var shader = stream.ReadToEnd();
                m_scintillaCtrl.Text = shader;
                m_scintillaCtrl.SetSavePoint();

                DoBuild(shader);
            }

            //Help
            webBrowserHelp.Navigate(Path.Combine(Environment.CurrentDirectory, "HLSL_Help.html"));


            //Test...
            //HighlightWord("float4");

            //(new Thread(() => { Thread.Sleep(10000);
            //        Debug.Print("test");
            //        m_game.ChangeRenderMode(Config.RenderMode);

            //        Thread.Sleep(300); }
            //)).Start();
            ChangeWindowSize(Config.RecWidth, Config.RecWidth);
            ChangeRenderMode(Config.RenderMode);
        }
        public BindingList <DanbooruPost> Parse(string data, DanbooruSearchParam searchParam)
        {
            this.SearchParam = searchParam;

            this.RawData = data;

            BindingList <DanbooruPost> posts = new BindingList <DanbooruPost>();

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(data);

            // remove popular preview
            var popular = doc.DocumentNode.SelectSingleNode("//div[@id='popular-preview']");

            if (popular != null)
            {
                popular.Remove();
            }

            // get all thumbs
            var thumbs = doc.DocumentNode.SelectNodes("//span");

            if (thumbs != null && thumbs.Count > 0)
            {
                foreach (var thumb in thumbs)
                {
                    if (thumb.GetAttributeValue("class", "").Contains("thumb"))
                    {
                        DanbooruPost post = new DanbooruPost();
                        post.Id = thumb.GetAttributeValue("id", "_N/A").Substring(1);

                        post.Provider   = searchParam.Provider;
                        post.SearchTags = searchParam.Tag;
                        post.Query      = GenerateQueryString(searchParam);

                        int i = 0;
                        // get the image link
                        for (; i < thumb.ChildNodes.Count; ++i)
                        {
                            if (thumb.ChildNodes[i].Name == "a")
                            {
                                break;
                            }
                        }
                        var a = thumb.ChildNodes[i];
                        post.Referer = searchParam.Provider.Url + "/" + System.Web.HttpUtility.HtmlDecode(a.GetAttributeValue("href", ""));
                        if (post.Id == "N/A")
                        {
                            post.Id = a.GetAttributeValue("id", "N/A").Substring(1);
                        }

                        var img    = a.ChildNodes[i];
                        var title  = img.GetAttributeValue("title", "");
                        var title2 = title.ToString();
                        post.Tags       = title.Substring(0, title.LastIndexOf("rating:")).Trim();
                        post.Tags       = Helper.DecodeEncodedNonAsciiCharacters(post.Tags);
                        post.TagsEntity = Helper.ParseTags(post.Tags, SearchParam.Provider);
                        post.Hidden     = Helper.CheckBlacklistedTag(post, searchParam.Option);

                        post.PreviewUrl    = img.GetAttributeValue("src", "");
                        post.PreviewHeight = img.GetAttributeValue("height", 0);
                        post.PreviewWidth  = img.GetAttributeValue("width", 0);

                        post.Source = "";
                        post.Score  = title.Substring(title.LastIndexOf("score:") + 6);
                        post.Score  = post.Score.Substring(0, post.Score.LastIndexOf(" ")).Trim();

                        title2      = title2.Substring(title2.LastIndexOf("rating:"));
                        post.Rating = title2.Substring(7, 1).ToLower();

                        post.Status = "";

                        post.MD5 = post.PreviewUrl.Substring(post.PreviewUrl.LastIndexOf("/") + 1);
                        post.MD5 = post.MD5.Substring(0, post.MD5.LastIndexOf("."));
                        post.MD5 = post.MD5.Replace("thumbnail_", "");

                        posts.Add(post);
                    }
                }
            }

            TotalPost = posts.Count;
            if (!SearchParam.Page.HasValue)
            {
                SearchParam.Page = 0;
            }
            Offset = posts.Count * SearchParam.Page;

            return(posts);
        }
Example #45
0
        // ds Mat
        public BindingList <MatRequest> dsMat()
        {
            BindingList <MatRequest> ds = new BindingList <MatRequest>();

            return(ds);
        }
 public void SaveDownloadChapterTasks(BindingList <DownloadChapterTask> tasks)
 {
     SaveObject(tasks, DownloadChapterTasksFile);
 }
Example #47
0
 public Vendor(string name)
 {
     Name      = name;
     Inventory = new BindingList <InventoryItem>();
 }
Example #48
0
 public TituloBL()
 {
     ListaDeTitulos = new BindingList <Titulo>();
     CrearDatosdePrueba();
 }
        private void UserControl_Initialized(object sender, EventArgs e)
        {
            _listSale = new BindingList <ViewModel>();
            ItemSFChart.ItemsSource = _listSale;

            _list = new BindingList <Cakes>();
            ItemPieChart.ItemsSource = _list;
            this.DataContext         = this;

            var g = new Cakes()
            {
                Data = new SeriesCollection(),
            };

            var folder   = AppDomain.CurrentDomain.BaseDirectory;
            var database = $"{folder}ListCakes\\DB_DA3.xlsx";
            var ad       = database.Length;
            var workbook = new Workbook(database);
            var sheet    = workbook.Worksheets[1];


            var row = 2;


            ViewModel SF = new ViewModel()
            {
                Datas = new List <Sale>(),
            };



            var cell = sheet.Cells[$"A{row}"];
            int i    = 12;

            int j = 1;

            var ColumSF = 'B';

            while (cell.Value != null)
            {
                PieSeries Pie = new PieSeries()
                {
                    Values = new ChartValues <float> {
                        float.Parse(sheet.Cells[$"C{row}"].StringValue)
                    },
                    Title = $"{cell.StringValue}"
                };
                g.Data.Add(Pie);

                row++;
                cell = sheet.Cells[$"A{row}"];
            }
            while (j <= 12)
            {
                Sale sf = new Sale()
                {
                    Price = float.Parse(sheet.Cells[$"{char.ConvertFromUtf32(ColumSF + j - 1)}8"].StringValue),
                    Month = $"{j}"
                };

                SF.Datas.Add(sf);

                j++;
            }
            _listSale.Add(SF);
            _list.Add(g);
        }
Example #50
0
 public PresetDisplayCategory(string category, bool isBuildIn, BindingList <Preset> presets)
 {
     this.IsBuiltIn = isBuildIn;
     this.Category  = category;
     this.Presets   = presets;
 }
Example #51
0
 public ProductosBL()
 {
     ListadeProductos = new BindingList <Productos>();
     CrearDatosdePrueba();
 }
Example #52
0
 public CommanderNameTheme()
 {
     NameEntries = new BindingList <NameEntry>();
 }
Example #53
0
        public void InitBands(BindingList <ABCGridBandedColumn.ColumnConfig> listCol, BindingList <ABCGridBand.BandConfig> listBands)
        {
            ExploredColumns.Clear();

            BandsList  = new BindingList <ABCGridBand.BandConfig>();
            ColumnList = new BindingList <ABCGridBandedColumn.ColumnConfig>();

            if (listBands != null)
            {
                foreach (ABCGridBand.BandConfig config in listBands)
                {
                    BandsList.Add(InitBand(listCol, config));
                }
            }

            if (listCol != null)
            {
                foreach (ABCGridBandedColumn.ColumnConfig config in listCol)
                {
                    if (ExploredColumns.Contains(config) == false)
                    {
                        ColumnList.Add(config.Clone() as ABCGridBandedColumn.ColumnConfig);
                    }
                }
            }
        }
Example #54
0
        private void SetupForm_Load(object sender, EventArgs e)
        {
            ServiceNameEdit.Text = _clientConfig.ServiceName;
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_HTTP_BINARY_REMOTING, typeof(HttpBinaryRemoting)));
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_HTTP_SOAP_REMOTING, typeof(HttpSoapRemoting)));
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_HTTPS_BINARY_REMOTING, typeof(HttpSslBinaryRemoting)));
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_HTTPS_SOAP_REMOTING, typeof(HttpSslSoapRemoting)));
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_TCP_REMOTING, typeof(TcpRemoting)));
            ServiceProtocolEdit.Items.Add(new ProtocolItem(Strings.SETUPFORM_IPC_REMOTING, typeof(IpcRemoting)));

            foreach (ProtocolItem item in ServiceProtocolEdit.Items)
            {
                if (item.Protocol.FullName == _clientConfig.ServiceProtocol)
                {
                    ServiceProtocolEdit.SelectedItem = item;
                }
            }

            ServiceAddressEdit.Text  = _clientConfig.ServiceAddress;
            ServicePortEdit.Minimum  = IPEndPoint.MinPort;
            ServicePortEdit.Maximum  = IPEndPoint.MaxPort;
            ServicePortEdit.Value    = _clientConfig.ServicePort;
            ServiceUserEdit.Text     = _clientConfig.ServiceUserName;
            ServicePasswordEdit.Text = _clientConfig.ServicePassword;

            SocksEnabledEdit.Checked = _clientConfig.SocksEnabled;
            SocksSharedEdit.Checked  = _clientConfig.SocksShared;
            SocksPortEdit.Minimum    = IPEndPoint.MinPort;
            SocksPortEdit.Maximum    = IPEndPoint.MaxPort;
            SocksPortEdit.Value      = _clientConfig.SocksPort;

            ProxyEnabledEdit.Checked           = _clientConfig.ProxyEnabled;
            Proxy100Continue.Checked           = _clientConfig.Expect100Continue;
            ProxyAuthenticationEdit.Checked    = _clientConfig.ProxyAutoAuthentication;
            ProxyUserNameEdit.Text             = _clientConfig.ProxyUserName;
            ProxyPasswordEdit.Text             = _clientConfig.ProxyPassword;
            ProxyDomainEdit.Text               = _clientConfig.ProxyDomain;
            ProxyAutoConfigurationEdit.Checked = _clientConfig.ProxyAutoConfiguration;
            ProxyAddressEdit.Text              = _clientConfig.ProxyAddress;
            ProxyPortEdit.Minimum              = IPEndPoint.MinPort;
            ProxyPortEdit.Maximum              = IPEndPoint.MaxPort;
            ProxyPortEdit.Value = _clientConfig.ProxyPort;

            var forwards = new BindingList <PortForward>();

            foreach (var forward in _clientConfig.Forwards.Values)
            {
                forwards.Add(forward);
            }

            BindingSource.DataSource = forwards;

            ConsoleLogEnabledEdit.Checked     = _clientConfig.ConsoleLogger.Enabled;
            ConsoleLogFilterEdit.DataSource   = Enum.GetValues(typeof(ESeverity));
            ConsoleLogFilterEdit.SelectedItem = _clientConfig.ConsoleLogger.Filter;
            ConsoleLogStringFormatEdit.Text   = _clientConfig.ConsoleLogger.StringFormat;
            ConsoleLogDateFormatEdit.Text     = _clientConfig.ConsoleLogger.DateFormat;
            FileLogEnabledEdit.Checked        = _clientConfig.FileLogger.Enabled;
            FileLogFilterEdit.DataSource      = Enum.GetValues(typeof(ESeverity));
            FileLogFilterEdit.SelectedItem    = _clientConfig.FileLogger.Filter;
            FileLogStringFormatEdit.Text      = _clientConfig.FileLogger.StringFormat;
            FileLogDateFormatEdit.Text        = _clientConfig.FileLogger.DateFormat;
            FileLogNameEdit.Text      = _clientConfig.FileLogger.Filename;
            FileLogAppendEdit.Checked = _clientConfig.FileLogger.Append;

            ProxyAuthenticationEdit_CheckedChanged(this, EventArgs.Empty);
            ProxyAutoConfigurationEdit_CheckedChanged(this, EventArgs.Empty);
        }
Example #55
0
 public Database()
 {
     Classes = new BindingList <string>();
     Samples = new BindingList <Sequence>();
 }
Example #56
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            string nameNote, tagsNote;

            _noteElmList   = new BindingList <NoteModels>();
            _tagElmList    = new BindingList <TagsModels>();
            _promptElmList = new BindingList <PromptModels>();

            using (NoteContext db = new NoteContext())
            {
                var noteElmList   = db.Notes.ToList();
                var tagElmList    = db.Tags.ToList();
                var promptElmList = db.Prompts.ToList();

                foreach (var note in noteElmList)
                {
                    if (note.NameNote == "")
                    {
                        nameNote = "(" + note.TextNote.Substring(0, Math.Min(note.TextNote.Length, 50)).Replace("\r\n", " ").Replace("\r", "") + ")";
                    }
                    else
                    {
                        nameNote = note.NameNote;
                    }

                    if (note.TagsNote == "")
                    {
                        tagsNote = "не задано";
                    }
                    else
                    {
                        tagsNote = note.TagsNote;
                    }

                    _noteElmList.Add(new NoteModels()
                    {
                        ID = note.ID, CreationDate = note.CreationDate, NameNote = nameNote, TextNote = note.TextNote, TagsNote = tagsNote
                    });
                }

                foreach (var tag in tagElmList)
                {
                    _tagElmList.Add(new TagsModels()
                    {
                        ID = tag.ID, NameTags = tag.NameTags
                    });
                }

                foreach (var prompt in promptElmList)
                {
                    if (prompt.ExpirationDate >= DateTime.Now.AddDays(-1))
                    {
                        _promptElmList.Add(new PromptModels {
                            ID = prompt.ID, CreationDate = prompt.CreationDate, ExpirationDate = prompt.ExpirationDate, Push = prompt.Push, TextPrompt = prompt.TextPrompt, TagsPrompt = prompt.TagsPrompt
                        });
                    }
                }
            }

            dgNotes.ItemsSource   = _noteElmList;
            dgTags.ItemsSource    = _tagElmList;
            dgPrompts.ItemsSource = _promptElmList;

            Home.SelectedIndex = Index;
        }
        public void Set(ro_SolicitudVacaciones_Info info)
        {
            try
            {
                Info_General = info;
                ucGe_Beneficiario.set_Persona_beneficiario_Info(Cl_Enumeradores.eTipoPersona.EMPLEA, info.IdEmpleado);
                if (info.Fecha_Desde.Year == 1)
                {
                    dtpFechaSalida.Value = DateTime.Now;
                }
                else
                {
                    dtpFechaSalida.Value = info.Fecha_Desde;
                }
                if (info.Fecha_Hasta.Year == 1)
                {
                    dtpFechaSalida.Value = DateTime.Now;
                }
                else
                {
                    dtpFechaHasta.Value = info.Fecha_Hasta;
                }
                if (info.Fecha_Retorno.Year == 1)
                {
                    dtpFechaSalida.Value = DateTime.Now;
                }
                else
                {
                    dtpFechaRetorno.Value = info.Fecha_Retorno;
                }
                dtp_anio_hasta.Value = info.Anio_Hasta;
                dtpanio_desde.Value  = info.Anio_Desde;
                txtdias.EditValue    = info.Dias_a_disfrutar;


                IESS = ((Sueldo_Actual / 30) * (Convert.ToInt32(txtdias.EditValue)) * 9.45) / 100;
                txtiess.EditValue = IESS;
                Sueldo_Actual     = bus_empleado.GetSueldoActual(info.IdEmpresa, info.IdEmpleado);
                DateTime fechaDesde = info.Anio_Desde;

                detalle = new BindingList <ro_Historico_Liquidacion_Vacaciones_Det_Info>(bus_detalle.Get_Lis(info.IdEmpresa, Convert.ToInt32(info.IdEmpleado), info.IdSolicitudVaca));
                gridControl_Detalle.DataSource = detalle;

                txttotal_remuneracion.EditValue = detalle.Sum(v => v.Total_Remuneracion);

                txttotal_vacaciones.EditValue = detalle.Sum(v => v.Total_Vacaciones);
                txttotal_cancelar.EditValue   = detalle.Sum(v => v.Valor_Cancelar);
                txttotal_cancelar.EditValue   = Convert.ToDouble(txttotal_cancelar.EditValue) - IESS;
                if (detalle.Count() == 0)
                {
                    while (fechaDesde <= info.Anio_Hasta)
                    {
                        var info_valores = bus_detalle.get_info(param.IdEmpresa, info.IdEmpleado, fechaDesde.Year, fechaDesde.Month);
                        ro_Historico_Liquidacion_Vacaciones_Det_Info infod = new ro_Historico_Liquidacion_Vacaciones_Det_Info();
                        infod.IdEmpresa              = param.IdEmpresa;
                        infod.IdEmpleado             = Convert.ToInt32(info.IdEmpleado);
                        infod.IdSolicitud_Vacaciones = info.IdSolicitudVaca;
                        infod.Anio         = fechaDesde.Year;
                        infod.Mes          = fechaDesde.Month;
                        infod.IdNominatipo = info.IdNomina_Tipo;
                        fechaDesde         = fechaDesde.AddMonths(1);

                        if (info_valores != null)
                        {
                            infod.Total_Remuneracion = info_valores.Total_Remuneracion;
                            infod.Total_Vacaciones   = info_valores.Total_Vacaciones;
                            infod.Valor_Cancelar     = info_valores.Total_Vacaciones / 15 * info.Dias_a_disfrutar;
                        }
                        detalle.Add(infod);
                    }
                }
                gridControl_Detalle.DataSource = detalle;
                ObtenerValor();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Example #58
0
        public GridBandedColumnConfigForm(BindingList <ABCGridBandedColumn.ColumnConfig> listCol, BindingList <ABCGridBand.BandConfig> listBands)
        {
            InitializeComponent();
            this.Load        += new EventHandler(Form_Load);
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            InitBands(listCol, listBands);
        }
Example #59
0
 public ClientesBL()
 {
     ListadeClientes = new BindingList <Cliente>();
     CrearDatosdePrueba();
 }
Example #60
0
        public void BuyTiket()
        {
            if (_dataGrid.SelectedIndex != -1)
            {
                BindingList <TicketsModel> t = new BindingList <TicketsModel>();
                foreach (var x in allFlights)
                {
                    t.Add(x);
                }
                int i = _dataGrid.SelectedIndex;

                if (Name == null || SurName == null || Document == null)
                {
                    MessageBox.Show("Заполните все поля формы");
                }
                else
                {
                    int number = TicketIsValid(Name, SurName, Document, allFlights[i].IdFlight);
                    if (allFlights[i].count_of_seats != 0)
                    {
                        switch (number)
                        {
                        case 0:
                        {
                            SqlCommand sqlCommand = new SqlCommand();
                            sqlCommand.CommandText = $"insert into tickets values({IdUser},{allFlights[i].IdFlight}, @SurName, @Name, @Document,'{price}')";
                            sqlCommand.Connection  = DBConnection.DBConnection.SqlConnection;

                            SqlParameter surNameParam = new SqlParameter("@SurName", SurName);
                            sqlCommand.Parameters.Add(surNameParam);

                            SqlParameter nameParam = new SqlParameter("@Name", Name);
                            sqlCommand.Parameters.Add(nameParam);

                            SqlParameter documentParam = new SqlParameter("@Document", Document);
                            sqlCommand.Parameters.Add(documentParam);

                            sqlCommand.ExecuteNonQuery();

                            sqlCommand.CommandText = $"insert into history values('{IdUser}','{allFlights[i].IdFlight}', @townFrom, @townTo,'{allFlights[i].DATE_FROM}')";
                            sqlCommand.Connection  = DBConnection.DBConnection.SqlConnection;

                            SqlParameter townFromParam = new SqlParameter("@townFrom", allFlights[i].townFrom);
                            sqlCommand.Parameters.Add(townFromParam);

                            SqlParameter townToParam = new SqlParameter("@townTo", allFlights[i].townTo);
                            sqlCommand.Parameters.Add(townToParam);

                            sqlCommand.ExecuteNonQuery();

                            sqlCommand.CommandText = @"select flights.id_flight, date_from, date_to,s1.town[от куда], s2.town[куда],company_name ,count_of_seats-count_of_customers, class, case class when 'Бизнес' 
                                then cast(route.length_of_route*company.cost_of_1km + company.cost_of_business as int) else cast(route.length_of_route*company.cost_of_1km + company.cost_of_econom as int)
                                end Стоимость from   flights inner join route on flights.route = route.id_route inner join airport s1  on s1.nameAirport = route.id_airport_from  inner join  airport s2 on s2.nameAirport = route.id_airport_to
                                inner join company on flights.company = company.company_name  inner join  aircrafts on flights.aircraft = aircrafts.name_aircraft";
                            sqlCommand.Connection  = DBConnection.DBConnection.SqlConnection;
                            SqlDataReader reader = sqlCommand.ExecuteReader();
                            foreach (var y in reader)
                            {
                                if (reader.GetInt32(0) == allFlights[i].IdFlight)
                                {
                                    if (reader.GetInt32(6) == 0)
                                    {
                                        MessageBox.Show("Нет свободных мест");
                                    }
                                    else
                                    {
                                        int userPrice = reader.GetInt32(8);
                                        reader.Close();
                                        sqlCommand.CommandText = $"update flights set count_of_customers  = count_of_customers  + 1 where {allFlights[i].IdFlight} = flights.id_flight ";

                                        sqlCommand.Connection = DBConnection.DBConnection.SqlConnection;
                                        sqlCommand.ExecuteNonQuery();
                                        sqlCommand.CommandText = $"update tickets set price = {userPrice} where {allFlights[i].IdFlight}=tickets.id_flight ";
                                        sqlCommand.Connection  = DBConnection.DBConnection.SqlConnection;
                                        sqlCommand.ExecuteNonQuery();
                                    }
                                    break;
                                }
                            }
                            reader.Close();
                            ShowAllFlights(_dataGrid);
                            MessageBox.Show("Билет успено куплен, ждем вас в тур агенстве");
                            break;
                        }

                        case 1:
                        {
                            MessageBox.Show("Билет для данного человека забронирован");
                            break;
                        }

                        case 2:
                        {
                            MessageBox.Show("Вы указали не свой номер паспорта");
                            break;
                        }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Нет мест на данный рейс");
                    }
                }
            }
            else
            {
                MessageBox.Show("Выберите рейс для покупки билета");
            }
        }