private void CancelItem(object sender, EventArgs e) { var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); }
private void SaveItem(object sender, EventArgs e) { if (CheckSecurity(itemId)) { var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { if (CustomValidation()) { var item = new Order(); item.OrderDate = dateOrderDate.Value; item.DeliveryDate = dateDeliveryDate.Value; item.DeliveryAddress = textDeliverrAddress.Text; if (currentCustomer != null) { item.CustomerId = currentCustomer.Id; } item.DeliveryInternal = cboDeliveryInternal.Checked; //decimal discount = 0; //if (decimal.TryParse(txtDiscount.Text, out discount)) //{ // item.Discount = discount; //} //decimal discountLd = 0; //if (decimal.TryParse(txtDiscountLD.Text, out discountLd)) //{ // item.DiscountLD = discountLd; //} item.Recipient = txtRecipient.Text; item.RecipientPhone = txtRecipientPhone.Text; item.Vat = cboVat.Checked; if (!string.IsNullOrEmpty(item.Recipient) && string.IsNullOrEmpty(item.IsSendNotification)) { item.IsSendNotification = Constants.OrderReport1; } item.SendWithEmail = cboSendWithEmail.Checked; if(!string.IsNullOrEmpty(textDuNo.Text)) { item.Liability = decimal.Parse(textDuNo.Text); } item.SendEmail = sendEmail; item.SendMessage = sendSms; if (itemId > 0) { item.Id = itemId; item.Status = labelStatus.Text; item.OrderNo = labelOrderNo.Text; item.Created = created; item.CreatedByUserId = createdBy; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.UpdateItem(item); } else { item.Status = Constants.OrderStatusDraft; item.SendEmail = Constants.OrderEmail1; item.SendMessage = Constants.OrderSms1; item.Created = DateTime.Now; item.CreatedByUserId = currentUser.Id; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.SaveItem(item); } UpdateProductList(item); var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { this.DialogResult = DialogResult.None; } } }
private void SelectNode(object sender, TreeViewEventArgs e) { string name = treeView.SelectedNode.Text; switch (name) { case "Quản lý nhân viên": var userView = new UserView { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(userView); break; case "Quản lý cấu hình hệ thống": var configurationView = new ConfigurationView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(configurationView); break; case "Quản lý nội dung tin nhắn": var smsView = new SmsView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(smsView); break; case "Quản lý nội dung email": var emailView = new EmailView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(emailView); break; case "Quản lý khách hàng": var customerView = new CustomerView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(customerView); break; case "Quản lý loại sản phẩm": var productTypeView = new ProductTypeView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productTypeView); break; case "Quản lý sản phẩm": var productView = new ProductView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productView); break; case "Quản lý sản phẩm LD": var productLDView = new ProductLDView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productLDView); break; case "Quản lý thiết bị vận chuyển": var vehicleView = new VehicleView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(vehicleView); break; case "Quản lý đơn hàng": var orderView = new OrderView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(orderView); break; case "Quản lý thông tin vận chuyển": var mainView = new MainView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(mainView); break; case "Bảng thông tin đơn hàng": var frm = new DashboardForm { Dock = DockStyle.Fill, TopLevel = true }; frm.ShowDialog(); break; case "Quản lý tên thành phố": var cityView = new CityView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(cityView); break; case "Quản lý quyền truy cập": var roleView = new RoleView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(roleView); break; case "Quản lý cập nhật dữ liệu": var lockingView = new LockingView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(lockingView); break; case "Quản lý thông tin email": var emailDataView = new EmailDataView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(emailDataView); break; case "Quản lý thông tin tin nhắn": var smsDataView = new SmsDataView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(smsDataView); break; default: break; } }
private void SaveItem(object sender, EventArgs e) { if (CheckSecurity(itemId)) { var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { if (CustomValidation()) { var item = new Order(); item.OrderDate = dateOrderDate.Value; item.DeliveryDate = dateDeliveryDate.Value; item.DeliveryAddress = textDeliverrAddress.Text; if (currentCustomer != null) { item.CustomerId = currentCustomer.Id; } item.DeliveryInternal = cboDeliveryInternal.Checked; //decimal discount = 0; //if (decimal.TryParse(txtDiscount.Text, out discount)) //{ // item.Discount = discount; //} //decimal discountLd = 0; //if (decimal.TryParse(txtDiscountLD.Text, out discountLd)) //{ // item.DiscountLD = discountLd; //} item.Recipient = txtRecipient.Text; item.RecipientPhone = txtRecipientPhone.Text; item.Vat = cboVat.Checked; if (!string.IsNullOrEmpty(item.Recipient) && string.IsNullOrEmpty(item.IsSendNotification)) { item.IsSendNotification = Constants.OrderReport1; } item.SendWithEmail = cboSendWithEmail.Checked; if (!string.IsNullOrEmpty(textDuNo.Text)) { item.Liability = decimal.Parse(textDuNo.Text); } item.SendEmail = sendEmail; item.SendMessage = sendSms; if (itemId > 0) { item.Id = itemId; item.Status = labelStatus.Text; item.OrderNo = labelOrderNo.Text; item.Created = created; item.CreatedByUserId = createdBy; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.UpdateItem(item); } else { item.Status = Constants.OrderStatusDraft; item.SendEmail = Constants.OrderEmail1; item.SendMessage = Constants.OrderSms1; item.Created = DateTime.Now; item.CreatedByUserId = currentUser.Id; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.SaveItem(item); } UpdateProductList(item); var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { this.DialogResult = DialogResult.None; } } }