private void SuppierGroupDelete_Click(object sender, EventArgs e) { if (MessageBoxExtend.messageQuestion("确定删除[" + m_customerGroupName + "]分组信息吗?")) { if (m_customerRecordCount > 0) { MessageBoxExtend.messageWarning("[" + m_customerGroupName + "] 删除失败,请先删除客户记录然后重试."); } else { CustomerType.getInctance().delete(m_customerGroupPkey); CustomerOrgStruct.getInctance().delete(CustomerOrgStruct.getInctance().getPkeyFromValue(m_customerGroupPkey)); refreshTreeView(); } } }
private void processDutyOrgNode(int parentID, TreeNode node) { string nodeName = ""; TreeNode currentNode; ArrayList nodeList = CustomerOrgStruct.getInctance().getNodesFormParentID(parentID); for (int i = 0; i < nodeList.Count; i++) { CustomerOrgStructTable record = (CustomerOrgStructTable)nodeList[i]; nodeName = CustomerType.getInctance().getCustomerTypeNameFromPkey(record.value); currentNode = m_tree.addNode(node, nodeName, 0, 1, Convert.ToString(record.value)); processDutyOrgNode(record.pkey, currentNode); } }
private void refreshTreeView() { if (m_tree != null && treeViewMaterielOrg.Nodes.Count > 0) { treeViewMaterielOrg.Nodes.Clear(); } m_tree = new TreeViewExtend(this.treeViewMaterielOrg); if (m_type == 1) { int rootNodePkey = MaterielOrgStruct.getInctance().getRootNodePkey(); int rooNodeValue = MaterielOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey); string rootName = MaterielType.getInctance().getMaterielTypeNameFromPkey(rooNodeValue); m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName); processDutyOrgNodeMateriel(rootNodePkey, m_rootNode); } else if (m_type == 2) { int rootNodePkey = CustomerOrgStruct.getInctance().getRootNodePkey(); int rooNodeValue = CustomerOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey); string rootName = CustomerType.getInctance().getCustomerTypeNameFromPkey(rooNodeValue); m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName); processDutyOrgNodeCustomer(rootNodePkey, m_rootNode); } else if (m_type == 3) { int rootNodePkey = SupplierOrgStruct.getInctance().getRootNodePkey(); int rooNodeValue = SupplierOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey); string rootName = SupplierType.getInctance().getSupplierTypeNameFromPkey(rooNodeValue); m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName); processDutyOrgNodeSupplier(rootNodePkey, m_rootNode); } m_rootNode.Expand(); }
private SortedDictionary <int, CustomerTable> getCurrentNodeAllChildNodesCustomer() { SortedDictionary <int, CustomerTable> customerList = new SortedDictionary <int, CustomerTable>(); SortedDictionary <int, int> childNodeValues = CustomerOrgStruct.getInctance().getAllChildNodeValue(m_customerGroupPkey); if (!childNodeValues.ContainsKey(m_customerGroupPkey)) { childNodeValues.Add(m_customerGroupPkey, m_customerGroupPkey); } foreach (KeyValuePair <int, int> index in childNodeValues) { SortedDictionary <int, CustomerTable> temp = Customer.getInctance().getCustomerInfoFromCustomerType(index.Value); foreach (KeyValuePair <int, CustomerTable> i in temp) { CustomerTable customer = new CustomerTable(); customerList.Add(customerList.Count, (CustomerTable)i.Value); } } return(customerList); }
private void addCustomerType() { CustomerTypeTable customerType = new CustomerTypeTable(); customerType.name = this.textBoxCustomerGroupName.Text.ToString(); customerType.desc = this.textBoxCustomerGroupDesc.Text.ToString(); if (customerType.name.Length == 0) { MessageBoxExtend.messageWarning("组名称不能为空,请重新填写!"); return; } CustomerType.getInctance().insert(customerType); // 客户组织结构 CustomerOrgStructTable customerOrgInfo = new CustomerOrgStructTable(); customerOrgInfo.parentPkey = CustomerOrgStruct.getInctance().getPkeyFromValue(m_customerGroupPkey); customerOrgInfo.value = CustomerType.getInctance().getMaxPkey(); CustomerOrgStruct.getInctance().insert(customerOrgInfo); }