示例#1
0
        protected override void ShowItemInGridViewRow(DataGridViewRow row, object item)
        {
            RelatedCompanyType ct = item as RelatedCompanyType;

            row.Cells["colName"].Value = ct.Name;
            row.Cells["colMemo"].Value = ct.Memo;
        }
        private TreeNode AddNode(RelatedCompanyType pc, TreeNode parent)
        {
            TreeNode node = parent.Nodes.Add(string.Format("{0}", pc.Name));

            node.Tag = pc;
            return(node);
        }
示例#3
0
        protected override void ItemShowing()
        {
            RelatedCompanyType ct = UpdatingItem as RelatedCompanyType;

            txtName.Text = ct.Name;
            if (!string.IsNullOrEmpty(ct.Parent))
            {
                ParentCategory = (new RelatedCompanyTypeBLL(AppSettings.Current.ConnStr)).GetByID(ct.Parent).QueryObject;
            }
            txtMemo.Text = ct.Memo;
        }
示例#4
0
        private void lnkParentCategory_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmRelatedCompanyTypeMaster frm = new FrmRelatedCompanyTypeMaster();

            frm.ForSelect = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                ParentCategory = frm.SelectedItem as RelatedCompanyType;
                this.txtParentCategory.Text = ParentCategory != null ? ParentCategory.Name : string.Empty;
            }
        }
        private void mnu_CategoryProperty_Click(object sender, EventArgs e)
        {
            RelatedCompanyType          pc  = categoryTree.SelectedNode.Tag as RelatedCompanyType;
            FrmRelatedCompanyTypeDetail frm = new FrmRelatedCompanyTypeDetail();

            frm.IsAdding     = false;
            frm.UpdatingItem = pc;
            frm.ItemUpdated += delegate(object obj, ItemUpdatedEventArgs args)
            {
                categoryTree.SelectedNode.Text = string.Format("{0}", pc.Name);
            };
            frm.ShowDialog();
        }
示例#6
0
        protected override Object GetItemFromInput()
        {
            RelatedCompanyType ct = UpdatingItem as RelatedCompanyType;

            if (IsAdding)
            {
                ct    = new RelatedCompanyType();
                ct.ID = txtName.Text;
            }
            ct.Name   = txtName.Text;
            ct.Parent = ParentCategory != null ? ParentCategory.ID : null;
            ct.Memo   = txtMemo.Text;
            return(ct);
        }
        private void mnu_AddCategory_Click(object sender, EventArgs e)
        {
            RelatedCompanyType          pc  = categoryTree.SelectedNode.Tag as RelatedCompanyType;
            FrmRelatedCompanyTypeDetail frm = new FrmRelatedCompanyTypeDetail();

            frm.IsAdding       = true;
            frm.ParentCategory = pc;
            frm.ItemAdded     += delegate(object obj, ItemAddedEventArgs args)
            {
                RelatedCompanyType item = args.AddedItem as RelatedCompanyType;
                AddNode(item, categoryTree.SelectedNode);
            };
            frm.ShowDialog();
        }
        private void mnu_DeleteCategory_Click(object sender, EventArgs e)
        {
            RelatedCompanyType pc = categoryTree.SelectedNode.Tag as RelatedCompanyType;

            if (pc != null && MessageBox.Show("是否删除此类别及其子项?", "询问", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
            {
                CommandResult ret = (new RelatedCompanyTypeBLL(AppSettings.Current.ConnStr)).Delete(pc);
                if (ret.Result == ResultCode.Successful)
                {
                    categoryTree.SelectedNode.Parent.Nodes.Remove(categoryTree.SelectedNode);
                }
                else
                {
                    MessageBox.Show(ret.Message);
                }
            }
        }
        private List <object> GetSelectedNodeItems()
        {
            List <CompanyInfo> items = _Customers;
            RelatedCompanyType pc    = null;

            if (this.categoryTree.SelectedNode != null)
            {
                pc = this.categoryTree.SelectedNode.Tag as RelatedCompanyType;
            }
            if (pc != null)
            {
                items = _Customers.Where(it => it.CategoryID == pc.ID).ToList();
            }

            return((from p in items
                    orderby p.Name ascending
                    select(object) p).ToList());
        }
示例#10
0
        protected override void ItemShowing()
        {
            CompanyInfo c = UpdatingItem as CompanyInfo;

            if (c != null)
            {
                txtID.Text = c.ID;
                if (!string.IsNullOrEmpty(c.CategoryID))
                {
                    Category         = (new RelatedCompanyTypeBLL(AppSettings.Current.ConnStr)).GetByID(c.CategoryID).QueryObject;
                    txtCategory.Text = Category != null ? Category.Name : string.Empty;
                }
                txtNation.Text     = c.Nation;
                txtName.Text       = c.Name;
                txtTelephone.Text  = c.TelPhone;
                txtFax.Text        = c.Fax;
                txtPostalCode.Text = c.PostalCode;
                txtAddress.Text    = c.Address;
                txtMemo.Text       = c.Memo;
            }
            txtID.Enabled = (c == null);

            GridView.Rows.Clear();
            ContactSearchCondition con = new ContactSearchCondition()
            {
                CompanyID = c.ID
            };
            List <Contact> contacts = (new ContactBLL(AppSettings.Current.ConnStr)).GetItems(con).QueryObjects;

            if (contacts != null && contacts.Count > 0)
            {
                foreach (Contact contact in contacts)
                {
                    int row = GridView.Rows.Add();
                    ShowItemOnRow(GridView.Rows[row], contact);
                }
            }
        }
示例#11
0
 private void txtCategory_DoubleClick(object sender, EventArgs e)
 {
     Category         = null;
     txtCategory.Text = Category != null ? Category.Name : string.Empty;
 }
示例#12
0
 private void txtParentCategory_DoubleClick(object sender, EventArgs e)
 {
     ParentCategory = null;
     this.txtParentCategory.Text = ParentCategory != null ? ParentCategory.Name : string.Empty;
 }