public void AddOrderDescription(string description,Order order) { using (SqlConnection conn = new SqlConnection(DBHelper.GetConnection())) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = @"update CustomerOrder set Description = @Description where OrderId = @OrderId"; cmd.Parameters.AddWithValue("@Description", description); cmd.Parameters.AddWithValue("@OrderId",order.OrderId); try { conn.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { conn.Close(); cmd.Dispose(); } } }
public void LoadDetailInformation(int orderId) { order = modifyCustomerManager.GetOrderById(orderId); txtCompany.Text = order.Customers.CompanyName; txtContactPerson.Text = order.Customers.ContactPerson; txtContactPerson2.Text = order.Customers.ContactPerson2; txtContactPerson2Number.Text = order.Customers.ContactPerson2Number; txtContactPerson3.Text = order.Customers.ContactPerson3; txtContactPerson3Number.Text = order.Customers.Contactperson3Number; txtContactPersonNumber.Text = order.Customers.ContactPersonNumber; txtEmail.Text = order.Customers.Email; txtRidePath.Text = order.Customers.RidePath; txtUsableArea.Text = order.Customers.UsableArea; txtDecorateAddress.Text = order.Customers.DecorationAddress; txtWorkPlace.Text = order.Customers.WorkPlace; cbCity.Text = order.Customers.City; lblOrderNumber.Text = order.OrderNumber.ToString(); lblRecordDateTime.Text = order.RecordDate.ToLongDateString(); lblImformationer.Text = order.Customers.InformationAssistants.InformationAssistantName; lblOrderStatus.Text = order.OrderStatus; lblEmployee.Text = order.Customers.Employees.Name; if (order.OrderStatus == OrderStatus.Submitted) { radioButtonSubmit.Checked = true; } if (order.OrderStatus == OrderStatus.Following) { radioButtonFollowing.Checked = true; } if (order.OrderStatus == OrderStatus.Discard) { radioButtonGiveUp.Checked = true; } }
public void SaveCustomer(Customer customer, Order order) { using (SqlConnection conn = new SqlConnection(DBHelper.GetConnection())) { SqlTransaction tran = null; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; try { conn.Open(); tran = conn.BeginTransaction(); cmd.Transaction = tran; cmd.CommandText = @"insert into Customer values(@CustomerId, @CompanyName,@ContactPerson,@ContactPersonNumber, @ContactPerson2,@ContactPerson2Number,@ContactPerson3, @ContactPerson3Number,@City,@UsableArea,@Email,@DecorationAddress, @RidePath,@AppointDateTime,@ProviderType,@CustomerType,@Comments, @InformationAssistantId,@EmployeeId,@WorkPlace)"; cmd.Parameters.AddWithValue("@CustomerId", customer.CustomerId); cmd.Parameters.AddWithValue("@CompanyName", customer.CompanyName); cmd.Parameters.AddWithValue("@ContactPerson", customer.ContactPerson); cmd.Parameters.AddWithValue("@ContactPersonNumber", customer.ContactPersonNumber); cmd.Parameters.AddWithValue("@ContactPerson2", customer.ContactPerson2); cmd.Parameters.AddWithValue("@ContactPerson2Number", customer.ContactPerson2Number); cmd.Parameters.AddWithValue("@ContactPerson3", customer.ContactPerson3); cmd.Parameters.AddWithValue("@ContactPerson3Number", customer.Contactperson3Number); cmd.Parameters.AddWithValue("@City", customer.City); cmd.Parameters.AddWithValue("@UsableArea", customer.UsableArea); cmd.Parameters.AddWithValue("@Email", customer.Email); cmd.Parameters.AddWithValue("@DecorationAddress", customer.DecorationAddress); cmd.Parameters.AddWithValue("@RidePath", customer.RidePath); cmd.Parameters.AddWithValue("@AppointDateTime", customer.AppointDateTime); cmd.Parameters.AddWithValue("@ProviderType", customer.ProviderType); cmd.Parameters.AddWithValue("@CustomerType", customer.CustomerType); cmd.Parameters.AddWithValue("@Comments", customer.Comments); cmd.Parameters.AddWithValue("@InformationAssistantId", customer.InformationAssistants.InformationAssistantId); cmd.Parameters.AddWithValue("@EmployeeId",customer.Employees.EmployeeId); cmd.Parameters.AddWithValue("@WorkPlace", customer.WorkPlace); cmd.ExecuteNonQuery(); cmd.CommandText = @"Insert into CustomerOrder values( @OrderNumber,@RecordDate, null,@OrderStatus,@CustomerOrderId,null,null,null)"; cmd.Parameters.AddWithValue("@OrderNumber", order.OrderNumber); cmd.Parameters.AddWithValue("@RecordDate", order.RecordDate); //cmd.Parameters.AddWithValue("@InformationAssistantOrderId", order.InformationAssistant.InformationAssistantId); cmd.Parameters.AddWithValue("@OrderStatus", order.OrderStatus); cmd.Parameters.AddWithValue("@CustomerOrderId", order.Customers.CustomerId); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { conn.Close(); cmd.Dispose(); tran.Dispose(); } } }
private void LoadOrderDetail(Order order) { if (!ParentPanel.Contains(orderDetail)) { orderDetail = new OrderDetailForManager(); orderDetail.Name = approvaler; orderDetail.ParentPanel = ParentPanel; orderDetail.NavigationBar = NavigationBar; orderDetail.employee = employee; orderDetail.Dock = DockStyle.Fill; ParentPanel.Controls.Add(orderDetail); } orderDetail.order = order; orderDetail.Show(); orderDetail.ClearContent(); orderDetail.employee = employee; orderDetail.LoadDetailInformation(); }
private void LoadApprovalOrderDetails(Order order) { if (!ParentPanel.Contains(approvalOrderDetail)) { approvalOrderDetail = new ApprovalOrderDetails(); approvalOrderDetail.Name = approvaler; approvalOrderDetail.ParentPanel = ParentPanel; approvalOrderDetail.NavigationBar = NavigationBar; approvalOrderDetail.employee = employee; approvalOrderDetail.Dock = DockStyle.Fill; ParentPanel.Controls.Add(approvalOrderDetail); } approvalOrderDetail.order = order; approvalOrderDetail.Show(); approvalOrderDetail.ClearContent(); approvalOrderDetail.employee = employee; approvalOrderDetail.LoadDetailInformation(); }
public void SaveCustomer(Customer customer,Order order) { addCustomerDao.SaveCustomer(customer, order); }
private void SaveCustomer() { Customer customer = new Customer(); customer.CustomerId = addcustomerManager.GetCustomId(); customer.CompanyName = txtCompany.Text; customer.AppointDateTime = decorateDate.Text; customer.City = city.Text; customer.Comments = txtComments.Text; customer.Contactperson3Number = txtContactPhone3.Text; customer.ContactPerson = txtContact.Text; customer.ContactPerson2 = txtContact2.Text; customer.ContactPerson2Number = txtContactPhone2.Text; customer.ContactPerson3 = txtContact3.Text; customer.ContactPersonNumber = txtContactPhone.Text; customer.UsableArea = txtAvaiableArea.Text; customer.RidePath = txtBusPath.Text; customer.WorkPlace = txtWorkPlace.Text; customer.Employees = employee; if (rbCustmoerTypeWork.Checked) { customer.CustomerType = "办公"; } else { customer.CustomerType = "商铺"; } customer.DecorationAddress = txtDecorateAddress.Text; customer.Email = txtEmail.Text; if (rbCooperator.Checked) { customer.ProviderType = "合作者"; } else { customer.ProviderType = "个人"; } customer.InformationAssistants = informationAssistant; Order order = new Order(); order.OrderNumber = customerTraceManager.GetOrderNumber(); order.OrderStatus = OrderStatus.Following; order.RecordDate = DateTime.Now; order.Customers = customer; addcustomerManager.SaveCustomer(customer, order); addcustomerManager.UpdateLevelToCopper(informationAssistant); }
public void AddOrderDescription(string description, Order order) { orderDao.AddOrderDescription(description, order); }
public void ModifyOrderStatus(Order order,Customer customer,string orderStatus) { order.OrderStatus = orderStatus; order.Customers = customer; modifyCustomerManager.UpdateCustomer(order); LoadDetailInformation(order.OrderId); lblMsg.Text = "修改客户信息成功,当前订单状态为" + order.OrderStatus; lblMsg.Show(); if (radioButtonSubmit.Checked) { GlobalFormValue.SalesManager.Add(order); } }
public void UpdateCustomer(Order order) { using (SqlConnection conn = new SqlConnection(DBHelper.GetConnection())) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); Customer customer = order.Customers; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.Transaction = tran; try { cmd.CommandText = @"update Customer set CompanyName =@CompanyName ,ContactPerson=@ContactPerson,ContactPersonNumber=@ContactPersonNumber, ContactPerson2=@ContactPerson2,ContactPerson2Number=@ContactPerson2Number, ContactPerson3=@ContactPerson3,ContactPerson3Number=@ContactPerson3Number, City=@City,UsableArea=@UsableArea,Email=@Email,DecorationAddress=@DecorationAddress, RidePath=@RidePath,AppointDateTime=@AppointDateTime,WorkPlace=@WorkPlace where CustomerId = @CustomerId"; cmd.Parameters.AddWithValue("@CustomerId", customer.CustomerId); cmd.Parameters.AddWithValue("@CompanyName", customer.CompanyName); cmd.Parameters.AddWithValue("@ContactPerson", customer.ContactPerson); cmd.Parameters.AddWithValue("@ContactPersonNumber", customer.ContactPersonNumber); cmd.Parameters.AddWithValue("@ContactPerson2", customer.ContactPerson2); cmd.Parameters.AddWithValue("@ContactPerson2Number", customer.ContactPerson2Number); cmd.Parameters.AddWithValue("@ContactPerson3", customer.ContactPerson3); cmd.Parameters.AddWithValue("@ContactPerson3Number", customer.Contactperson3Number); cmd.Parameters.AddWithValue("@City", customer.City); cmd.Parameters.AddWithValue("@UsableArea", customer.UsableArea); cmd.Parameters.AddWithValue("@Email", customer.Email); cmd.Parameters.AddWithValue("@DecorationAddress", customer.DecorationAddress); cmd.Parameters.AddWithValue("@RidePath", customer.RidePath); cmd.Parameters.AddWithValue("@AppointDateTime", customer.AppointDateTime); cmd.Parameters.AddWithValue("@WorkPlace",customer.WorkPlace); cmd.ExecuteNonQuery(); cmd.CommandText = @"update dbo.CustomerOrder set OrderStatus = @OrderStatus, SubmittedBy = 'SalesMan' where OrderId = @OrderId"; cmd.Parameters.AddWithValue("@OrderId",order.OrderId); cmd.Parameters.AddWithValue("@OrderStatus", order.OrderStatus); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { cmd.Dispose(); conn.Close(); } } }
public Order GetOrderById(int orderId) { using (SqlConnection conn = new SqlConnection(DBHelper.GetConnection())) { SqlCommand cmd = new SqlCommand(); Order order = new Order(); cmd.Connection = conn; cmd.CommandText = @"Select OrderNumber,RecordDate, DesignerId,OrderStatus,CustomerId from dbo.CustomerOrder where OrderId = @OrderId"; try { conn.Open(); cmd.Parameters.AddWithValue("@OrderId", orderId); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { order.OrderId = orderId; order.OrderNumber = reader.GetInt32(0); order.RecordDate = reader.GetDateTime(1); //order.InformationAssistant = editMessengerDao.GetInformationAssistantById(reader.GetInt32(2)); //order.Designer = empDao.GetEmployeeById(reader.GetString(3)); order.OrderStatus = reader.GetString(3); order.Customers = GetCustomerById(reader.GetInt32(4)); } } catch (Exception ex) { throw ex; } finally { conn.Close(); cmd.Dispose(); } return order; } }
public void UpdateCustomer(Order order) { modifyCustomerDAO.UpdateCustomer(order); }
private void btnSubmit_Click(object sender, EventArgs e) { if (order.OrderStatus == OrderStatus.SubmittedNotAllowed) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.SubmittedNotAllowedForMarketing); } if (order.OrderStatus == OrderStatus.SubmittedNotSignedForDesign) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.SubmittedNotSignedForMarketing); } if (order.OrderStatus == OrderStatus.SubmittedSignedForDesign) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.SubmittedSignedForMarketing); } if (order.OrderStatus == OrderStatus.SubmittedNotAllowedForMarketing) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.Denied); } if (order.OrderStatus == OrderStatus.SubmittedNotSignedForMarketing) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.NotSigned); } if (order.OrderStatus == OrderStatus.SubmittedSignedForMarketing) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.Signed); iaManager.UpdateLevelToGold(order.Customers.InformationAssistants); } if (order.SubmittedBy == SubmittedBy.Designer) { orderManager.UpdateOrderStatus(order.OrderId, order.OrderStatus, SubmittedBy.DesignerManager); lblMsg.Text = "*设计部经理审批" + order.OrderStatus; } else if (order.SubmittedBy == SubmittedBy.DesignerManager) { if (order.OrderStatus == OrderStatus.SubmittedNotAllowed) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.Denied, SubmittedBy.MarketingManager); } if (order.OrderStatus == OrderStatus.SubmittedNotSigned) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.NotSigned, SubmittedBy.MarketingManager); } if (order.OrderStatus == OrderStatus.SubmittedSigned) { orderManager.UpdateOrderStatus(order.OrderId, OrderStatus.Signed, SubmittedBy.MarketingManager); } order = orderManager.GetOrderById(order.OrderId); lblMsg.Text = "*市场部经理审批" + order.OrderStatus; } order = orderManager.GetOrderById(order.OrderId); lblMsg.Visible = true; }