private void RefreshItems(object sender, EventArgs e) { var biz = new LockingBiz(); dataGridView.DataSource = biz.LoadItems(); dataGridView.Refresh(); }
private void FormClosedEvent(object sender, FormClosedEventArgs e) { if (!isLocked) { var lockBiz = new LockingBiz(); lockBiz.UnlockItem(Constants.TableNameOrder, itemId, currentUser.Id); } }
private void Unlock(object sender, EventArgs e) { var locking = dataGridView.SelectedRows[0].DataBoundItem as LockingTemplate; if (locking != null) { var biz = new LockingBiz(); biz.UnlockItem(locking.TableName, locking.ItemId, locking.CurrentUserId); RefreshItems(sender, e); } }
public LockingView(User user) { InitializeComponent(); dataGridView.AutoGenerateColumns = false; currentUser = user; var biz = new LockingBiz(); dataGridView.DataSource = biz.LoadItems(); dataGridView.Refresh(); }
public OrderForm(int id, User user) { InitializeComponent(); InitForm(user); var lockBiz = new LockingBiz(); var lockItem = lockBiz.LoadItem(Constants.TableNameOrder, user.Id, id); if (lockItem == null) { lockBiz.LockItem(Constants.TableNameOrder, id, user.Id); } else { groupBox1.Enabled = false; groupBox2.Enabled = false; groupBox3.Enabled = false; groupBox5.Enabled = false; groupBox7.Enabled = false; buttonSave.Enabled = false; var userBiz = new UserBiz(); var lockedUser = userBiz.LoadItem(lockItem.CurrentUserId); lockedUserName = lockedUser.FullName; isLocked = true; } itemId = id; var biz = new OrderBiz(); var item = biz.LoadItem(id); created = item.Created; createdBy = item.CreatedByUserId; modified = item.Modified; modifiedBy = item.ModifiedByUserId; labelOrderNo.Text = item.OrderNo; labelStatus.Text = item.Status; dateOrderDate.Value = item.OrderDate; dateDeliveryDate.Value = item.DeliveryDate; textDeliverrAddress.Text = item.DeliveryAddress; txtDiscount.Text = item.Discount.ToString(); txtDiscountLD.Text = item.DiscountLD.ToString(); if (item.Liability.HasValue) { textDuNo.Text = item.Liability.Value.ToString(Constants.CurrencyFormat); } txtRecipient.Text = item.Recipient; txtRecipientPhone.Text = item.RecipientPhone; cboDeliveryInternal.Checked = item.DeliveryInternal; cboVat.Checked = item.Vat; cboSendWithEmail.Checked = item.SendWithEmail; sendEmail = item.SendEmail; sendSms = item.SendMessage; if (item.CustomerId.HasValue) { textCustomer.Text = item.CustomerName; currentCustomer = item.Customer; SelectCustomer(); } LoadProducts(item); this.Text = "Sửa đơn hàng"; }
public DeliveryForm(int id, User user) { InitializeComponent(); InitForm(user); var lockBiz = new LockingBiz(); var lockItem = lockBiz.LoadItem(Constants.TableNameDelivery, user.Id, id); if (lockItem == null) { lockBiz.LockItem(Constants.TableNameDelivery, id, user.Id); } else { groupBox1.Enabled = false; groupBox3.Enabled = false; groupBox4.Enabled = false; buttonSave.Enabled = false; buttonSendEmail.Enabled = false; buttonSendSms.Enabled = false; var userBiz = new UserBiz(); var lockedUser = userBiz.LoadItem(lockItem.CurrentUserId); lockedUserName = lockedUser.FullName; isLocked = true; } drlVehicle.Focus(); itemId = id; var biz = new DeliveryBiz(); var item = biz.LoadItem(id); created = item.Created; createdBy = item.CreatedByUserId; modified = item.Modified; modifiedBy = item.ModifiedByUserId; labelDeliveryNo.Text = item.DeliveryNo; labelStatus.Text = item.Status; labelSendSms.Text = item.IsSendSms; labelSendEmail.Text = item.IsSendEmail; if (item.DeliveryDate.HasValue) { dateStartDate.Value = item.DeliveryDate.Value; } if (item.StartTime.HasValue) { dateTimeStartTime.Value = DateTime.Now + item.StartTime.Value; } textOtherInformation.Text = item.OtherInformation; if (item.VehicleId.HasValue) { drlVehicle.SelectedValue = item.VehicleId.Value; } if (item.StaffId.HasValue) { drlUser.SelectedValue = item.StaffId.Value; } LoadOrders(item); this.Text = "Cập nhật thông tin giao hàng"; }