private void ChangeAttribute(EntityAttribute attribute, string action) { var att_to_edit = attribute as EntityAttribute; if (att_to_edit != null) { var notification = new ItemEditNotification(att_to_edit); notification.Title = action + " Attribute"; EditAttributeRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { var att = r.EditibleObject as EntityAttribute; if (att != null) { var att_to_change = AttSelectedItem as EntityAttributeWrapper; if (att_to_change != null) { att_to_change.AttributeValue = att.AttributeValue; } } } }); } }
private void ChangeContact(Contact contact, string action) { if (contact is Contact emp_to_edit) { var notification = new ItemEditNotification(emp_to_edit); notification.Title = action + " Contact"; EditContactRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { if (r.EditibleObject is Contact cnt) { if (action == ApplicationStrings.NotificationEdit) { if (ContactSelectedItem is ContactWrapper cnt_to_change) { cnt_to_change.ContactActiveFlg = cnt.ContactActiveFlg; cnt_to_change.ContactDefaultFlg = cnt.ContactDefaultFlg; cnt_to_change.ContactTypeKey = cnt.ContactTypeKey; cnt_to_change.ContactType = cnt.ContactType; cnt_to_change.ContactValue = cnt.ContactValue; } } else { Account.Contacts.Add(new ContactWrapper(cnt)); } } } }); } }
private void ChangeComment(Comment comment, string action) { if (comment is Comment emp_to_edit) { var notification = new ItemEditNotification(emp_to_edit); notification.Title = action + " Comment"; EditCommentRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { if (r.EditibleObject is Comment comm) { if (action == ApplicationStrings.NotificationEdit) { if (CommentSelectedItem is CommentWrapper comm_to_change) { comm_to_change.CommentType = comm.CommentType; comm_to_change.CommentValue = comm.CommentValue; } } else { Account.Comments.Add(new CommentWrapper(comm)); } } } }); } }
private void ChangeOrderItem(OrderItem order_item, string action) { //var item_to_edit = order_item as OrderItem; if (order_item != null) { GridIsEnabled = false; var bill_addresses = _currentAccount.Addresses.Where(item => item.AddressType == QIQOAddressType.Billing).ToList(); var ship_addresses = _currentAccount.Addresses.Where(item => item.AddressType == QIQOAddressType.Shipping).ToList(); Tuple <object, object, object> needed_objects = new Tuple <object, object, object>(order_item, bill_addresses, ship_addresses); ItemEditNotification notification = new ItemEditNotification(needed_objects); notification.Title = action + " Order Item"; //+ emp_to_edit.PersonCode + " - " + emp_to_edit.PersonFullNameFML; EditOrderItemRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { OrderItem obj = r.EditibleObject as OrderItem; if (obj != null) { if (action == ApplicationStrings.NotificationEdit) { var changed_prod = ProductList.Where(item => item.ProductKey == obj.ProductKey).FirstOrDefault(); var item_to_update = SelectedOrderItem as OrderItemWrapper; item_to_update.ProductKey = obj.ProductKey; item_to_update.ProductCode = changed_prod.ProductCode; item_to_update.ProductName = obj.ProductName; item_to_update.ProductDesc = obj.ProductDesc; item_to_update.OrderItemQuantity = obj.OrderItemQuantity; item_to_update.ItemPricePer = obj.ItemPricePer; item_to_update.OrderItemLineSum = order_item.OrderItemQuantity * order_item.ItemPricePer; item_to_update.OrderItemStatus = obj.OrderItemStatus; item_to_update.OrderItemProduct.ProductKey = obj.ProductKey; item_to_update.OrderItemProduct.ProductCode = changed_prod.ProductCode; item_to_update.OrderItemProduct.ProductDesc = obj.ProductDesc; item_to_update.OrderItemProduct.ProductName = obj.ProductName; item_to_update.OrderItemBillToAddress.AddressKey = obj.OrderItemBillToAddress.AddressKey; item_to_update.OrderItemShipToAddress.AddressKey = obj.OrderItemShipToAddress.AddressKey; item_to_update.SalesRep.EntityPersonKey = obj.SalesRep.EntityPersonKey; item_to_update.AccountRep.EntityPersonKey = obj.AccountRep.EntityPersonKey; item_to_update.OrderItemShipDate = obj.OrderItemShipDate; item_to_update.OrderItemCompleteDate = obj.OrderItemCompleteDate; } else { Order.OrderItems.Add(new OrderItemWrapper(obj)); } UpdateItemTotals(); } } }); GridIsEnabled = true; } }
private void ChangeFeeSchedule(FeeSchedule schedule, string action) { var fee_to_edit = schedule as FeeSchedule; if (fee_to_edit != null) { ItemEditNotification notification = new ItemEditNotification(fee_to_edit); notification.Title = action + " Fee Schedule"; //+ emp_to_edit.PersonCode + " - " + emp_to_edit.PersonFullNameFML; EditFeeScheduledRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { FeeSchedule fee = r.EditibleObject as FeeSchedule; if (fee != null) { // We need to actually add the fee shedule to something if (action == ApplicationStrings.NotificationEdit) { var fee_to_change = FeeSelectedItem as FeeScheduleWrapper; if (fee_to_change != null) { //fee_to_change.CompanyKey = fee.CompanyKey; //fee_to_change.FeeScheduleKey = fee.FeeScheduleKey; fee_to_change.FeeScheduleStartDate = fee.FeeScheduleStartDate; fee_to_change.FeeScheduleEndDate = fee.FeeScheduleEndDate; fee_to_change.FeeScheduleTypeCode = fee.FeeScheduleTypeCode; fee_to_change.FeeScheduleValue = fee.FeeScheduleValue; //fee_to_change.AccountKey = fee.AccountKey; //fee_to_change.Product.ProductCode = fee.Product.ProductCode; //fee_to_change.Product.ProductDesc = fee.Product.ProductDesc; //fee_to_change.Product.ProductKey = fee.Product.ProductKey; fee_to_change.ProductCode = fee.ProductCode; fee_to_change.ProductDesc = fee.ProductDesc; fee_to_change.ProductKey = fee.ProductKey; } } else { Account.FeeSchedules.Add(new FeeScheduleWrapper(fee)); } } } }); } }
private void ChangeEmployee(Employee employee, string action) { var emp_to_edit = employee as Employee; if (emp_to_edit != null) { var supervisors = Company.Employees.Where(emp => emp.RoleInCompany == Roles.QIQORoleOwner || emp.RoleInCompany == Roles.QIQORoleManager).ToList(); Tuple <object, object> needed_objects = new Tuple <object, object>(emp_to_edit, supervisors); ItemEditNotification notification = new ItemEditNotification(needed_objects); //ItemEditNotification notification = new ItemEditNotification(emp_to_edit); notification.Title = action + " Employee"; //+ emp_to_edit.PersonCode + " - " + emp_to_edit.PersonFullNameFML; EditEmployeeRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { Employee emp = r.EditibleObject as Employee; if (emp != null) { if (action == ApplicationStrings.NotificationEdit) { var emp_to_change = EmpSelectedItem as EmployeeWrapper; if (emp_to_change != null) { emp_to_change.Comment = emp.Comment; emp_to_change.CompanyRoleType = emp.CompanyRoleType; emp_to_change.EndDate = emp.EndDate; emp_to_change.StartDate = emp.StartDate; emp_to_change.PersonCode = emp.PersonCode; emp_to_change.PersonDOB = emp.PersonDOB; emp_to_change.PersonFirstName = emp.PersonFirstName; emp_to_change.PersonLastName = emp.PersonLastName; emp_to_change.PersonMI = emp.PersonMI; emp_to_change.RoleInCompany = emp.RoleInCompany; } } else { Company.Employees.Add(new EmployeeWrapper(emp)); } } } }); } }
private void ChangeEmployee(AccountPerson employee, string action) { var emp_to_edit = employee as AccountPerson; if (emp_to_edit != null) { ItemEditNotification notification = new ItemEditNotification(emp_to_edit); notification.Title = action + " Account Employee"; //+ emp_to_edit.PersonCode + " - " + emp_to_edit.PersonFullNameFML; EditAccountPersonRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { AccountPerson emp = r.EditibleObject as AccountPerson; if (emp != null) { if (action == ApplicationStrings.NotificationEdit) { var emp_to_change = EmpSelectedItem as AccountPersonWrapper; if (emp_to_change != null) { emp_to_change.Comment = emp.Comment; emp_to_change.CompanyRoleType = emp.CompanyRoleType; emp_to_change.EndDate = emp.EndDate; emp_to_change.StartDate = emp.StartDate; emp_to_change.PersonCode = emp.PersonCode; emp_to_change.PersonDOB = emp.PersonDOB; emp_to_change.PersonFirstName = emp.PersonFirstName; emp_to_change.PersonLastName = emp.PersonLastName; emp_to_change.PersonMI = emp.PersonMI; emp_to_change.RoleInCompany = emp.RoleInCompany; } } else { Account.Employees.Add(new AccountPersonWrapper(emp)); } } } }); } }
private void ChangeAttribute(EntityAttribute attribute, string action) { if (attribute is EntityAttribute att_to_edit) { var notification = new ItemEditNotification(att_to_edit); notification.Title = action + " Attribute"; //+ emp_to_edit.PersonCode + " - " + emp_to_edit.PersonFullNameFML; EditAttributeRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { if (r.EditibleObject is EntityAttribute att) { if (AttSelectedItem is EntityAttributeWrapper att_to_change) { att_to_change.AttributeValue = att.AttributeValue; } } } }); } }
private void ChangeChartOfAccount(ChartOfAccount coa, string action) { var coa_to_edit = coa as ChartOfAccount; if (coa_to_edit != null) { ItemEditNotification notification = new ItemEditNotification(coa_to_edit); notification.Title = action + " Chart Of Account"; EditChartOfAccountRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.EditibleObject != null) // { ChartOfAccount coa_changed = r.EditibleObject as ChartOfAccount; if (coa_changed != null) { if (action == ApplicationStrings.NotificationEdit) { var coa_to_change = COASelectedItem as ChartOfAccountWrapper; if (coa_to_change != null) { coa_to_change.BalanceType = coa_changed.BalanceType; coa_to_change.BankAccountFlag = coa_changed.BankAccountFlag; coa_to_change.AccountName = coa_changed.AccountName; coa_to_change.AccountNo = coa_changed.AccountNo; coa_to_change.AccountType = coa_changed.AccountType; } } else { Company.GLAccounts.Add(new ChartOfAccountWrapper(coa_changed)); } } } }); } }