public void load() { List <QueueDetials> listData = new List <QueueDetials>(); foreach (var item in inh.GetAll(false)) { listData.Add(new QueueDetials() { InventoryInsHeaderId = item.InventoryInsHeaderId, InventoryType = 0, InventoryId = item.InventoryId, TypeId = item.TypeId, Title = item.Title, Date = item.Date, }); } foreach (var item in outh.GetAll(false)) { listData.Add(new QueueDetials() { InventoryInsHeaderId = item.InventoryOutsHeaderId, InventoryType = 1, InventoryId = item.InventoryId, TypeId = item.TypeId, Title = item.Title, Date = item.Date, }); } if (listData.Count != 0) { grid.SetDataSource(null); grid.EditMode = DataGridViewEditMode.EditOnEnter; grid.SetDataSource(listData.OrderBy(p => p.Date)); grid.ResetBindings(); } else { grid.EditMode = DataGridViewEditMode.EditProgrammatically; grid.SetDataSource(null); } }
protected override void OnLoad(EventArgs e) { //AddAction("افزودن", btn => //{ // InventoryInsHeader IH = new InventoryInsHeader(); // if (IH.ShowDialog() == DialogResult.OK) // { // grid.AddItem(IH._InventoryInsHeader); // grid.ResetBindings(); // } //}); //AddAction("حذف", btn => //{ // int id = grid.CurrentItem.InventoryInsHeaderId; // if (Invs.Delete(id)) // { // foreach (var item in invd.GetAll().Where(p => p.InventoryInsHeaderId == id).ToList()) // { // invd.Delete(item); // } // grid.ResetBindings(); // MessageBox.Show("با موفقیت انجام شد", "پیام سیستم"); // } // else // { // MessageBox.Show("مشکل در به وجود آمد", "پیام سیستم"); // } //}); grid = new Framwork.GirdControl <Entities.InventoryInsHeader>(this); grid.AddTextBoxColumn(p => p.InventoryInsHeaderId, "شناسه"); grid.AddTextBoxColumn(p => p.Title, "عنوان"); grid.AddTextBoxColumn(p => p.TypeId, "نوع رسید"); grid.AddTextBoxColumn(p => p.Date, "تاریخ"); grid.AddDropDownColumnTrueFalse(p => p.Accepted, "وضعیت"); grid.SetDataSource(Invs.GetAll()); base.OnLoad(e); }