protected override IEnumerableValueProvider GetEnumerableValueProvider( BindingSource bindingSource, Dictionary<string, StringValues> values, CultureInfo culture) { return new JQueryFormValueProvider(bindingSource, values, culture); }
public SnakeCaseQueryValueProvider( BindingSource bindingSource, IReadableStringCollection values, CultureInfo culture) : base(bindingSource, values, culture) { }
/// <summary> /// Adds a default binding for the action. This will also add it to the regular bindings. /// </summary> /// <param name="binding">The BindingSource to add.</param> public void AddDefaultBinding( BindingSource binding ) { if (binding == null) { return; } if (binding.BoundTo != null) { throw new InControlException( "Binding source is already bound to action " + binding.BoundTo.Name ); } if (!defaultBindings.Contains( binding )) { defaultBindings.Add( binding ); binding.BoundTo = this; } if (!regularBindings.Contains( binding )) { regularBindings.Add( binding ); binding.BoundTo = this; if (binding.IsValid) { visibleBindings.Add( binding ); } } }
private static List<BindingSourceNode> GetChildBindingSources( IContainer container, BindingSource parent, BindingSourceNode parentNode) { List<BindingSourceNode> children = new List<BindingSourceNode>(); #if !WEBGUI foreach (System.ComponentModel.Component component in container.Components) #else foreach (IComponent component in container.Components) #endif { if (component is BindingSource) { BindingSource temp = component as BindingSource; if (temp.DataSource != null && temp.DataSource.Equals(parent)) { BindingSourceNode childNode = new BindingSourceNode(temp); children.Add(childNode); childNode.Children.AddRange(GetChildBindingSources(container, temp, childNode)); childNode.Parent = parentNode; } } } return children; }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); labelError.ModifyFg (StateType.Normal, new Gdk.Color(255, 0, 0)); gridview.AutoGenerateColumns = false; gridview.Columns.Add (new GridViewColumn () { DataPropertyName = "ProductID", HeaderText = "ID" }); gridview.Columns.Add (new GridViewColumn () { DataPropertyName = "ProductName", HeaderText = "Name", Width = 160 }); var colPrice = new GridViewColumn () { DataPropertyName = "Price", HeaderText = "Price", Width = 60}; colPrice.DefaultCellStyle.Format = "C2"; gridview.Columns.Add (colPrice); gridview.Columns.Add (new GridViewColumn () { DataPropertyName = "Favourite", HeaderText = "Favourite"}); products = new LinqNotifiedBindingList<Product>() {}; bsrcProducts = new BindingSource (){DataSource = products}; gridview.DataSource = bsrcProducts; entryID.DataBindings.Add (new Binding ("Text", bsrcProducts, "ProductID", true, DataSourceUpdateMode.OnPropertyChanged)); entryName.DataBindings.Add (new Binding ("Text", bsrcProducts, "ProductName", true, DataSourceUpdateMode.OnPropertyChanged)); spinPrice.DataBindings.Add (new Binding ("Value", bsrcProducts, "Price", true, DataSourceUpdateMode.OnPropertyChanged)); checkFavourite.DataBindings.Add (new Binding ("Active", bsrcProducts, "Favourite", true, DataSourceUpdateMode.OnPropertyChanged)); gridview.HeadersClickable = true; }
/// <summary> /// Creates a new <see cref="BindingSourceValueProvider"/>. /// </summary> /// <param name="bindingSource"> /// The <see cref="ModelBinding.BindingSource"/>. Must be a single-source (non-composite) with /// <see cref="ModelBinding.BindingSource.IsGreedy"/> equal to <c>false</c>. /// </param> public BindingSourceValueProvider(BindingSource bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (bindingSource.IsGreedy) { var message = Resources.FormatBindingSource_CannotBeGreedy( bindingSource.DisplayName, nameof(BindingSourceValueProvider)); throw new ArgumentException(message, nameof(bindingSource)); } if (bindingSource is CompositeBindingSource) { var message = Resources.FormatBindingSource_CannotBeComposite( bindingSource.DisplayName, nameof(BindingSourceValueProvider)); throw new ArgumentException(message, nameof(bindingSource)); } BindingSource = bindingSource; }
protected override IEnumerableValueProvider GetEnumerableValueProvider( BindingSource bindingSource, IDictionary<string, string[]> values, CultureInfo culture) { var backingStore = new ReadableStringCollection(values); return new ReadableStringCollectionValueProvider(bindingSource, backingStore, culture); }
protected override IEnumerableValueProvider GetEnumerableValueProvider( BindingSource bindingSource, Dictionary<string, StringValues> values, CultureInfo culture) { var backingStore = new QueryCollection(values); return new QueryStringValueProvider(bindingSource, backingStore, culture); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); BindingContext = new BindingContext (); label.DataBindings.Add ("Text", entry, "Text"); Binding binding = new Binding ("Text", check, "Active"); binding.Format += delegate(object sender, ConvertEventArgs e) { bool val = (bool)e.Value; e.Value = val ? "Enabled" : "Disabled"; }; checkLabel.DataBindings.Add (binding); Company company = new Company (); company.CompanyName = "Acme"; BindingSource bsrc = new BindingSource (); var companies = new NotifiedBindingList<Company> { company }; bsrc.DataSource = companies; Binding binding2 = new Binding ("Text", bsrc, "CompanyName"); binding2.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; notifyEntry.DataBindings.Add (binding2); notifyEntry.BackgroundColor = GdkColors.Gold; Binding binding3 = new Binding ("Text", bsrc, "CompanyName"); binding3.ControlUpdateMode = ControlUpdateMode.OnPropertyChanged; notifyLabel.DataBindings.Add (binding3); Binding binding4 = new Binding ("Text", spin, "Value"); Binding binding5 = new Binding ("Text", spin, "Value"); spinLabel.DataBindings.Add (binding4); spinEntry.DataBindings.Add (binding5); Switch switch1 = new Switch (); var bindingOn = new BooleanBinding<SwitchStatus> ("Checked", switch1, "Status", SwitchStatus.On); radioOn.DataBindings.Add (bindingOn); var bindingOff = new BooleanBinding<SwitchStatus> ("Checked", switch1, "Status", SwitchStatus.Off); radioOff.DataBindings.Add (bindingOff); labelStatus.DataBindings.Add ("Text", switch1, "Status"); Company company2 = new Company (); labelTextView.DataBindings.Add ("Text", company2, "CompanyName"); textView.DataBindings.Add ("Text", company2, "CompanyName", false, DataSourceUpdateMode.OnPropertyChanged); labelStreet.DataBindings.Add ("Text", company2.Adress, "Street"); entryAdressStreet.DataBindings.Add ("Text", company2, "Adress.Street", false, DataSourceUpdateMode.OnPropertyChanged); }
/// <inheritdoc /> public virtual IValueProvider Filter(BindingSource bindingSource) { if (bindingSource.CanAcceptDataFrom(BindingSource)) { return this; } else { return null; } }
public ModelValidationContext( BindingSource bindingSource, [NotNull] IModelValidatorProvider validatorProvider, [NotNull] ModelStateDictionary modelState, [NotNull] ModelExplorer modelExplorer) { ModelState = modelState; ValidatorProvider = validatorProvider; ModelExplorer = modelExplorer; BindingSource = bindingSource; }
public void TestArrowDemo() { Console.WriteLine("\t-- Testing arrow demo --\n"); Arrow<int, int>.func demo1 = x => x * x + 3; // Simple arrow test - 'test' is passed through the function 'demo1' to 'result' TestSourceObject source = new TestSourceObject(); source.value = 3; BindingDestination<int> result = new BindingDestination<int>(0); Arrow<int, int> testArrow = new Arrow<int, int>(demo1); ArrowTestThing.Binding<int, int> testBinding = new ArrowTestThing.Binding<int, int>(source, "value", testArrow, result); // Change the value of 'test' randomly and assert that 'result' changes accordingly Console.WriteLine("Testing single binding..."); Random random = new Random(); for (int i = 0; i < 500; i++) { source.value = random.Next(0, 1000); Assert.AreEqual(result, demo1(source.value)); } Console.WriteLine("Tests passed!"); Console.WriteLine(); Arrow<int, int>.func2 demo2 = (b, h) => (b * h) / 2; // Pair arrow test - 's1' and 's2' are treated as the breadth and height of a triangle, // and 'result' is now bound to the area of said triangle BindingSource<int> s1 = new BindingSource<int>(4); BindingSource<int> s2 = new BindingSource<int>(3); Arrow<int, int> dualArrow = new Arrow<int, int>(demo2); PairBinding<int, int> pairBinding = new PairBinding<int, int>(s1, s2, dualArrow, result); // Change the values of 's1' and 's2' randomly and assert that 'result' changes accordingly Console.WriteLine("Testing double binding..."); random = new Random(); for (int i = 0; i < 500; i++) { s1.Value = random.Next(0, 1000); s2.Value = random.Next(0, 1000); Assert.AreEqual(result, demo2(s1.Value, s2.Value)); } Console.WriteLine("Tests passed!"); Console.WriteLine(); Console.WriteLine("All tests passed successfully.\n\n"); }
protected override IEnumerableValueProvider GetEnumerableValueProvider( BindingSource bindingSource, Dictionary<string, StringValues> values, CultureInfo culture) { var emptyValueProvider = new JQueryFormValueProvider(bindingSource, new Dictionary<string, StringValues>(), culture); var valueProvider = new JQueryFormValueProvider(bindingSource, values, culture); return new CompositeValueProvider() { emptyValueProvider, valueProvider }; }
/// <summary> /// Sets up BindingSourceNode objects for all /// BindingSource objects related to the provided /// root source. /// </summary> /// <param name="container"> /// Container for the components. /// </param> /// <param name="rootSource"> /// Root BindingSource object. /// </param> /// <returns></returns> public static BindingSourceNode InitializeBindingSourceTree( IContainer container, BindingSource rootSource) { if (rootSource == null) throw new ApplicationException(Resources.BindingSourceNotProvided); _rootSourceNode = new BindingSourceNode(rootSource); _rootSourceNode.Children.AddRange(GetChildBindingSources(container, rootSource, _rootSourceNode)); return _rootSourceNode; }
public DataContextChangeSynchronizer(BindingSource bindingSource, BindingTarget bindingTarget, ITypeConverterProvider typeConverterProvider) { _bindingTarget = bindingTarget; Guard.ThrowIfNull(bindingTarget.Object, nameof(bindingTarget.Object)); Guard.ThrowIfNull(bindingTarget.Property, nameof(bindingTarget.Property)); Guard.ThrowIfNull(bindingSource.SourcePropertyPath, nameof(bindingSource.SourcePropertyPath)); Guard.ThrowIfNull(bindingSource.Source, nameof(bindingSource.Source)); Guard.ThrowIfNull(typeConverterProvider, nameof(typeConverterProvider)); _bindingEndpoint = new TargetBindingEndpoint(bindingTarget.Object, bindingTarget.Property); _sourceEndpoint = new ObservablePropertyBranch(bindingSource.Source, bindingSource.SourcePropertyPath); _targetPropertyTypeConverter = typeConverterProvider.GetTypeConverter(bindingTarget.Property.PropertyType); }
public void Create_WhenBindingSourceIsNotFromServices_ReturnsNull(BindingSource source) { // Arrange var provider = new ServicesModelBinderProvider(); var context = new TestModelBinderProviderContext(typeof(IPersonService)); context.BindingInfo.BindingSource = source; // Act var result = provider.GetBinder(context); // Assert Assert.Null(result); }
public override bool Equals( BindingSource other ) { if (other == null) { return false; } var bindingSource = other as KeyBindingSource; if (bindingSource != null) { return keyCombo == bindingSource.keyCombo; } return false; }
public override bool Equals( BindingSource other ) { if (other == null) { return false; } var bindingSource = other as MouseBindingSource; if (bindingSource != null) { return Control == bindingSource.Control; } return false; }
public ProductFilter(ref DataGridView dataGridView, string ExcludeColumns) { InitializeComponent(); _dataGridView = dataGridView; excludeColumns = ExcludeColumns; try { data = dataGridView.DataSource as BindingSource; } catch (Exception ex) { MessageBox.Show("Product Filter", "The datasource property of the containing DataGridView control " + "must be set to a BindingSource."); } }
/// <inheritdoc /> public virtual IValueProvider Filter(BindingSource bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (bindingSource.CanAcceptDataFrom(BindingSource)) { return this; } else { return null; } }
/// <summary> /// Creates a new <see cref="RouteValueProvider"/>. /// </summary> /// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param> /// <param name="values">The values.</param> public RouteValueProvider( BindingSource bindingSource, RouteValueDictionary values) : base(bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } _values = values; }
public MainForm () { components = new System.ComponentModel.Container (); bindingSource1 = new BindingSource (components); ((System.ComponentModel.ISupportInitialize) (bindingSource1)).BeginInit (); SuspendLayout (); // // MainForm // AutoScaleDimensions = new System.Drawing.SizeF (6F, 13F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new System.Drawing.Size (292, 266); Text = "bug #81148"; ((System.ComponentModel.ISupportInitialize) (bindingSource1)).EndInit (); Load += new EventHandler (MainForm_Load); ResumeLayout (false); }
/// <summary> /// Creates a new <see cref="DictionaryBasedValueProvider"/>. /// </summary> /// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param> /// <param name="values">The values.</param> public DictionaryBasedValueProvider( BindingSource bindingSource, IDictionary<string, object> values) : base(bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } _values = values; }
/// <summary> /// Creates a value provider for <see cref="IFormCollection"/>. /// </summary> /// <param name="bindingSource">The <see cref="BindingSource"/> for the data.</param> /// <param name="values">The key value pairs to wrap.</param> /// <param name="culture">The culture to return with ValueProviderResult instances.</param> public FormValueProvider( BindingSource bindingSource, IFormCollection values, CultureInfo culture) : base(bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } _values = values; _culture = culture; }
public void BindingSourceValueProvider_ThrowsOnNonGreedySource() { // Arrange var expected = "The provided binding source 'Test Source' is a greedy data source. " + "'BindingSourceValueProvider' does not support greedy data sources." + Environment.NewLine + "Parameter name: bindingSource"; var bindingSource = new BindingSource( "Test", displayName: "Test Source", isGreedy: true, isFromRequest: true); // Act & Assert var exception = Assert.Throws<ArgumentException>( () => new TestableBindingSourceValueProvider(bindingSource)); Assert.Equal(expected, exception.Message); }
/// <summary> /// Initializes a new instance of the <see cref="JQueryFormValueProvider"/> class. /// </summary> /// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param> /// <param name="values">The values.</param> /// <param name="culture">The culture to return with ValueProviderResult instances.</param> public JQueryFormValueProvider( BindingSource bindingSource, IDictionary<string, StringValues> values, CultureInfo culture) : base(bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } _values = values; Culture = culture; }
private void Btn_CountWord_Click(object sender, EventArgs e) { Lbl_Message.Text = string.Empty; if (!File.Exists(TxtFilePath.Text)) { Lbl_Message.Text = "The file does not exist"; Resources.Error_The_file_does_not_exist; } else { FileReader lReearder = new LineReaders(); IList<string> s = lReearder.ProcessFile(TxtFilePath.Text); LinqCounter counter = new LinqCounter(s.ToList()); List<WordCount> test = counter.CountWords(); BindingSource source = new BindingSource(); source.DataSource = test; //source.DataSource = test; DataGridViewTextBoxColumn wordColumn = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn countColumn = new DataGridViewTextBoxColumn(); dataGridView1.Columns.Add(wordColumn); dataGridView1.Columns.Add(countColumn); test = new List<WordCount> { new WordCount("gsgd",1), new WordCount("dsafd",2) }; dataGridView1.DataSource = source; void btn_openFile_Click(object sender, EventArgs e) { } } }
private void btn提交审核_Click(object sender, EventArgs e) { String n; if (!checkOuterData(out n)) { MessageBox.Show("请填写完整的信息: " + n, "提示"); return; } if (!checkInnerData(dataGridView1)) { MessageBox.Show("请填写完整的表单信息", "提示"); return; } // 判断,二维码中的数量应该和总量一致 if (!checkBeforeSave()) { return; } //写待审核表 DataTable dt_temp = new DataTable("待审核"); BindingSource bs_temp = new BindingSource(); SqlDataAdapter da_temp = new SqlDataAdapter(@"select * from 待审核 where 表名='入库单' and 对应ID=" + (int)dtOuter.Rows[0]["ID"], mySystem.Parameter.conn); SqlCommandBuilder cb_temp = new SqlCommandBuilder(da_temp); da_temp.Fill(dt_temp); if (dt_temp.Rows.Count == 0) { DataRow dr = dt_temp.NewRow(); dr["表名"] = "入库单"; dr["对应ID"] = (int)dtOuter.Rows[0]["ID"]; dt_temp.Rows.Add(dr); } bsOuter.DataSource = dtOuter; bs_temp.DataSource = dt_temp; da_temp.Update((DataTable)bs_temp.DataSource); //dtOuter.Rows[0]["状态"] = "待审核"; //写日志 //格式: // ================================================= // yyyy年MM月dd日,操作员:XXX 提交审核 //string log = "\n=====================================\n"; //log += DateTime.Now.ToString("yyyy年MM月dd日 hh时mm分ss秒") + "\n操作员:" + mySystem.Parameter.userName + " 提交审核\n"; //dtOuter.Rows[0]["日志"] = dtOuter.Rows[0]["日志"].ToString() + log; dtOuter.Rows[0]["审核员"] = "__待审核"; dtOuter.Rows[0]["审核日期"] = DateTime.Now; save(); //空间都不能点 setControlFalse(); }
/// <summary> /// Branchement de la base avec le formulaire actuel /// </summary> /// <param name="groupesService">l'objet Service</param> /// <param name="groupeDataGridView">DataGrid de l'objet </param> /// <param name="groupeBindingSource">Binding source</param> protected void InitBaseForm(IBaseRepository groupesService, DataGridView groupeDataGridView, BindingSource groupeBindingSource) { this.Service = groupesService; this.ObjetBindingSource = groupeBindingSource; this.ObjetBindingNavigator.BindingSource = this.ObjetBindingSource; groupeBindingSource.DataSource = this.Service.ToBindingList(); groupeDataGridView.CellEndEdit += GroupeDataGridView_CellEndEdit; }
private void Init() { var skins = new Dictionary <string, string> { ["默认皮肤"] = "" }; skins = Utils.GetMatchedFiles(SKINS_PATH, "*.ssk", skins); var skinSet = new BindingSource { DataSource = skins }; skinSetBox.DataSource = skinSet; skinSetBox.DisplayMember = "Key"; skinSetBox.ValueMember = "Value"; _autoSizeFormControlUtil = new AutoSizeFormControlUtil(this); _autoSizeFormControlUtil.RefreshControlsInfo(Controls[0]); FormBorderStyle = FormBorderStyle.FixedDialog; instance = this; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; if (!Utils.IsUnixPlatform()) { foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) { var registry = asm.GetType("Microsoft.Win32.Registry"); if (registry == null) { continue; } var getValue = registry.GetMethod("GetValue", new[] { typeof(string), typeof(string), typeof(object) }); if (getValue != null) { var exePath = getValue.Invoke(null, new object[] { REG_PATH, "ExePath", string.Empty }) as string; if (string.IsNullOrEmpty(exePath) || !File.Exists(exePath)) { var setValue = registry.GetMethod("SetValue", new[] { typeof(string), typeof(string), typeof(object) }); if (setValue != null) { setValue.Invoke(null, new object[] { REG_PATH, "ExePath", Path.Combine(Application.StartupPath, "DearUnityModManager.exe") }); setValue.Invoke(null, new object[] { REG_PATH, "Path", Application.StartupPath }); } } } break; } } var rbWidth = 0; for (var i = (InstallType)0; i < InstallType.Count; i++) { var rb = new RadioButton { Name = i.ToString(), Text = i == InstallType.DoorstopProxy ? $"{i.ToString()}(推荐)" : i.ToString(), AutoSize = true, Location = new Point(rbWidth + 8, 50), Margin = new Padding(0) }; rb.Click += installType_Click; installTypeGroup.Controls.Add(rb); rbWidth += rb.Width + 200; } version = typeof(UnityModManager).Assembly.GetName().Version; currentVersion.Text = version.ToString(); config = Config.Load(); param = Param.Load(); skinSetBox.SelectedIndex = param.LastSelectedSkin; if (config?.GameInfo != null && config.GameInfo.Length > 0) { config.GameInfo = config.GameInfo.OrderBy(x => x.GameName).ToArray(); gameList.Items.AddRange(config.GameInfo); GameInfo selected = null; if (!string.IsNullOrEmpty(param.LastSelectedGame)) { selected = config.GameInfo.FirstOrDefault(x => x.Name == param.LastSelectedGame); } selected = selected ?? config.GameInfo.First(); gameList.SelectedItem = selected; selectedGameParams = param.GetGameParam(selected); } else { InactiveForm(); Log.Print($"解析配置文件“{Config.filename}”失败!"); return; } CheckLastVersion(); }
private void order_id_button_Click(object sender, EventArgs e) { string ids = ""; checked_order_id = 0; string sortby = order_sort_box.SelectedItem.ToString(); try { ids = order_id_textbox.Text.ToString(); if (ids.Length == 0) { throw new WarningException("Не введен ID!"); } checked_order_id = Int16.Parse(ids); //поищем данный order_id в базе данных SqlCommand sqlC = new SqlCommand("Select * FROM ClientOrder Where OrderID = " + ids, cnn); if (sqlC.ExecuteScalar().ToString() != ids) { MessageBox.Show("Такого ID не существует!"); order_info_list.Rows.Clear(); order_info_list.Columns.Clear(); checked_order_id = 0; return; } //проверим, что данный номер заказа соответствует клиенту if (is_client) { SqlCommand sq = new SqlCommand("Select ClientID FROM Clients_Orders_all Where OrderID = " + ids, cnn); if (sq.ExecuteScalar().ToString() != user_id.ToString()) { MessageBox.Show("Данный номер заказа не принадлежит Вам!", "Ошибка!"); order_info_list.Rows.Clear(); order_info_list.Columns.Clear(); checked_order_id = 0; return; } } string search = new SqlCommand("Select Status FROM ClientOrder Where OrderID = " + ids, cnn).ExecuteScalar().ToString(); if (search == "Ready" || search == "Sold") { order_cancelled_button.Enabled = false; if (search == "Sold") { upd_order_button.Enabled = false; } else { upd_order_button.Enabled = true; } } else { upd_order_button.Enabled = true; order_cancelled_button.Enabled = true; } //если найден - показать инфо BindingSource bs = new BindingSource(); string command = "Execute Check_Order " + ids + ", " + sortby; SqlCommand cmd = SqlExec(command); ViewQuery(cmd, order_info_list, bs); close_order_button.Enabled = true; // order_id_button.Enabled = false; order_id_textbox.Enabled = false; } catch (WarningException ee) { MessageBox.Show(ee.Message, "Ошибка"); checked_order_id = 0; } catch (FormatException ee) { MessageBox.Show("Некорректный ID!", "Ошибка"); checked_order_id = 0; } catch (NullReferenceException ee) { MessageBox.Show("Такого ID не существует!", "Ошибка"); checked_order_id = 0; } }
private void BindPath() { mBind = new BindingSource(mPath, "Steps"); dataGridView1.DataSource = mBind; }
public void GetApiDescription_ParameterDescription_IncludesRouteInfo( string template, string methodName, string source) { // Arrange var action = CreateActionDescriptor(methodName); action.AttributeRouteInfo = new AttributeRouteInfo { Template = template }; var expected = new BindingSource(source, displayName: null, isGreedy: false, isFromRequest: false); // Act var descriptions = GetApiDescriptions(action); // Assert var description = Assert.Single(descriptions); var parameters = description.ParameterDescriptions; var id = Assert.Single(parameters, p => p.Source == expected); Assert.NotNull(id.RouteInfo); }
public Gestion() { _lCodAlterno = new List <OOB.LibInventario.Producto.Data.CodAlterno>(); _bsCodAlterno = new BindingSource(); _bsCodAlterno.DataSource = _lCodAlterno; }
private void Agregar_Load(object sender, EventArgs e) { L_NUMERO.Text = ""; TB_DOCUMENTO.Select(); L_DIF_DEBE.Text = ""; L_DIF_HABER.Text = ""; // DGV.CellLeave += DGV_CellLeave; DGV.CellValidating += DGV_CellValidating; DGV.CellEndEdit += DGV_CellEndEdit; DGV.CellEnter += DGV_CellEnter; DGV.CellBeginEdit += DGV_CellBeginEdit; DGV.CellPainting += DGV_CellPainting; DGV.CellValueChanged += DGV_CellValueChanged; DGV.RowValidating += DGV_RowValidating; DGV.KeyDown += DGV_KeyDown; DGV.ColumnHeaderMouseDoubleClick += DGV_ColumnHeaderMouseDoubleClick; DGV.AutoGenerateColumns = false; DGV.AllowUserToAddRows = false; DGV.AllowUserToDeleteRows = false; DGV.ReadOnly = false; var f2 = new Font("Serif", 10, FontStyle.Bold); var c1 = new DataGridViewTextBoxColumn(); c1.DataPropertyName = "Codigo"; c1.HeaderText = "Código"; c1.Name = "codigo"; c1.Visible = true; c1.ReadOnly = false; c1.Width = 140; c1.DefaultCellStyle.Font = f2; var c2 = new DataGridViewTextBoxColumn(); c2.DataPropertyName = "Descripcion"; c2.HeaderText = "Descripción"; c2.Name = "descripcion"; c2.Visible = true; c2.ReadOnly = false; c2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; var c3 = new DataGridViewTextBoxColumn(); c3.DefaultCellStyle.BackColor = Color.Blue; c3.DataPropertyName = "Debe"; c3.HeaderText = "Debe"; c3.Name = "debe"; c3.Visible = true; c3.Width = 150; c3.ReadOnly = false; c3.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; c3.DefaultCellStyle.ForeColor = Color.White; c3.DefaultCellStyle.Font = f2; c3.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; c3.DefaultCellStyle.Format = "n2"; var c4 = new DataGridViewTextBoxColumn(); c4.DefaultCellStyle.BackColor = Color.Red; c4.DataPropertyName = "Haber"; c4.HeaderText = "Haber"; c4.Name = "haber"; c4.Visible = true; c4.Width = 150; c4.ReadOnly = false; c4.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; c4.DefaultCellStyle.ForeColor = Color.White; c4.DefaultCellStyle.Font = f2; c4.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; c4.DefaultCellStyle.Format = "n2"; DGV.Columns.Add(c1); DGV.Columns.Add(c2); DGV.Columns.Add(c3); DGV.Columns.Add(c4); bs = new BindingSource(); items = new BindingList <Detalle>(); items.ListChanged += items_ListChanged; bs.DataSource = items; DGV.DataSource = bs; // CB_DOCUMENTO.ValueMember = "Id"; CB_DOCUMENTO.DisplayMember = "Descripcion"; bs.DataSource = items; DGV.DataSource = bs; if (ModoFicha == Modo.AgregarFicha) { CargarData(); CB_TIPO.SelectedIndex = 0; var it = new Detalle(); items.Add(it); } else if (ModoFicha == Modo.EditarFicha) { L_MODO_FICHA.Visible = true; CargarDataAsiento(IdAsientoEditarExportar); } else { CargarDataExportar(IdAsientoEditarExportar); } }
//----------------------------------------------------------------------------------- // Load the Form Data //----------------------------------------------------------------------------------- public bool LoadFormData() { string queryString = ""; OleDbCommand command; OleDbDataReader reader; OleDbConnection connection = new OleDbConnection(_connectionstring); if (connection != null) { connection.Open(); try { queryString = "SELECT Soil_Corrosion_Probes.Corrosion_Probe_ID, Soil_Corrosion_Probes.Boring_Location_ID, Soil_Corrosion_Probes.Depth, " + "Soil_Corrosion_Probes.Serial_No, Soil_Corrosion_Probes.Make, Soil_Corrosion_Probes.Model, Soil_Corrosion_Probes.Installation_Method, " + "Soil_Corrosion_Probes.ER_Coupon_Material, Soil_Corrosion_Probes.dbDate_Installed, Soil_Corrosion_Probes.Divisions_Baseline, " + "Soil_Corrosion_Probes.Probe_Check_Baseline, Soil_Corrosion_Probes.Weather_Conditions " + "FROM Soil_Corrosion_Probes " + "WHERE (((Soil_Corrosion_Probes.Corrosion_Probe_ID)=\"" + _corrosion_probe_id + "\"));"; command = new OleDbCommand(queryString, connection); reader = command.ExecuteReader(); if (reader.Read()) { // Fill in controls from the on General Page tbCPID.Text = GetFieldDataStr("Corrosion_Probe_ID", ref reader); tbBEID.Text = GetFieldDataStr("Boring_Location_ID", ref reader); tbZ.Text = GetFieldDataStr("Depth", ref reader); tbMake.Text = GetFieldDataStr("Make", ref reader); tbCouponMatl.Text = GetFieldDataStr("ER_Coupon_Material", ref reader); tbDivBaseline.Text = GetFieldDataStr("Divisions_Baseline", ref reader); tbInstallationMethod.Text = GetFieldDataStr("Installation_Method", ref reader); tbSN.Text = GetFieldDataStr("Serial_No", ref reader); tbModel.Text = GetFieldDataStr("Model", ref reader); tbDateInstalled.Text = GetFieldDataStr("dbDate_Installed", ref reader); tbProbeCheckBaseline.Text = GetFieldDataStr("Probe_Check_Baseline", ref reader); tbWeatherConditions.Text = GetFieldDataStr("Weather_Conditions", ref reader); } reader.Close(); } catch (Exception ex) { connection.Close(); return(false); } try { //............... // Corrosion Rate Samples Grid //............... queryString = "SELECT [Dbf CorrosionRateSamples].Corrosion_Probe_ID, [Dbf CorrosionRateSamples].[DateStamp] FROM [Dbf CorrosionRateSamples] " + "INNER JOIN Soil_Corrosion_Probes ON [Dbf CorrosionRateSamples].Corrosion_Probe_ID = Soil_Corrosion_Probes.Corrosion_Probe_ID " + "WHERE (([Dbf CorrosionRateSamples].Corrosion_Probe_ID)=\"" + _corrosion_probe_id + "\");"; OleDbDataAdapter dAdapter = new OleDbDataAdapter(queryString, _connectionstring); DataTable dTable = new DataTable(); //fill the DataTable dAdapter.Fill(dTable); DataGridView dgView = new DataGridView(); BindingSource bSource = new BindingSource(); bSource.DataSource = dTable; gridCRSamples.DataSource = bSource; gridCRSamples.Columns["Corrosion_Probe_ID"].Visible = false; } catch (Exception ex) { } } // if connection!=null // DONE return(true); }
private void Form1_Load(object sender, EventArgs e) { _scenarioFile = Application.StartupPath + @"\scenario.json"; _scenario = new Scenario(); _bindingSource = new BindingSource(); btnExport.Enabled = false; // check for a scenario file if (!File.Exists(_scenarioFile)) { // if no scenario file, then attempt to create one with default floors _scenario.Floors = Defaults.Floors(); try { using (var ms = new MemoryStream()) { using (var sw = new StreamWriter(_scenarioFile)) { var serializer = new DataContractJsonSerializer(_scenario.Floors.GetType()); serializer.WriteObject(ms, _scenario.Floors); sw.Write(Encoding.ASCII.GetString(ms.ToArray())); } } } catch (Exception ex) { MessageBox.Show("Could not save scenario file." + Environment.NewLine + Environment.NewLine + "Error: " + ex.HResult + " - " + ex.Message, "Scenario File Issue", MessageBoxButtons.OK); } } else { // a scenario file exists, so attempt to load it using (var sr = new StreamReader(_scenarioFile)) { using (var ms = sr.BaseStream) { var serializer = new DataContractJsonSerializer(_scenario.Floors.GetType()); _scenario.Floors = serializer.ReadObject(ms) as List <Floor>; if (_scenario is null) { MessageBox.Show("Could not load scenario file.", "Scenario File Issue", MessageBoxButtons.OK); _scenario.Floors = Defaults.Floors(); } } } } // use data grid to show floors dgvScenario.AutoGenerateColumns = false; dgvScenario.AllowUserToAddRows = false; dgvScenario.AllowUserToDeleteRows = false; dgvScenario.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False; dgvScenario.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "EmployeesAssigned", Name = "Employees" }); dgvScenario.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "OfficeRooms", Name = "Offices" }); dgvScenario.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Breakrooms", Name = "Breakrooms" }); dgvScenario.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "MeetingRooms", Name = "Meeting Rooms" }); _scenario.Floors.ForEach(floor => _bindingSource.Add(floor)); dgvScenario.DataSource = _bindingSource; dgvScenario.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); // infection starting floor numGroundZero.Maximum = _bindingSource.Count; if (numGroundZero.Maximum > 0) { numGroundZero.Value = 1; } numGroundZero.Minimum = 1; // save file dialog settings saveFileDialog1.Filter = "Comma Separated File|CSV"; saveFileDialog1.FileName = "output.csv"; saveFileDialog1.Title = "Save Logs"; saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveFileDialog1.OverwritePrompt = true; // date picker defaults dtStart.Value = DateTime.Today; dtEnd.Value = DateTime.Today.AddMonths(4); }
public void PrintTable(BindingSource bs) { Items.Add(new PrintItems(PrintItems.ItemTypes.Table, bs)); }
public VInputchange(string lbheader, string lbsub, LinqtoSQLDataContext db, string tblnamemain, string tblnamesub, System.Type Typeofftable, String IDmain, String IDsub) { InitializeComponent(); // #region right setup this.lbseachedit.Visible = false; this.Bt_uploadbegin.Visible = false; string enduser = Utils.getusername(); this.bnt_adddataselected.Visible = false; this.Bt_Adddata.Visible = true; if (lbheader == "") { // this.p this.mainpanel.Hide(); this.Bt_Adddata.Hide(); this.splitContainer1.Panel2Collapsed = true; } if (lbsub == "LIST MASTER DATA CUSTOMER ") { this.lbseachedit.Visible = true; } this.db = db; this.tblnamemain = tblnamemain; this.tblnamesub = tblnamesub; this.Typeofftable = Typeofftable; this.IDmain = IDmain; this.IDsub = IDsub; this.lb_headermain.Text = lbheader; this.lb_headersub.Text = lbsub; string slqtext = "select * from " + tblnamemain + " where " + tblnamemain + ".enduser ='******'"; var results3 = db.ExecuteQuery(Typeofftable, slqtext); source2 = new BindingSource(); source2.AllowNew = true; source2.DataSource = results3; this.dataGridView2.DataSource = source2; // view 2 la main view 1 detaik this.dataGridView2.AllowUserToAddRows = true; if (this.dataGridView2.Columns[IDmain] != null) { this.dataGridView2.Columns[IDmain].Visible = false; } slqtext = "select * from " + tblnamesub + " where " + tblnamesub + ".enduser ='******'"; if (lbsub == "USERNAME AND PASSWORD") { slqtext = "select * from " + tblnamesub;// + " where " + tblnamesub + ".enduser ='******'"; } var results2 = db.ExecuteQuery(Typeofftable, slqtext); source1 = new BindingSource(); source1.AllowNew = true; //if (results2 == null) //{ // source1.AddNew(); //} source1.DataSource = results2; this.dataGridView1.DataSource = source1; this.dataGridView1.AutoGenerateColumns = true; if (this.dataGridView1.Columns[IDsub] != null) { this.dataGridView1.Columns[IDsub].Visible = false; } this.dataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; this.dataGridView2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //tblCustomer cct = new tblCustomer(); //cct.Customer = 90; }
private void button1_Click(object sender, EventArgs e) { //读取文件,获取返回值 ReturnValue rv = ReadFile.GetFilePath(); if (!rv.isbo) { MessageBox.Show(rv.msg); return; } //清空tab控件 tabControl1.Controls.Clear(); //获取所有文本 string[] lines = File.ReadAllLines(rv.msg, Encoding.UTF8); TabPage tabpage = null; TextBox textbox = null; string iptext = string.Empty; foreach (string line in lines) { if (line.Contains("#")) { //添加tab if (tabpage != null) { textbox = CreateTextBox(iptext); iptext = string.Empty; tabpage.Controls.Add(textbox); tabControl1.Controls.Add(tabpage); tabpage.ResumeLayout(false); tabpage.PerformLayout(); } //初始化 tabpage = CreateTabPage(line.Replace(" ", "").Replace("#", "")); continue; } iptext += line.Replace(" ", "") + "\r\n"; } if (tabpage != null) { textbox = CreateTextBox(iptext); tabpage.Controls.Add(textbox); tabControl1.Controls.Add(tabpage); tabControl1.ResumeLayout(false); tabpage.ResumeLayout(false); tabpage.PerformLayout(); } //绑定下拉列表 ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); Dictionary <string, string> map = new Dictionary <string, string>(); foreach (ManagementObject mo in moc) { if (mo["IPEnabled"].ToString() == "True") { map.Add(mo["MACAddress"].ToString(), mo["Description"].ToString()); } } BindingSource bs = new BindingSource(); bs.DataSource = map; comboBox1.DataSource = bs; comboBox1.DisplayMember = "Value"; comboBox1.ValueMember = "Key"; }
private void button1_Click(object sender, EventArgs e) { try { this.connetionString = "Data Source = whitesnow.database.windows.net; Initial Catalog = Mazal; Integrated Security = False; User ID = Grimm; Password = #!7Dwarfs; Connect Timeout = 15; Encrypt = False; TrustServerCertificate = True; ApplicationIntent = ReadWrite; MultiSubnetFailover = False; MultipleActiveResultSets=true"; this.sqlcon = new SqlConnection(connetionString); SqlCommand cmd = new SqlCommand("select * from Person where ID ='" + stud_id.Text + "' and Permission = 'Student'", sqlcon); if (!checkString(stud_id.Text, "ID") || !checkString(course_id.Text, "Course")) { this.Close(); MessageBox.Show("Try again, this is not a correct ID!"); modifay_grade form2 = new modifay_grade(); form2.Show(); } else { this.sqlcon.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() == true) { dr.Close(); cmd = new SqlCommand("select * from Teaching_Stuff where ID ='" + Utility.User.ID + "' and Course_id='" + course_id.Text + "'", sqlcon); dr = cmd.ExecuteReader(); if (dr.Read() == true) { if (Int32.Parse(stud_grade.Text) >= 0 && Int32.Parse(stud_grade.Text) <= 100) { dr.Close(); cmd = new SqlCommand("update Student_Courses set final_grade = '" + stud_grade.Text + "' where Course_id='" + course_id.Text + "' and stud_Id = '" + stud_id.Text + "' and Type = 1", sqlcon); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bsource = new BindingSource(); bsource.DataSource = dbdataset; sda.Update(dbdataset); MessageBox.Show("Changed grade succesfully!"); this.sqlcon.Close(); this.Close(); } else { throw new ArgumentException("Grade have to be 0-100! "); } } else { throw new ArgumentException("Try again, you do not teach such a course!"); } } else { throw new ArgumentException("Try again, there is not such student in our department!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); modifay_grade form2 = new modifay_grade(); form2.Show(); } this.sqlcon.Close(); this.Close(); }
//Ayuda para cargar los ComboBox public static void CargarCombo(ref ComboBox cb, BindingSource conector, string displayMember, string valueMember) { cb.DataSource = conector; cb.DisplayMember = displayMember; cb.ValueMember = valueMember; }
private void InitializeComponent() { this.components = new Container(); ResourceManager manager = new ResourceManager(typeof(OSVRSTAFormUserControl)); this.contextMenu1 = new ContextMenu(); this.SetNullItem = new MenuItem(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.errorProvider1 = new ErrorProvider(); this.errorProviderValidator1 = new ErrorProviderValidator(this.components); this.bindingSourceOSVRSTA = new BindingSource(this.components); ((ISupportInitialize)this.bindingSourceOSVRSTA).BeginInit(); this.layoutManagerformOSVRSTA = new TableLayoutPanel(); this.layoutManagerformOSVRSTA.SuspendLayout(); this.layoutManagerformOSVRSTA.AutoSize = true; this.layoutManagerformOSVRSTA.Dock = DockStyle.Fill; this.layoutManagerformOSVRSTA.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.layoutManagerformOSVRSTA.AutoScroll = false; System.Drawing.Point point = new System.Drawing.Point(0, 0); this.layoutManagerformOSVRSTA.Location = point; Size size = new System.Drawing.Size(0, 0); this.layoutManagerformOSVRSTA.Size = size; this.layoutManagerformOSVRSTA.ColumnCount = 2; this.layoutManagerformOSVRSTA.RowCount = 4; this.layoutManagerformOSVRSTA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.layoutManagerformOSVRSTA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.layoutManagerformOSVRSTA.RowStyles.Add(new RowStyle()); this.layoutManagerformOSVRSTA.RowStyles.Add(new RowStyle()); this.layoutManagerformOSVRSTA.RowStyles.Add(new RowStyle()); this.layoutManagerformOSVRSTA.RowStyles.Add(new RowStyle()); this.label1IDOSVRSTA = new UltraLabel(); this.textIDOSVRSTA = new UltraNumericEditor(); this.label1OPISOSVRSTA = new UltraLabel(); this.textOPISOSVRSTA = new UltraTextEditor(); this.label1OSV = new UltraLabel(); this.labelOSV = new UltraLabel(); ((ISupportInitialize)this.textIDOSVRSTA).BeginInit(); ((ISupportInitialize)this.textOPISOSVRSTA).BeginInit(); this.dsOSVRSTADataSet1 = new OSVRSTADataSet(); this.dsOSVRSTADataSet1.BeginInit(); this.SuspendLayout(); this.dsOSVRSTADataSet1.DataSetName = "dsOSVRSTA"; this.dsOSVRSTADataSet1.Locale = new CultureInfo("hr-HR"); this.bindingSourceOSVRSTA.DataSource = this.dsOSVRSTADataSet1; this.bindingSourceOSVRSTA.DataMember = "OSVRSTA"; ((ISupportInitialize)this.bindingSourceOSVRSTA).BeginInit(); point = new System.Drawing.Point(0, 0); this.label1IDOSVRSTA.Location = point; this.label1IDOSVRSTA.Name = "label1IDOSVRSTA"; this.label1IDOSVRSTA.TabIndex = 1; this.label1IDOSVRSTA.Tag = "labelIDOSVRSTA"; this.label1IDOSVRSTA.Text = "Šfr.:"; this.label1IDOSVRSTA.StyleSetName = "FieldUltraLabel"; this.label1IDOSVRSTA.AutoSize = true; this.label1IDOSVRSTA.Anchor = AnchorStyles.Left; this.label1IDOSVRSTA.Appearance.TextVAlign = VAlign.Middle; this.label1IDOSVRSTA.Appearance.Image = RuntimeHelpers.GetObjectValue(manager.GetObject("pictureBoxKey.Image")); this.label1IDOSVRSTA.Appearance.ImageHAlign = HAlign.Right; size = new System.Drawing.Size(7, 10); this.label1IDOSVRSTA.ImageSize = size; this.label1IDOSVRSTA.Appearance.ForeColor = Color.Black; this.label1IDOSVRSTA.BackColor = Color.Transparent; this.layoutManagerformOSVRSTA.Controls.Add(this.label1IDOSVRSTA, 0, 0); this.layoutManagerformOSVRSTA.SetColumnSpan(this.label1IDOSVRSTA, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.label1IDOSVRSTA, 1); Padding padding = new Padding(3, 1, 5, 2); this.label1IDOSVRSTA.Margin = padding; size = new System.Drawing.Size(0, 0); this.label1IDOSVRSTA.MinimumSize = size; size = new System.Drawing.Size(0x26, 0x17); this.label1IDOSVRSTA.Size = size; point = new System.Drawing.Point(0, 0); this.textIDOSVRSTA.Location = point; this.textIDOSVRSTA.Name = "textIDOSVRSTA"; this.textIDOSVRSTA.Tag = "IDOSVRSTA"; this.textIDOSVRSTA.TabIndex = 0; this.textIDOSVRSTA.Anchor = AnchorStyles.Left; this.textIDOSVRSTA.MouseEnter += new EventHandler(this.mouseEnter_Text); this.textIDOSVRSTA.ReadOnly = false; this.textIDOSVRSTA.PromptChar = ' '; this.textIDOSVRSTA.Enter += new EventHandler(this.numericEditor_Enter); this.textIDOSVRSTA.DataBindings.Add(new Binding("Value", this.bindingSourceOSVRSTA, "IDOSVRSTA")); this.textIDOSVRSTA.NumericType = NumericType.Integer; this.textIDOSVRSTA.MaskInput = "{LOC}-nnnnn"; this.layoutManagerformOSVRSTA.Controls.Add(this.textIDOSVRSTA, 1, 0); this.layoutManagerformOSVRSTA.SetColumnSpan(this.textIDOSVRSTA, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.textIDOSVRSTA, 1); padding = new Padding(0, 1, 3, 2); this.textIDOSVRSTA.Margin = padding; size = new System.Drawing.Size(0x33, 0x16); this.textIDOSVRSTA.MinimumSize = size; size = new System.Drawing.Size(0x33, 0x16); this.textIDOSVRSTA.Size = size; point = new System.Drawing.Point(0, 0); this.label1OPISOSVRSTA.Location = point; this.label1OPISOSVRSTA.Name = "label1OPISOSVRSTA"; this.label1OPISOSVRSTA.TabIndex = 1; this.label1OPISOSVRSTA.Tag = "labelOPISOSVRSTA"; this.label1OPISOSVRSTA.Text = "Vrsta sredstva (OS ili SI):"; this.label1OPISOSVRSTA.StyleSetName = "FieldUltraLabel"; this.label1OPISOSVRSTA.AutoSize = true; this.label1OPISOSVRSTA.Anchor = AnchorStyles.Left; this.label1OPISOSVRSTA.Appearance.TextVAlign = VAlign.Middle; this.label1OPISOSVRSTA.Appearance.ForeColor = Color.Black; this.label1OPISOSVRSTA.BackColor = Color.Transparent; this.layoutManagerformOSVRSTA.Controls.Add(this.label1OPISOSVRSTA, 0, 1); this.layoutManagerformOSVRSTA.SetColumnSpan(this.label1OPISOSVRSTA, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.label1OPISOSVRSTA, 1); padding = new Padding(3, 1, 5, 2); this.label1OPISOSVRSTA.Margin = padding; size = new System.Drawing.Size(0, 0); this.label1OPISOSVRSTA.MinimumSize = size; size = new System.Drawing.Size(0xad, 0x17); this.label1OPISOSVRSTA.Size = size; point = new System.Drawing.Point(0, 0); this.textOPISOSVRSTA.Location = point; this.textOPISOSVRSTA.Name = "textOPISOSVRSTA"; this.textOPISOSVRSTA.Tag = "OPISOSVRSTA"; this.textOPISOSVRSTA.TabIndex = 0; this.textOPISOSVRSTA.Anchor = AnchorStyles.Left; this.textOPISOSVRSTA.MouseEnter += new EventHandler(this.mouseEnter_Text); this.textOPISOSVRSTA.ReadOnly = false; this.textOPISOSVRSTA.DataBindings.Add(new Binding("Text", this.bindingSourceOSVRSTA, "OPISOSVRSTA")); this.textOPISOSVRSTA.MaxLength = 30; this.layoutManagerformOSVRSTA.Controls.Add(this.textOPISOSVRSTA, 1, 1); this.layoutManagerformOSVRSTA.SetColumnSpan(this.textOPISOSVRSTA, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.textOPISOSVRSTA, 1); padding = new Padding(0, 1, 3, 2); this.textOPISOSVRSTA.Margin = padding; size = new System.Drawing.Size(0xe2, 0x16); this.textOPISOSVRSTA.MinimumSize = size; size = new System.Drawing.Size(0xe2, 0x16); this.textOPISOSVRSTA.Size = size; point = new System.Drawing.Point(0, 0); this.label1OSV.Location = point; this.label1OSV.Name = "label1OSV"; this.label1OSV.TabIndex = 1; this.label1OSV.Tag = "labelOSV"; this.label1OSV.Text = "OSV:"; this.label1OSV.StyleSetName = "FieldUltraLabel"; this.label1OSV.AutoSize = true; this.label1OSV.Anchor = AnchorStyles.Left; this.label1OSV.Appearance.TextVAlign = VAlign.Middle; this.label1OSV.Appearance.ForeColor = Color.Black; this.label1OSV.BackColor = Color.Transparent; this.layoutManagerformOSVRSTA.Controls.Add(this.label1OSV, 0, 2); this.layoutManagerformOSVRSTA.SetColumnSpan(this.label1OSV, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.label1OSV, 1); padding = new Padding(3, 1, 5, 2); this.label1OSV.Margin = padding; size = new System.Drawing.Size(0, 0); this.label1OSV.MinimumSize = size; size = new System.Drawing.Size(0x2d, 0x17); this.label1OSV.Size = size; point = new System.Drawing.Point(0, 0); this.labelOSV.Location = point; this.labelOSV.Name = "labelOSV"; this.labelOSV.Tag = "OSV"; this.labelOSV.TabIndex = 0; this.labelOSV.Anchor = AnchorStyles.Left; this.labelOSV.BackColor = Color.Transparent; this.labelOSV.DataBindings.Add(new Binding("Text", this.bindingSourceOSVRSTA, "OSV")); this.labelOSV.Appearance.TextVAlign = VAlign.Middle; this.layoutManagerformOSVRSTA.Controls.Add(this.labelOSV, 1, 2); this.layoutManagerformOSVRSTA.SetColumnSpan(this.labelOSV, 1); this.layoutManagerformOSVRSTA.SetRowSpan(this.labelOSV, 1); padding = new Padding(0, 1, 3, 2); this.labelOSV.Margin = padding; size = new System.Drawing.Size(0x105, 0x16); this.labelOSV.MinimumSize = size; size = new System.Drawing.Size(0x105, 0x16); this.labelOSV.Size = size; this.Controls.Add(this.layoutManagerformOSVRSTA); this.SetNullItem.Index = 0; this.SetNullItem.Text = "Set Null"; this.SetNullItem.Click += new EventHandler(this.SetNullItem_Click); this.contextMenu1.Popup += new EventHandler(this.contextMenu1_Popup); this.contextMenu1.MenuItems.AddRange(new MenuItem[] { this.SetNullItem }); this.errorProvider1.DataSource = this.bindingSourceOSVRSTA; this.errorProviderValidator1.ErrorProvider = this.errorProvider1; this.Name = "OSVRSTAFormUserControl"; this.Text = "Vrste sredstava (OS ili SI)"; this.AutoSize = true; this.AutoScroll = true; this.Load += new EventHandler(this.OSVRSTAFormUserControl_Load); this.layoutManagerformOSVRSTA.ResumeLayout(false); this.layoutManagerformOSVRSTA.PerformLayout(); ((ISupportInitialize)this.bindingSourceOSVRSTA).EndInit(); ((ISupportInitialize)this.textIDOSVRSTA).EndInit(); ((ISupportInitialize)this.textOPISOSVRSTA).EndInit(); this.dsOSVRSTADataSet1.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.button1 = new System.Windows.Forms.Button(); this.exit = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.userNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.UserLvlColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.mainDBDataSetBindingSource = new System.Windows.Forms.BindingSource(this.components); this.mainDBDataSet = new Budgeting_Application.ApplicationData.MainDBDataSet(); this.mainDBDataSetBindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.serialPort1 = new System.IO.Ports.SerialPort(this.components); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSetBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSet)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSetBindingSource1)).BeginInit(); this.SuspendLayout(); // // button1 // this.button1.BackColor = System.Drawing.Color.Lavender; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.Font = new System.Drawing.Font("Lucida Sans", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button1.Location = new System.Drawing.Point(44, 198); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(160, 27); this.button1.TabIndex = 2; this.button1.Text = "Open Application"; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // // exit // this.exit.BackColor = System.Drawing.Color.Lavender; this.exit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.exit.Font = new System.Drawing.Font("Lucida Sans", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.exit.Location = new System.Drawing.Point(44, 231); this.exit.Name = "exit"; this.exit.Size = new System.Drawing.Size(160, 27); this.exit.TabIndex = 3; this.exit.Text = "Exit"; this.exit.UseVisualStyleBackColor = false; this.exit.Click += new System.EventHandler(this.exit_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(221, 19); this.label1.TabIndex = 4; this.label1.Text = "Select the user from the list:"; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToResizeColumns = false; this.dataGridView1.AllowUserToResizeRows = false; this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView1.BackgroundColor = System.Drawing.Color.LightSteelBlue; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightSteelBlue; dataGridViewCellStyle1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dataGridView1.ColumnHeadersHeight = 18; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.userNameColumn, this.UserLvlColumn }); dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.Color.LightGray; dataGridViewCellStyle2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.ActiveCaption; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2; this.dataGridView1.EnableHeadersVisualStyles = false; this.dataGridView1.GridColor = System.Drawing.SystemColors.ControlDarkDark; this.dataGridView1.Location = new System.Drawing.Point(8, 31); this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView1.Size = new System.Drawing.Size(229, 121); this.dataGridView1.TabIndex = 5; this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); this.dataGridView1.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.dataGridView1_RowPrePaint); // // userNameColumn // this.userNameColumn.HeaderText = "Username"; this.userNameColumn.Name = "userNameColumn"; this.userNameColumn.ReadOnly = true; // // UserLvlColumn // this.UserLvlColumn.HeaderText = "User Level"; this.UserLvlColumn.Name = "UserLvlColumn"; this.UserLvlColumn.ReadOnly = true; // // mainDBDataSetBindingSource // this.mainDBDataSetBindingSource.DataSource = this.mainDBDataSet; this.mainDBDataSetBindingSource.Position = 0; // // mainDBDataSet // this.mainDBDataSet.DataSetName = "MainDBDataSet"; this.mainDBDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // mainDBDataSetBindingSource1 // this.mainDBDataSetBindingSource1.DataSource = this.mainDBDataSet; this.mainDBDataSetBindingSource1.Position = 0; // // Program // this.BackColor = System.Drawing.Color.AliceBlue; this.ClientSize = new System.Drawing.Size(245, 265); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.label1); this.Controls.Add(this.exit); this.Controls.Add(this.button1); this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Program"; this.Text = "Budgeting Application - User Selection"; this.Load += new System.EventHandler(this.Program_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSetBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSet)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.mainDBDataSetBindingSource1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void Demandes_Load_1(object sender, EventArgs e) { lesDemandes = new List <demande>(); bindingSource = new BindingSource(); }
} // end PrintToText private void DrawItems(ref Graphics g) { foreach (PrintItems item in this.Items) { switch (item.ItemType.ToString()) { case "Blankline": g.DrawString("", MyFont, MyBrush, new Point(X, Y)); Y += Convert.ToInt32(g.MeasureString("ABCDE", MyFont).Height) + Padding; MaxWidth = X; break; case "Text": string text = item.Item.ToString(); if (item.x == null || item.y == null) { if (Validations.IsNumeric(item.Item)) { text = string.Format("{0:N2}", item.Item); } g.DrawString(text, MyFont, MyBrush, new Point(X, Y)); Y += Convert.ToInt32(g.MeasureString(item.Item.ToString(), MyFont).Height) + Padding; MaxWidth = X + Convert.ToInt32(g.MeasureString(item.Item.ToString(), MyFont).Width) + Padding; } else { if (this.MeasureType == MeasureTypes.Centimeters) { item.x = this.CentimetersToPixels(item.x.Value); item.y = this.CentimetersToPixels(item.y.Value); } g.DrawString(text, MyFont, MyBrush, new PointF(item.x.Value, item.y.Value)); } break; case "Table": if (typeof(DataTable) == item.Item.GetType()) { DataTable dt = (DataTable)item.Item; if (dt.Rows.Count > 0) { ColWidth = Width / dt.Columns.Count; RowHeight = Convert.ToInt32(g.MeasureString("ABCDF", MyFont).Height); // Headers foreach (DataColumn col in dt.Columns) { // DrawString int leftmargin = Convert.ToInt32((dt.Columns.IndexOf(col)) * ColWidth); g.DrawString(col.ColumnName, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight)); } Y += RowHeight + Padding; MaxWidth = dt.Columns.Count * ColWidth + Padding; // DrawLine g.DrawLine(MyPen, new Point(X, Y), new PointF(Width, Y)); // Values foreach (DataRow dr in dt.Rows) { foreach (DataColumn dc in dt.Columns) { // DrawString string val; int leftmargin = Convert.ToInt32((dt.Columns.IndexOf(dc)) * ColWidth); if (Validations.IsNumeric(dr[dc.ColumnName])) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Far; val = string.Format("{0:N2}", dr[dc.ColumnName]); g.DrawString(val, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight), sf); } else { val = dr[dc.ColumnName].ToString(); g.DrawString(val, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight)); } // DrawRectangle } Y += RowHeight + Padding; } // end foreach } // end if } // end if else if (item.Item.GetType() == typeof(BindingSource)) { BindingSource bs = (BindingSource)item.Item; PropertyInfo[] properties = bs.Current.GetType().GetProperties(); int limit = bs.Count; if (bs.Count > 0) { ColWidth = Width / bs.Current.GetType().GetProperties().Length; RowHeight = Convert.ToInt32(g.MeasureString("ABCDF", MyFont).Height); /* NO headers * // Headers * foreach (PropertyInfo col in bs.Current.GetType().GetProperties()) * { * // DrawString * //int leftmargin = Convert.ToInt32((dt.Columns.IndexOf(col)) * ColWidth); * //g.DrawString(col.ColumnName, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight)); * * } * */ Y += RowHeight + Padding; MaxWidth = bs.Current.GetType().GetProperties().Length *ColWidth + Padding; /* NO LINE * // DrawLine * g.DrawLine(MyPen, new Point(X, Y), new PointF(Width, Y)); */ for (int i = 0; i < limit; i++) { object val; int leftmargin = X; foreach (PropertyInfo prop in properties) { val = prop.GetValue(bs.Current, null); if (Validations.IsNumeric(val)) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Far; string strval = string.Format("{0:N2}", val); g.DrawString(strval, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight), sf); } else { string strval = val.ToString(); g.DrawString(strval, MyFont, MyBrush, new RectangleF(leftmargin, Y, ColWidth, RowHeight)); } leftmargin += Convert.ToInt32(leftmargin + ColWidth); } Y += RowHeight + Padding; bs.MoveNext(); } // end for } // end if } // end else if else if (item.Item is IList && item.Item.GetType().IsGenericType) { object obj; BindingSource bs = new BindingSource(item.Item, null); int limit = bs.Count; ColWidth = Convert.ToInt32(g.MeasureString("__" + string.Format("{0:N2}", bs.Current), MyFont).Width); RowHeight = Convert.ToInt32(g.MeasureString(string.Format("{0:N2}", bs.Current), MyFont).Height); float x = (item.x == null) ? X : item.x.Value; float y = (item.x == null) ? Y : item.y.Value; for (int i = 0; i < limit; i++) { obj = bs.Current; if (Validations.IsNumeric(obj)) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Far; string strval = string.Format("{0:N2}", obj); g.DrawString(strval, MyFont, MyBrush, new RectangleF(x, y, ColWidth, RowHeight), sf); } else { string strval = obj.ToString(); g.DrawString(strval, MyFont, MyBrush, new RectangleF(x, y, ColWidth, RowHeight)); } y += RowHeight + Padding; bs.MoveNext(); } } break; } // End switch } // End foreach }
private void btnRefresh_Click(object sender, EventArgs e) { GetEmployees = StaffDAL.GetEmployees(); bindingSource = new BindingSource(GetEmployees, null); dataGridView1.DataSource = bindingSource; }
private void DisplayKeyColumns() { var bindingSource1 = new BindingSource(); bindingSource1.DataSource = _keyColumns; keyColumnList.DataSource = bindingSource1.DataSource; }
private void afterPrint() { if (bsClifor.Count > 0) { using (FormRelPadrao.TFGerenciadorImpressao fImp = new FormRelPadrao.TFGerenciadorImpressao()) { BindingSource BD_REQ = new BindingSource(); BD_REQ.DataSource = new CamadaDados.Compra.Lancamento.TCD_Requisicao().Select( new TpBusca[] { new TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from TB_CMP_Fornec_X_GrupoItem x " + "inner join TB_EST_Produto y " + "on x.cd_grupo = y.cd_grupo " + "where y.cd_produto = a.cd_produto " + "and x.CD_Clifor = '" + (bsClifor.Current as CamadaDados.Financeiro.Cadastros.TRegistro_CadClifor).Cd_clifor.Trim() + "'" + "and a.ST_Requisicao in ('AC', 'RN')) " } }, 0, string.Empty, string.Empty); BindingSource bd_clifor = new BindingSource(); bd_clifor.DataSource = new CamadaDados.Financeiro.Cadastros.TList_CadClifor() { bsClifor.Current as CamadaDados.Financeiro.Cadastros.TRegistro_CadClifor }; FormRelPadrao.Relatorio Rel = new FormRelPadrao.Relatorio(); Rel.Altera_Relatorio = Altera_Relatorio; Rel.DTS_Relatorio = bd_clifor; Rel.Adiciona_DataSource("REQ", BD_REQ); Rel.Nome_Relatorio = this.Name; Rel.NM_Classe = this.Name; Rel.Modulo = "CMP"; Rel.Ident = this.Name; fImp.St_enabled_enviaremail = true; fImp.pCd_clifor = (bsClifor.Current as CamadaDados.Financeiro.Cadastros.TRegistro_CadClifor).Cd_clifor; fImp.pMensagem = "RELATORIO DE REQUISIÇÕES POR FORNECEDOR"; if (Altera_Relatorio) { Rel.Gera_Relatorio(string.Empty, fImp.pSt_imprimir, fImp.pSt_visualizar, fImp.pSt_enviaremail, fImp.pSt_exportPdf, fImp.Path_exportPdf, fImp.pDestinatarios, null, "RELATORIO DE REQUISIÇÕES POR FORNECEDOR", fImp.pDs_mensagem); Altera_Relatorio = false; } else if ((fImp.ShowDialog() == DialogResult.OK) || (fImp.pSt_enviaremail)) { Rel.Gera_Relatorio(string.Empty, fImp.pSt_imprimir, fImp.pSt_visualizar, fImp.pSt_enviaremail, fImp.pSt_exportPdf, fImp.Path_exportPdf, fImp.pDestinatarios, null, "RELATORIO DE REQUISIÇÕES POR FORNECEDOR", fImp.pDs_mensagem); } } } }
protected CollisionalCrossSectionGridViewDriverBase(DataGridViewEx gridView, BindingSource bindingSource, SortableBindingList <TItem> items) : base(gridView, bindingSource, items) { GridView.RowValidating += gridView_RowValidating; }
// ------------------------------------------------------------------------------------------------------------------------------------------- #region GeneratePasswords private void pbGenerate_Click(object sender, EventArgs e) { PasswordGeneratorOptions options = PasswordGeneratorOptions.None; if (rbCapitalsFirst.Checked) { options |= PasswordGeneratorOptions.Capitals | PasswordGeneratorOptions.CapitalsFirstInChunks; } else if (rbCapitalsLast.Checked) { options |= PasswordGeneratorOptions.Capitals | PasswordGeneratorOptions.CapitalsLastInChunks; } else if (rbCapitalsRandom.Checked) { options |= PasswordGeneratorOptions.Capitals; } // if (cbCapitals.Checked) // options |= PasswordGeneratorOptions.Capitals; if (cbSpecials.Checked) { options |= PasswordGeneratorOptions.Specials; if (!cbBlanks.Checked) { options |= PasswordGeneratorOptions.SpecialsNotBlank; } } if (string.IsNullOrEmpty(tbFixedSeparator.Text)) { tbFixedSeparator.Text = PasswordGenerator.SeparatorsDefault.Substring(0, 1); } char fixedSeparator = tbFixedSeparator.Text[0]; if (cbSeparators.Checked) { options |= PasswordGeneratorOptions.Separators; if (cbRotSeparators.Checked) { options |= PasswordGeneratorOptions.SeparatorRotation; } } PasswordGeneratorOptionsEx optionsEx = new PasswordGeneratorOptionsEx() { Options = options, CapitalsMinimum = 1, CapitalsMaximum = (int)nudCapitalsMax.Value, SpecialGroupSymbols = tbSpecials.Text, SpecialGroupsMin = 1, SpecialGroupsMax = (int)nudSpecialsMax.Value, FixedSeparatorChar = fixedSeparator, RotatingSeparators = tbSeparators.Text }; PasswordCollection passwords = new PasswordCollection(); for (int count = 0; count < nudPassToGen.Value; ++count) { string password = _passwordGenerator.Generate((int)nudPassLen.Value, optionsEx); passwords.Append(_passwordGenerator.LastPassword); } dgvPasswords.AutoGenerateColumns = false; var bindingList = new SortableBindingList <PasswordCollectionItem>(passwords.Passwords); BindingSource source = new BindingSource(bindingList, null); dgvPasswords.DataSource = source; }
public void setVenta(Venta venta) { _venta = venta; _bs = _venta.Items.Source; _bs.CurrentChanged += _bs_CurrentChanged; }
public void FilterExclude() { // Arrange var values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); var provider = new DictionaryBasedValueProvider(BindingSource.Query, values); var bindingSource = new BindingSource( "Test", displayName: null, isGreedy: true, isFromRequest: true); // Act var result = provider.Filter(bindingSource); // Assert Assert.Null(result); }
private void Clean_basket_list() { BindingSource bs = new BindingSource(); basket_list.DataSource = bs; }
private void InitializeComponent() { this.components = new Container(); ComponentResourceManager manager = new ComponentResourceManager(typeof(FrmStockInfo)); this.tlbMain = new ToolStrip(); this.toolStripLabel1 = new ToolStripLabel(); this.toolStripSeparator2 = new ToolStripSeparator(); this.toolStripSeparator1 = new ToolStripSeparator(); this.tlb_M_New = new ToolStripButton(); this.tlb_M_Edit = new ToolStripButton(); this.toolStripSeparator3 = new ToolStripSeparator(); this.tlb_M_Undo = new ToolStripButton(); this.tlb_M_Delete = new ToolStripButton(); this.toolStripSeparator4 = new ToolStripSeparator(); this.tlb_M_Save = new ToolStripButton(); this.toolStripSeparator5 = new ToolStripSeparator(); this.tlb_M_Refresh = new ToolStripButton(); this.tlb_M_Find = new ToolStripButton(); this.tlb_M_Print = new ToolStripButton(); this.toolStripSeparator6 = new ToolStripSeparator(); this.toolStripSeparator7 = new ToolStripSeparator(); this.btn_M_Help = new ToolStripButton(); this.tlb_M_Exit = new ToolStripButton(); this.toolStripSeparator8 = new ToolStripSeparator(); this.tlbSaveSysRts = new ToolStripButton(); this.panel1 = new Panel(); this.dataGridView_Main = new DataGridView(); this.cWHId = new DataGridViewTextBoxColumn(); this.cName = new DataGridViewTextBoxColumn(); this.nType = new DataGridViewTextBoxColumn(); this.label4 = new Label(); this.textBox2 = new TextBox(); this.label5 = new Label(); this.textBox_cWHIdQ = new TextBox(); this.textBox_cNameQ = new TextBox(); this.panel_Edit = new Panel(); this.label8 = new Label(); this.cmb_nIsOCS = new ComboBox(); this.label7 = new Label(); this.cmb_bUsed = new ComboBox(); this.label6 = new Label(); this.stbMain = new StatusStrip(); this.stbModul = new ToolStripStatusLabel(); this.stbUser = new ToolStripStatusLabel(); this.stbState = new ToolStripStatusLabel(); this.stbDateTime = new ToolStripStatusLabel(); this.label3 = new Label(); this.label2 = new Label(); this.label1 = new Label(); this.cmb_nType = new ComboBox(); this.textBox_cWHId = new TextBox(); this.textBox_cName = new TextBox(); this.bindingSource_Main = new BindingSource(this.components); this.cmb_nWholePacking = new ComboBox(); this.label10 = new Label(); this.tlbMain.SuspendLayout(); this.panel1.SuspendLayout(); ((ISupportInitialize)this.dataGridView_Main).BeginInit(); this.panel_Edit.SuspendLayout(); this.stbMain.SuspendLayout(); ((ISupportInitialize)this.bindingSource_Main).BeginInit(); base.SuspendLayout(); this.tlbMain.Items.AddRange(new ToolStripItem[] { this.toolStripLabel1, this.toolStripSeparator2, this.toolStripSeparator1, this.tlb_M_New, this.tlb_M_Edit, this.toolStripSeparator3, this.tlb_M_Undo, this.tlb_M_Delete, this.toolStripSeparator4, this.tlb_M_Save, this.toolStripSeparator5, this.tlb_M_Refresh, this.tlb_M_Find, this.tlb_M_Print, this.toolStripSeparator6, this.toolStripSeparator7, this.btn_M_Help, this.tlb_M_Exit, this.toolStripSeparator8, this.tlbSaveSysRts }); this.tlbMain.Location = new Point(0, 0); this.tlbMain.Name = "tlbMain"; this.tlbMain.Size = new Size(0x309, 0x19); this.tlbMain.TabIndex = 15; this.tlbMain.Text = "toolStrip1"; this.toolStripLabel1.Font = new Font("宋体", 9f, FontStyle.Bold); this.toolStripLabel1.ForeColor = SystemColors.ActiveCaption; this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Size = new Size(0, 0x16); this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new Size(6, 0x19); this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new Size(6, 0x19); this.tlb_M_New.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_New.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_New.ForeColor = SystemColors.ActiveCaption; this.tlb_M_New.Image = (Image)manager.GetObject("tlb_M_New.Image"); this.tlb_M_New.ImageTransparentColor = Color.Magenta; this.tlb_M_New.Name = "tlb_M_New"; this.tlb_M_New.Size = new Size(0x23, 0x16); this.tlb_M_New.Tag = "01"; this.tlb_M_New.Text = "新建"; this.tlb_M_New.Click += new EventHandler(this.tlb_M_New_Click); this.tlb_M_Edit.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Edit.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Edit.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Edit.Image = (Image)manager.GetObject("tlb_M_Edit.Image"); this.tlb_M_Edit.ImageTransparentColor = Color.Magenta; this.tlb_M_Edit.Name = "tlb_M_Edit"; this.tlb_M_Edit.Size = new Size(0x23, 0x16); this.tlb_M_Edit.Tag = "02"; this.tlb_M_Edit.Text = "修改"; this.tlb_M_Edit.Click += new EventHandler(this.tlb_M_Edit_Click); this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new Size(6, 0x19); this.tlb_M_Undo.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Undo.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Undo.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Undo.Image = (Image)manager.GetObject("tlb_M_Undo.Image"); this.tlb_M_Undo.ImageTransparentColor = Color.Magenta; this.tlb_M_Undo.Name = "tlb_M_Undo"; this.tlb_M_Undo.Size = new Size(0x23, 0x16); this.tlb_M_Undo.Tag = "03"; this.tlb_M_Undo.Text = "取消"; this.tlb_M_Undo.Click += new EventHandler(this.tlb_M_Undo_Click); this.tlb_M_Delete.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Delete.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Delete.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Delete.Image = (Image)manager.GetObject("tlb_M_Delete.Image"); this.tlb_M_Delete.ImageTransparentColor = Color.Magenta; this.tlb_M_Delete.Name = "tlb_M_Delete"; this.tlb_M_Delete.Size = new Size(0x23, 0x16); this.tlb_M_Delete.Tag = "04"; this.tlb_M_Delete.Text = "删除"; this.tlb_M_Delete.Click += new EventHandler(this.tlb_M_Delete_Click); this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Size = new Size(6, 0x19); this.tlb_M_Save.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Save.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Save.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Save.Image = (Image)manager.GetObject("tlb_M_Save.Image"); this.tlb_M_Save.ImageTransparentColor = Color.Magenta; this.tlb_M_Save.Name = "tlb_M_Save"; this.tlb_M_Save.Size = new Size(0x23, 0x16); this.tlb_M_Save.Tag = "05"; this.tlb_M_Save.Text = "保存"; this.tlb_M_Save.Click += new EventHandler(this.tlb_M_Save_Click); this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new Size(6, 0x19); this.tlb_M_Refresh.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Refresh.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Refresh.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Refresh.Image = (Image)manager.GetObject("tlb_M_Refresh.Image"); this.tlb_M_Refresh.ImageTransparentColor = Color.Magenta; this.tlb_M_Refresh.Name = "tlb_M_Refresh"; this.tlb_M_Refresh.Size = new Size(0x23, 0x16); this.tlb_M_Refresh.Text = "刷新"; this.tlb_M_Refresh.Click += new EventHandler(this.tlb_M_Refresh_Click); this.tlb_M_Find.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Find.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Find.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Find.Image = (Image)manager.GetObject("tlb_M_Find.Image"); this.tlb_M_Find.ImageTransparentColor = Color.Magenta; this.tlb_M_Find.Name = "tlb_M_Find"; this.tlb_M_Find.Size = new Size(0x23, 0x16); this.tlb_M_Find.Text = "查找"; this.tlb_M_Find.Visible = false; this.tlb_M_Find.Click += new EventHandler(this.tlb_M_Find_Click); this.tlb_M_Print.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Print.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Print.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Print.Image = (Image)manager.GetObject("tlb_M_Print.Image"); this.tlb_M_Print.ImageTransparentColor = Color.Magenta; this.tlb_M_Print.Name = "tlb_M_Print"; this.tlb_M_Print.Size = new Size(0x23, 0x16); this.tlb_M_Print.Tag = "06"; this.tlb_M_Print.Text = "打印"; this.tlb_M_Print.Visible = false; this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Size = new Size(6, 0x19); this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Size = new Size(6, 0x19); this.btn_M_Help.DisplayStyle = ToolStripItemDisplayStyle.Text; this.btn_M_Help.Font = new Font("宋体", 9f, FontStyle.Bold); this.btn_M_Help.ForeColor = SystemColors.ActiveCaption; this.btn_M_Help.Image = (Image)manager.GetObject("btn_M_Help.Image"); this.btn_M_Help.ImageTransparentColor = Color.Magenta; this.btn_M_Help.Name = "btn_M_Help"; this.btn_M_Help.Size = new Size(0x23, 0x16); this.btn_M_Help.Text = "帮助"; this.btn_M_Help.Visible = false; this.tlb_M_Exit.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlb_M_Exit.Font = new Font("宋体", 9f, FontStyle.Bold); this.tlb_M_Exit.ForeColor = SystemColors.ActiveCaption; this.tlb_M_Exit.Image = (Image)manager.GetObject("tlb_M_Exit.Image"); this.tlb_M_Exit.ImageTransparentColor = Color.Magenta; this.tlb_M_Exit.Name = "tlb_M_Exit"; this.tlb_M_Exit.Size = new Size(0x23, 0x16); this.tlb_M_Exit.Text = "退出"; this.tlb_M_Exit.Click += new EventHandler(this.tlb_M_Exit_Click); this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Size = new Size(6, 0x19); this.tlbSaveSysRts.DisplayStyle = ToolStripItemDisplayStyle.Text; this.tlbSaveSysRts.Image = (Image)manager.GetObject("tlbSaveSysRts.Image"); this.tlbSaveSysRts.ImageTransparentColor = Color.Magenta; this.tlbSaveSysRts.Name = "tlbSaveSysRts"; this.tlbSaveSysRts.Size = new Size(0x51, 0x16); this.tlbSaveSysRts.Text = "保存系统权限"; this.tlbSaveSysRts.Visible = false; this.tlbSaveSysRts.Click += new EventHandler(this.tlbSaveSysRts_Click); this.panel1.Controls.Add(this.dataGridView_Main); this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this.textBox2); this.panel1.Controls.Add(this.label5); this.panel1.Controls.Add(this.textBox_cWHIdQ); this.panel1.Controls.Add(this.textBox_cNameQ); this.panel1.Dock = DockStyle.Left; this.panel1.Location = new Point(0, 0x19); this.panel1.Name = "panel1"; this.panel1.Size = new Size(0x156, 0x1d0); this.panel1.TabIndex = 0x10; this.dataGridView_Main.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView_Main.Columns.AddRange(new DataGridViewColumn[] { this.cWHId, this.cName, this.nType }); this.dataGridView_Main.Location = new Point(0, 0x21); this.dataGridView_Main.Name = "dataGridView_Main"; this.dataGridView_Main.ReadOnly = true; this.dataGridView_Main.RowHeadersVisible = false; this.dataGridView_Main.RowTemplate.Height = 0x17; this.dataGridView_Main.Size = new Size(0x156, 0x1af); this.dataGridView_Main.TabIndex = 9; this.dataGridView_Main.Tag = "8"; this.dataGridView_Main.CellContentClick += new DataGridViewCellEventHandler(this.dataGridView_Main_CellContentClick); this.cWHId.DataPropertyName = "cWHId"; this.cWHId.HeaderText = "仓库代码"; this.cWHId.Name = "cWHId"; this.cWHId.ReadOnly = true; this.cName.DataPropertyName = "cName"; this.cName.HeaderText = "仓库名称"; this.cName.Name = "cName"; this.cName.ReadOnly = true; this.nType.DataPropertyName = "nType"; this.nType.HeaderText = "仓库类型"; this.nType.Name = "nType"; this.nType.ReadOnly = true; this.label4.AutoSize = true; this.label4.Location = new Point(3, 12); this.label4.Name = "label4"; this.label4.Size = new Size(0x35, 12); this.label4.TabIndex = 13; this.label4.Text = "仓库代码"; this.textBox2.Location = new Point(-331, -40); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new Size(100, 0x15); this.textBox2.TabIndex = 7; this.textBox2.Tag = "0"; this.label5.AutoSize = true; this.label5.Location = new Point(0xa8, 12); this.label5.Name = "label5"; this.label5.Size = new Size(0x35, 12); this.label5.TabIndex = 14; this.label5.Text = "仓库名称"; this.textBox_cWHIdQ.Location = new Point(0x3e, 3); this.textBox_cWHIdQ.Name = "textBox_cWHIdQ"; this.textBox_cWHIdQ.Size = new Size(100, 0x15); this.textBox_cWHIdQ.TabIndex = 7; this.textBox_cWHIdQ.Tag = "0"; this.textBox_cNameQ.Location = new Point(0xe3, 3); this.textBox_cNameQ.Name = "textBox_cNameQ"; this.textBox_cNameQ.Size = new Size(100, 0x15); this.textBox_cNameQ.TabIndex = 6; this.textBox_cNameQ.Tag = "0"; this.panel_Edit.Controls.Add(this.cmb_nWholePacking); this.panel_Edit.Controls.Add(this.label10); this.panel_Edit.Controls.Add(this.label8); this.panel_Edit.Controls.Add(this.cmb_nIsOCS); this.panel_Edit.Controls.Add(this.label7); this.panel_Edit.Controls.Add(this.cmb_bUsed); this.panel_Edit.Controls.Add(this.label6); this.panel_Edit.Controls.Add(this.stbMain); this.panel_Edit.Controls.Add(this.label3); this.panel_Edit.Controls.Add(this.label2); this.panel_Edit.Controls.Add(this.label1); this.panel_Edit.Controls.Add(this.cmb_nType); this.panel_Edit.Controls.Add(this.textBox_cWHId); this.panel_Edit.Controls.Add(this.textBox_cName); this.panel_Edit.Dock = DockStyle.Fill; this.panel_Edit.Location = new Point(0x156, 0x19); this.panel_Edit.Name = "panel_Edit"; this.panel_Edit.Size = new Size(0x1b3, 0x1d0); this.panel_Edit.TabIndex = 0x11; this.panel_Edit.Paint += new PaintEventHandler(this.panel_Edit_Paint); this.label8.AutoSize = true; this.label8.Location = new Point(0xf4, 0x11c); this.label8.Name = "label8"; this.label8.Size = new Size(0x4d, 12); this.label8.TabIndex = 0x1d; this.label8.Text = "(仅对平面库)"; this.cmb_nIsOCS.CausesValidation = false; this.cmb_nIsOCS.DropDownStyle = ComboBoxStyle.DropDownList; this.cmb_nIsOCS.FormattingEnabled = true; this.cmb_nIsOCS.Items.AddRange(new object[] { "不启用", "启用" }); this.cmb_nIsOCS.Location = new Point(0x9d, 0x119); this.cmb_nIsOCS.Name = "cmb_nIsOCS"; this.cmb_nIsOCS.Size = new Size(0x51, 20); this.cmb_nIsOCS.TabIndex = 0x1b; this.cmb_nIsOCS.Tag = "102"; this.label7.AutoSize = true; this.label7.Location = new Point(50, 0x11c); this.label7.Name = "label7"; this.label7.Size = new Size(0x65, 12); this.label7.TabIndex = 0x1c; this.label7.Text = "是否起用车载系统"; this.cmb_bUsed.CausesValidation = false; this.cmb_bUsed.FormattingEnabled = true; this.cmb_bUsed.Items.AddRange(new object[] { "不启用", "启用" }); this.cmb_bUsed.Location = new Point(0x7f, 0xec); this.cmb_bUsed.Name = "cmb_bUsed"; this.cmb_bUsed.Size = new Size(0x6f, 20); this.cmb_bUsed.TabIndex = 3; this.cmb_bUsed.Tag = "102"; this.label6.AutoSize = true; this.label6.Location = new Point(50, 0xef); this.label6.Name = "label6"; this.label6.Size = new Size(0x35, 12); this.label6.TabIndex = 0x1a; this.label6.Text = "是否起用"; this.stbMain.Items.AddRange(new ToolStripItem[] { this.stbModul, this.stbUser, this.stbState, this.stbDateTime }); this.stbMain.Location = new Point(0, 0x1ba); this.stbMain.Name = "stbMain"; this.stbMain.Size = new Size(0x1b3, 0x16); this.stbMain.TabIndex = 0x10; this.stbMain.Text = "statusStrip1"; this.stbModul.Name = "stbModul"; this.stbModul.Size = new Size(0x23, 0x11); this.stbModul.Text = "模块:"; this.stbUser.Name = "stbUser"; this.stbUser.Size = new Size(0x2f, 0x11); this.stbUser.Text = "用户名:"; this.stbState.Name = "stbState"; this.stbState.Size = new Size(0x23, 0x11); this.stbState.Text = "状态:"; this.stbDateTime.Name = "stbDateTime"; this.stbDateTime.Size = new Size(0x23, 0x11); this.stbDateTime.Text = "时间:"; this.label3.AutoSize = true; this.label3.Location = new Point(0x2e, 0xca); this.label3.Name = "label3"; this.label3.Size = new Size(0x35, 12); this.label3.TabIndex = 15; this.label3.Text = "仓库类型"; this.label2.AutoSize = true; this.label2.Location = new Point(0x2e, 0x9d); this.label2.Name = "label2"; this.label2.Size = new Size(0x35, 12); this.label2.TabIndex = 14; this.label2.Text = "仓库名称"; this.label1.AutoSize = true; this.label1.Location = new Point(0x2e, 0x70); this.label1.Name = "label1"; this.label1.Size = new Size(0x35, 12); this.label1.TabIndex = 13; this.label1.Text = "仓库代码"; this.cmb_nType.FormattingEnabled = true; this.cmb_nType.Location = new Point(0x7f, 0xc2); this.cmb_nType.Name = "cmb_nType"; this.cmb_nType.Size = new Size(0x6f, 20); this.cmb_nType.TabIndex = 2; this.cmb_nType.Tag = "101"; this.cmb_nType.SelectedIndexChanged += new EventHandler(this.cmb_nType_SelectedIndexChanged); this.textBox_cWHId.Location = new Point(0x7f, 0x67); this.textBox_cWHId.Name = "textBox_cWHId"; this.textBox_cWHId.ReadOnly = true; this.textBox_cWHId.Size = new Size(0x6f, 0x15); this.textBox_cWHId.TabIndex = 0; this.textBox_cWHId.Tag = "0"; this.textBox_cWHId.ReadOnlyChanged += new EventHandler(this.textBox_cWHId_ReadOnlyChanged); this.textBox_cName.Location = new Point(0x7f, 0x94); this.textBox_cName.Name = "textBox_cName"; this.textBox_cName.Size = new Size(0xcf, 0x15); this.textBox_cName.TabIndex = 1; this.textBox_cName.Tag = "0"; this.textBox_cName.ReadOnlyChanged += new EventHandler(this.textBox_cWHId_ReadOnlyChanged); this.bindingSource_Main.PositionChanged += new EventHandler(this.bindingSource_Main_PositionChanged); this.cmb_nWholePacking.CausesValidation = false; this.cmb_nWholePacking.DropDownStyle = ComboBoxStyle.DropDownList; this.cmb_nWholePacking.FormattingEnabled = true; this.cmb_nWholePacking.Items.AddRange(new object[] { "不区分零整货", "整货库", "零货库" }); this.cmb_nWholePacking.Location = new Point(0x7f, 0x143); this.cmb_nWholePacking.Name = "cmb_nWholePacking"; this.cmb_nWholePacking.Size = new Size(0x6f, 20); this.cmb_nWholePacking.TabIndex = 30; this.cmb_nWholePacking.Tag = "102"; this.label10.AutoSize = true; this.label10.Location = new Point(50, 0x146); this.label10.Name = "label10"; this.label10.Size = new Size(0x41, 12); this.label10.TabIndex = 0x1f; this.label10.Text = "货件属性:"; base.AutoScaleDimensions = new SizeF(6f, 12f); base.ClientSize = new Size(0x309, 0x1e9); base.Controls.Add(this.panel_Edit); base.Controls.Add(this.panel1); base.Controls.Add(this.tlbMain); base.KeyPreview = true; base.Name = "FrmStockInfo"; this.Text = "仓库管理"; base.Load += new EventHandler(this.FrmStockInfo_Load); this.tlbMain.ResumeLayout(false); this.tlbMain.PerformLayout(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((ISupportInitialize)this.dataGridView_Main).EndInit(); this.panel_Edit.ResumeLayout(false); this.panel_Edit.PerformLayout(); this.stbMain.ResumeLayout(false); this.stbMain.PerformLayout(); ((ISupportInitialize)this.bindingSource_Main).EndInit(); base.ResumeLayout(false); base.PerformLayout(); }
void fill() { // code textBox SqlConnection conDataBase = new SqlConnection(constring); conDataBase.Open(); string maxBill = new SqlCommand("IF EXISTS (select MAX(Id) from generalSpendingTable) BEGIN SELECT MAX(Id) FROM generalSpendingTable END", conDataBase).ExecuteScalar().ToString(); if (maxBill != "") { int maxBillint = Convert.ToInt32(maxBill); codeTextBox.Text = Convert.ToString(maxBillint + 1); conDataBase.Close(); } else { codeTextBox.Text = "1"; conDataBase.Close(); } //safeComboBox safeComboBox.Items.Clear(); conDataBase = new SqlConnection(constring); conDataBase.Open(); string Query = "select distinct name from safeMainTable;"; DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(Query, conDataBase); da.Fill(dt); try { foreach (DataRow dr in dt.Rows) { safeComboBox.Items.Add(dr["name"].ToString()); } } catch { } conDataBase.Close(); if (safeComboBox.Items.Count > 0) { safeComboBox.Text = safeComboBox.Items[0].ToString(); } //category DGV categoryDGV.DataSource = null; Query = "select generalSpendingTable.Id as 'رقم المصروف', type as 'نوع المصروف' ,amount as 'المبلغ', safe as 'الخزنة', details as 'التفاصيل',date as 'التاريخ' from generalSpendingTable;"; conDataBase = new SqlConnection(constring); SqlCommand cmdDataBase = new SqlCommand(Query, conDataBase); try { SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSource = new BindingSource(); bSource.DataSource = dbdataset; categoryDGV.DataSource = bSource; sda.Update(dbdataset); } catch (Exception ex) { MessageBox.Show(ex.Message); } conDataBase.Close(); }
public TestValueProvider(BindingSource bindingSource, IDictionary<string, object> values) : base(bindingSource, values) { }
public medorders() { InitializeComponent(); placeddataview.DoubleBuffered(true); PictureBox loading = new PictureBox() { Image = Properties.Resources.loading, Size = new Size(40, 30), SizeMode = PictureBoxSizeMode.StretchImage, Location = new Point(73, 0), }; this.Controls.Add(loading); BackgroundWorker medload = new BackgroundWorker(); medload.WorkerReportsProgress = true; try { medload.DoWork += (o, a) => { dr = obj.Query("select customer.mail,medorders.email,medorders.orderid,medorders.timestamp,medorders.amount,medorders.dp,medorders.shipping,medorders.itemcount,medorders.paymenttype,medorders.paymentconfirmed,medorders.status,medorders.name,medorders.address1,medorders.address2,medorders.pincode,medorders.contact,medorders.city,medorders.msg from lalchowk.medorders inner join customer on customer.email=medorders.email where status='placed' or status='confirmed' order by orderid desc;"); DataTable dt = new DataTable(); dt.Load(dr); obj.closeConnection(); BindingSource bsource = new BindingSource(); bsource.DataSource = dt; object[] arg = { bsource }; medload.ReportProgress(25, arg); dr = obj.Query("select customer.mail,medorders.email,medorders.orderid,medorders.timestamp,medorders.amount,medorders.dp,medorders.shipping,medorders.itemcount,medorders.paymenttype,medorders.paymentconfirmed,medorders.status,medorders.name,medorders.address1,medorders.address2,medorders.pincode,medorders.contact,medorders.city,medorders.msg from lalchowk.medorders inner join customer on customer.email=medorders.email where status='shipped' order by orderid desc;"); DataTable dt3 = new DataTable(); dt3.Load(dr); obj.closeConnection(); BindingSource bsource3 = new BindingSource(); bsource3.DataSource = dt3; object[] arg3 = { bsource3 }; medload.ReportProgress(50, arg3); dr1 = obj.Query("select customer.mail,medorders.email,medorders.orderid,medorders.timestamp,medorders.amount,medorders.dp,medorders.shipping,medorders.itemcount,medorders.status,medorders.name,medorders.address1,medorders.address2,medorders.pincode,medorders.contact,medorders.city,medorders.msg from lalchowk.medorders inner join customer on customer.email=medorders.email where status='delivered' order by orderid desc;"); DataTable dt1 = new DataTable(); dt1.Load(dr1); obj.closeConnection(); BindingSource bsource1 = new BindingSource(); bsource1.DataSource = dt1; object[] arg1 = { bsource1 }; medload.ReportProgress(75, arg1); dr2 = obj.Query("select customer.mail,medorders.email,medorders.orderid,medorders.timestamp,medorders.amount,medorders.dp,medorders.shipping,medorders.itemcount,medorders.status,medorders.name,medorders.address1,medorders.address2,medorders.pincode,medorders.contact,medorders.city,medorders.msg from lalchowk.medorders inner join customer on customer.email=medorders.email order by orderid desc ;"); DataTable dt2 = new DataTable(); dt2.Load(dr2); obj.closeConnection(); BindingSource bsource2 = new BindingSource(); bsource2.DataSource = dt2; object[] arg2 = { bsource2 }; medload.ReportProgress(90, arg2); }; medload.ProgressChanged += (o, a) => { if (a.ProgressPercentage == 25) { try { Object[] arg = (object[])a.UserState; BindingSource bsource = arg[0] as BindingSource; placeddataview.DataSource = bsource; // loadlbl.Text="Health Orders"; placeddataview.Columns["email"].Visible = false; placeddataview.Visible = true; medcontrol.Visible = true; DataGridViewButtonColumn ship = new DataGridViewButtonColumn(); ship.UseColumnTextForButtonValue = true; ship.Name = "Ship"; ship.DataPropertyName = "Ship"; ship.Text = "Ship"; placeddataview.Columns.Add(ship); } catch { } } else if (a.ProgressPercentage == 50) { try { Object[] arg = (object[])a.UserState; BindingSource bsource = arg[0] as BindingSource; shippeddataview.DataSource = bsource; dellbl.Visible = false; shippeddataview.Columns["email"].Visible = false; shippeddataview.Visible = true; DataGridViewButtonColumn del = new DataGridViewButtonColumn(); del.UseColumnTextForButtonValue = true; del.Name = "Delivered"; del.DataPropertyName = "Delivered"; del.Text = "Delivered"; shippeddataview.Columns.Add(del); } catch { } } else if (a.ProgressPercentage == 75) { try { Object[] arg = (object[])a.UserState; BindingSource bsource = arg[0] as BindingSource; deldataview.DataSource = bsource; dellbl.Visible = false; deldataview.Columns["email"].Visible = false; deldataview.Visible = true; } catch { } } else if (a.ProgressPercentage == 90) { try { Object[] arg = (object[])a.UserState; BindingSource bsource = arg[0] as BindingSource; alldataview.DataSource = bsource; alllbl.Visible = false; loadlbl.Text = "Health Orders"; alldataview.Columns["email"].Visible = false; alldataview.Visible = true; } catch { } } }; medload.RunWorkerCompleted += (o, b) => { //BindingSource bsource = b.Result as BindingSource; //placeddataview.DataSource = bsource; //loadlbl.Visible = false; //placeddataview.Columns["email"].Visible = false; //placeddataview.Visible = true; medcontrol.Visible = true; loading.Visible = false; loading.Dispose(); obj.closeConnection(); }; medload.RunWorkerAsync(); } catch (Exception ex) { medcontrol.Visible = false; loadlbl.Text = "error, please reload"; loadlbl.Visible = true; MessageBox.Show(ex.Message); obj.closeConnection(); } }
public Manager() { InitializeComponent(); bs = new BindingSource(); }
private void InitializeComponent() { this.components = new Container(); ResourceManager manager = new ResourceManager(typeof(RAD1VEZASPOLFormUserControl)); this.contextMenu1 = new ContextMenu(); this.SetNullItem = new MenuItem(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.errorProvider1 = new ErrorProvider(); this.errorProviderValidator1 = new ErrorProviderValidator(this.components); this.bindingSourceRAD1VEZASPOL = new BindingSource(this.components); ((ISupportInitialize)this.bindingSourceRAD1VEZASPOL).BeginInit(); this.layoutManagerformRAD1VEZASPOL = new TableLayoutPanel(); this.layoutManagerformRAD1VEZASPOL.SuspendLayout(); this.layoutManagerformRAD1VEZASPOL.AutoSize = true; this.layoutManagerformRAD1VEZASPOL.Dock = DockStyle.Fill; this.layoutManagerformRAD1VEZASPOL.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.layoutManagerformRAD1VEZASPOL.AutoScroll = false; System.Drawing.Point point = new System.Drawing.Point(0, 0); this.layoutManagerformRAD1VEZASPOL.Location = point; Size size = new System.Drawing.Size(0, 0); this.layoutManagerformRAD1VEZASPOL.Size = size; this.layoutManagerformRAD1VEZASPOL.ColumnCount = 2; this.layoutManagerformRAD1VEZASPOL.RowCount = 3; this.layoutManagerformRAD1VEZASPOL.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.layoutManagerformRAD1VEZASPOL.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.layoutManagerformRAD1VEZASPOL.RowStyles.Add(new RowStyle()); this.layoutManagerformRAD1VEZASPOL.RowStyles.Add(new RowStyle()); this.layoutManagerformRAD1VEZASPOL.RowStyles.Add(new RowStyle()); this.label1RAD1SPOLID = new UltraLabel(); this.comboRAD1SPOLID = new RAD1SPOLComboBox(); this.label1IDSPOL = new UltraLabel(); this.comboIDSPOL = new SPOLComboBox(); this.dsRAD1VEZASPOLDataSet1 = new RAD1VEZASPOLDataSet(); this.dsRAD1VEZASPOLDataSet1.BeginInit(); this.SuspendLayout(); this.dsRAD1VEZASPOLDataSet1.DataSetName = "dsRAD1VEZASPOL"; this.dsRAD1VEZASPOLDataSet1.Locale = new CultureInfo("hr-HR"); this.bindingSourceRAD1VEZASPOL.DataSource = this.dsRAD1VEZASPOLDataSet1; this.bindingSourceRAD1VEZASPOL.DataMember = "RAD1VEZASPOL"; ((ISupportInitialize)this.bindingSourceRAD1VEZASPOL).BeginInit(); point = new System.Drawing.Point(0, 0); this.label1RAD1SPOLID.Location = point; this.label1RAD1SPOLID.Name = "label1RAD1SPOLID"; this.label1RAD1SPOLID.TabIndex = 1; this.label1RAD1SPOLID.Tag = "labelRAD1SPOLID"; this.label1RAD1SPOLID.Text = "Spol u RAD1 obrascu:"; this.label1RAD1SPOLID.StyleSetName = "FieldUltraLabel"; this.label1RAD1SPOLID.AutoSize = true; this.label1RAD1SPOLID.Anchor = AnchorStyles.Left; this.label1RAD1SPOLID.Appearance.TextVAlign = VAlign.Middle; this.label1RAD1SPOLID.Appearance.Image = RuntimeHelpers.GetObjectValue(manager.GetObject("pictureBoxKey.Image")); this.label1RAD1SPOLID.Appearance.ImageHAlign = HAlign.Right; size = new System.Drawing.Size(7, 10); this.label1RAD1SPOLID.ImageSize = size; this.label1RAD1SPOLID.Appearance.ForeColor = Color.Black; this.label1RAD1SPOLID.BackColor = Color.Transparent; this.layoutManagerformRAD1VEZASPOL.Controls.Add(this.label1RAD1SPOLID, 0, 0); this.layoutManagerformRAD1VEZASPOL.SetColumnSpan(this.label1RAD1SPOLID, 1); this.layoutManagerformRAD1VEZASPOL.SetRowSpan(this.label1RAD1SPOLID, 1); Padding padding = new Padding(3, 1, 5, 2); this.label1RAD1SPOLID.Margin = padding; size = new System.Drawing.Size(0, 0); this.label1RAD1SPOLID.MinimumSize = size; size = new System.Drawing.Size(0x91, 0x17); this.label1RAD1SPOLID.Size = size; point = new System.Drawing.Point(0, 0); this.comboRAD1SPOLID.Location = point; this.comboRAD1SPOLID.Name = "comboRAD1SPOLID"; this.comboRAD1SPOLID.Tag = "RAD1SPOLID"; this.comboRAD1SPOLID.TabIndex = 0; this.comboRAD1SPOLID.Anchor = AnchorStyles.Left; this.comboRAD1SPOLID.MouseEnter += new EventHandler(this.mouseEnter_Text); this.comboRAD1SPOLID.DropDownStyle = DropDownStyle.DropDown; this.comboRAD1SPOLID.ComboBox.DropDownStyle = DropDownStyle.DropDown; this.comboRAD1SPOLID.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest; this.comboRAD1SPOLID.Enabled = true; this.comboRAD1SPOLID.DataBindings.Add(new Binding("Value", this.bindingSourceRAD1VEZASPOL, "RAD1SPOLID")); this.comboRAD1SPOLID.ShowPictureBox = true; this.comboRAD1SPOLID.PictureBoxClicked += new EventHandler(this.PictureBoxClickedRAD1SPOLID); this.comboRAD1SPOLID.ValueMember = "RAD1SPOLID"; this.comboRAD1SPOLID.SelectionChanged += new EventHandler(this.SelectedIndexChangedRAD1SPOLID); this.layoutManagerformRAD1VEZASPOL.Controls.Add(this.comboRAD1SPOLID, 1, 0); this.layoutManagerformRAD1VEZASPOL.SetColumnSpan(this.comboRAD1SPOLID, 1); this.layoutManagerformRAD1VEZASPOL.SetRowSpan(this.comboRAD1SPOLID, 1); padding = new Padding(0, 1, 3, 2); this.comboRAD1SPOLID.Margin = padding; size = new System.Drawing.Size(0xc4, 0x17); this.comboRAD1SPOLID.MinimumSize = size; size = new System.Drawing.Size(0xc4, 0x17); this.comboRAD1SPOLID.Size = size; point = new System.Drawing.Point(0, 0); this.label1IDSPOL.Location = point; this.label1IDSPOL.Name = "label1IDSPOL"; this.label1IDSPOL.TabIndex = 1; this.label1IDSPOL.Tag = "labelIDSPOL"; this.label1IDSPOL.Text = "Spol iz kadrovske evidencije:"; this.label1IDSPOL.StyleSetName = "FieldUltraLabel"; this.label1IDSPOL.AutoSize = true; this.label1IDSPOL.Anchor = AnchorStyles.Left; this.label1IDSPOL.Appearance.TextVAlign = VAlign.Middle; this.label1IDSPOL.Appearance.Image = RuntimeHelpers.GetObjectValue(manager.GetObject("pictureBoxKey.Image")); this.label1IDSPOL.Appearance.ImageHAlign = HAlign.Right; size = new System.Drawing.Size(7, 10); this.label1IDSPOL.ImageSize = size; this.label1IDSPOL.Appearance.ForeColor = Color.Black; this.label1IDSPOL.BackColor = Color.Transparent; this.layoutManagerformRAD1VEZASPOL.Controls.Add(this.label1IDSPOL, 0, 1); this.layoutManagerformRAD1VEZASPOL.SetColumnSpan(this.label1IDSPOL, 1); this.layoutManagerformRAD1VEZASPOL.SetRowSpan(this.label1IDSPOL, 1); padding = new Padding(3, 1, 5, 2); this.label1IDSPOL.Margin = padding; size = new System.Drawing.Size(0, 0); this.label1IDSPOL.MinimumSize = size; size = new System.Drawing.Size(0xbf, 0x17); this.label1IDSPOL.Size = size; point = new System.Drawing.Point(0, 0); this.comboIDSPOL.Location = point; this.comboIDSPOL.Name = "comboIDSPOL"; this.comboIDSPOL.Tag = "IDSPOL"; this.comboIDSPOL.TabIndex = 0; this.comboIDSPOL.Anchor = AnchorStyles.Left; this.comboIDSPOL.MouseEnter += new EventHandler(this.mouseEnter_Text); this.comboIDSPOL.DropDownStyle = DropDownStyle.DropDown; this.comboIDSPOL.ComboBox.DropDownStyle = DropDownStyle.DropDown; this.comboIDSPOL.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest; this.comboIDSPOL.Enabled = true; this.comboIDSPOL.DataBindings.Add(new Binding("Value", this.bindingSourceRAD1VEZASPOL, "IDSPOL")); this.comboIDSPOL.ShowPictureBox = true; this.comboIDSPOL.PictureBoxClicked += new EventHandler(this.PictureBoxClickedIDSPOL); this.comboIDSPOL.ValueMember = "IDSPOL"; this.comboIDSPOL.SelectionChanged += new EventHandler(this.SelectedIndexChangedIDSPOL); this.layoutManagerformRAD1VEZASPOL.Controls.Add(this.comboIDSPOL, 1, 1); this.layoutManagerformRAD1VEZASPOL.SetColumnSpan(this.comboIDSPOL, 1); this.layoutManagerformRAD1VEZASPOL.SetRowSpan(this.comboIDSPOL, 1); padding = new Padding(0, 1, 3, 2); this.comboIDSPOL.Margin = padding; size = new System.Drawing.Size(0xc4, 0x17); this.comboIDSPOL.MinimumSize = size; size = new System.Drawing.Size(0xc4, 0x17); this.comboIDSPOL.Size = size; this.Controls.Add(this.layoutManagerformRAD1VEZASPOL); this.SetNullItem.Index = 0; this.SetNullItem.Text = "Set Null"; this.SetNullItem.Click += new EventHandler(this.SetNullItem_Click); this.contextMenu1.Popup += new EventHandler(this.contextMenu1_Popup); this.contextMenu1.MenuItems.AddRange(new MenuItem[] { this.SetNullItem }); this.errorProvider1.DataSource = this.bindingSourceRAD1VEZASPOL; this.errorProviderValidator1.ErrorProvider = this.errorProvider1; this.Name = "RAD1VEZASPOLFormUserControl"; this.Text = "Veza RAD1 i spol"; this.AutoSize = true; this.AutoScroll = true; this.Load += new EventHandler(this.RAD1VEZASPOLFormUserControl_Load); this.layoutManagerformRAD1VEZASPOL.ResumeLayout(false); this.layoutManagerformRAD1VEZASPOL.PerformLayout(); ((ISupportInitialize)this.bindingSourceRAD1VEZASPOL).EndInit(); this.dsRAD1VEZASPOLDataSet1.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }