protected override List <Contact> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <Contact> ret = dc.GetTable <Contact>();

            if (search is ContactSearchCondition)
            {
                ContactSearchCondition con = search as ContactSearchCondition;
                if (!string.IsNullOrEmpty(con.CompanyID))
                {
                    ret = ret.Where(item => item.Company == con.CompanyID);
                }
            }
            List <Contact> cs = ret.ToList();

            return(cs);
        }
Esempio n. 2
0
        protected override void ItemShowing()
        {
            CompanyInfo c = UpdatingItem as CompanyInfo;

            txtID.Enabled = (c == null);
            if (c != null)
            {
                txtID.Text = c.ID;
                if (!string.IsNullOrEmpty(c.CategoryID))
                {
                    Category = (new SupplierTypeBLL(AppSettings.Current.ConnStr)).GetByID(c.CategoryID).QueryObject;
                }
                this.txtCategory.Text = Category != null ? Category.Name : string.Empty;
                txtNation.Text        = c.Nation;
                txtName.Text          = c.Name;
                txtNation.Text        = c.Nation;
                txtCity.Text          = c.City;
                txtTelphone.Text      = c.TelPhone;
                txtFax.Text           = c.Fax;
                txtPost.Text          = c.PostalCode;
                txtWeb.Text           = c.Website;
                txtAddress.Text       = c.Address;
                txtMemo.Text          = c.Memo;
            }

            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);
                }
            }
            ShowAttachmentHeaders(c.ID, c.DocumentType, this.gridAttachment);
        }
Esempio n. 3
0
 private void lnkLinker_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (Customer != null)
     {
         FrmContactMaster       frm = new FrmContactMaster();
         ContactSearchCondition con = new ContactSearchCondition();
         con.CompanyID       = Customer.ID;
         frm.SearchCondition = con;
         frm.ForSelect       = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             Contact c = frm.SelectedItem as Contact;
             txtLinker.Text      = c.Name;
             txtLinkerPhone.Text = c.Mobile;
         }
     }
     else
     {
         MessageBox.Show("请先选择客户");
     }
 }