private void LoadOptions() { ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable().DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = 0; //cboGroup.Items.Count - 1; cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(ContactGroupCategory.CUSTOMER.ToString("d"))); Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable().DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; Salutation clsSalutation = new Salutation(clsContactGroup.Connection, clsContactGroup.Transaction); cboSalutation.DataTextField = "SalutationName"; cboSalutation.DataValueField = "SalutationCode"; cboSalutation.DataSource = clsSalutation.ListAsDataTable().DefaultView; cboSalutation.DataBind(); cboSalutation.SelectedIndex = 0; cboSalutation.SelectedIndex = cboSalutation.Items.IndexOf(cboSalutation.Items.FindByValue("MR")); Contacts clsContacts = new Contacts(clsContactGroup.Connection, clsContactGroup.Transaction); cboSoldBy.DataTextField = "ContactName"; cboSoldBy.DataValueField = "ContactCode"; cboSoldBy.DataSource = clsContacts.AgentsAsDataTable(SortField: "ContactName").DefaultView; cboSoldBy.DataBind(); cboSoldBy.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsContactGroup.Connection, clsContactGroup.Transaction); cboConfirmedBy.DataTextField = "Name"; cboConfirmedBy.DataValueField = "Name"; cboConfirmedBy.DataSource = clsAccessUser.ListAsDataTable(SortField: "Name").DefaultView; cboConfirmedBy.DataBind(); cboConfirmedBy.SelectedIndex = 0; Security.Country clsCountry = new Security.Country(clsContactGroup.Connection, clsContactGroup.Transaction); cboCountry.DataTextField = "CountryName"; cboCountry.DataValueField = "CountryID"; cboCountry.DataSource = clsCountry.ListAsDataTable().DefaultView; cboCountry.DataBind(); cboCountry.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); }
private void LoadOptions() { ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable().DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable().DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); }
public void LoadContactGroups() { var contactGroup1 = new ContactGroup() { ContactGroupId = 1, ContactGroupName = "TestGroup1" }; var contactGroup2 = new ContactGroup() { ContactGroupId = 2, ContactGroupName = "TestGroup2" }; var contactGroup3 = new ContactGroup() { ContactGroupId = 3, ContactGroupName = "TestGroup3" }; var contactGroup4 = new ContactGroup() { ContactGroupId = 4, ContactGroupName = "TestGroup3" }; ContactGroups.Add(contactGroup1); ContactGroups.Add(contactGroup2); ContactGroups.Add(contactGroup3); ContactGroups.Add(contactGroup4); }
private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); if (chkList != null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { ContactGroups clsContactGroup = new ContactGroups(); clsContactGroup.Delete(stIDs.Substring(0, stIDs.Length - 1)); clsContactGroup.CommitAndDispose(); } return(boRetValue); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Contacts clsContact = new Contacts(); cboContactCode.DataTextField = "ContactCode"; cboContactCode.DataValueField = "ContactCode"; cboContactCode.DataSource = clsContact.ListAsDataTable("ContactCode", SortOption.Ascending); cboContactCode.DataBind(); cboContactCode.Items.Add(new ListItem("All Codes", "0")); cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1; cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactName"; cboContactName.DataSource = clsContact.ListAsDataTable("ContactName", SortOption.Ascending); cboContactName.DataBind(); cboContactName.Items.Add(new ListItem("All Contacts", "0")); cboContactName.SelectedIndex = cboContactName.Items.Count - 1; clsContact.CommitAndDispose(); ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.List("ContactGroupName", SortOption.Ascending)); cboGroup.DataBind(); cboGroup.Items.Add(new ListItem("All Contact Groups", "0")); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; clsContactGroup.CommitAndDispose(); cboDeleted.SelectedIndex = cboDeleted.Items.Count - 1; }
public async Task <ActionResult <ContactGroups> > AddContactGroup(ContactGroups contactGroup) { contactGroup.ContactGroupID = ContactGroupID + 1; _context.ContactGroups.Add(contactGroup); await _context.SaveChangesAsync(); return(StatusCode(201)); }
private void LoadRecord() { Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); ContactGroups clsContactGroup = new ContactGroups(); ContactGroupDetails clsDetails = clsContactGroup.Details(iID); clsContactGroup.CommitAndDispose(); lblContactGroupID.Text = clsDetails.ContactGroupID.ToString(); txtContactGroupCode.Text = clsDetails.ContactGroupCode; txtContactGroupName.Text = clsDetails.ContactGroupName; cboContactGroupCategory.SelectedIndex = Convert.ToInt16(clsDetails.ContactGroupCategory) - 1; }
private void SaveRecord() { ContactGroupDetails clsDetails = new ContactGroupDetails(); clsDetails.ContactGroupID = Convert.ToInt16(lblContactGroupID.Text); clsDetails.ContactGroupCode = txtContactGroupCode.Text; clsDetails.ContactGroupName = txtContactGroupName.Text; clsDetails.ContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), cboContactGroupCategory.SelectedItem.Value); ContactGroups clsContactGroup = new ContactGroups(); clsContactGroup.Update(clsDetails); clsContactGroup.CommitAndDispose(); }
private Int32 SaveRecord() { ContactGroupDetails clsDetails = new ContactGroupDetails(); clsDetails.ContactGroupCode = txtContactGroupCode.Text; clsDetails.ContactGroupName = txtContactGroupName.Text; clsDetails.ContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), cboContactGroupCategory.SelectedItem.Value); ContactGroups clsContactGroup = new ContactGroups(); Int32 id = clsContactGroup.Insert(clsDetails); clsContactGroup.CommitAndDispose(); return(id); }
/// <summary> /// Loads the address book from the specified reader. /// </summary> protected override void Load(TextReader reader) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(reader); foreach (XmlElement contactGroupElem in xmlDoc.DocumentElement.SelectNodes("ContactGroup")) { ContactGroup contactGroup = new ContactGroup(contactGroupElem.GetAttribute("name")) { Parent = this }; foreach (XmlElement contactElem in contactGroupElem.SelectNodes("Contact")) { Contact contact = new Contact(contactElem.GetAttribute("name")) { Parent = contactGroup }; foreach (XmlElement phoneNumberElem in contactElem.SelectNodes("PhoneNumber")) { contact.ContactItems.Add( new PhoneNumber(phoneNumberElem.InnerText) { Parent = contact }); } foreach (XmlElement emailElem in contactElem.SelectNodes("Email")) { contact.ContactItems.Add( new Email(emailElem.InnerText) { Parent = contact }); } contact.ContactItems.Sort(); contactGroup.Contacts.Add(contact); } contactGroup.Contacts.Sort(); ContactGroups.Add(contactGroup); } ContactGroups.Sort(); }
private void LoadOptions() { ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER).DefaultView; cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "0")); cboGroup.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); cboModeOfTerms.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "-1")); cboModeOfTerms.SelectedIndex = 0; }
private void LoadOptions() { cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCredit, ReportTypes.CustomerCredit)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditBill, ReportTypes.CustomerCreditBill)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditListWCredit, ReportTypes.CustomerCreditListWCredit)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditListLatestBill, ReportTypes.CustomerCreditListLatestBill)); cboReportType.SelectedIndex = 0; Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, true, "ContactName", SortOption.Ascending); cboContactName.DataBind(); cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboContactName.Items.Count > 1 && txtContactName.Text.Trim() != string.Empty) { cboContactName.SelectedIndex = 1; } else { cboContactName.SelectedIndex = 0; } ContactGroups clsContactGroup = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction); cboCustomerGroup.DataTextField = "ContactGroupName"; cboCustomerGroup.DataValueField = "ContactGroupCode"; cboCustomerGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER); cboCustomerGroup.DataBind(); cboCustomerGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboCustomerGroup.Items.Count > 1 && txtCustomerGroup.Text.Trim() != string.Empty) { cboCustomerGroup.SelectedIndex = 1; } else { cboCustomerGroup.SelectedIndex = 0; } clsCustomer.CommitAndDispose(); }
//protected void imgTerminalNoSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) //{ // Terminal clsTerminal = new Terminal(); // cboTerminalNo.DataTextField = "TerminalNo"; // cboTerminalNo.DataValueField = "TerminalNo"; // cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(txtTerminalNo.Text); // cboTerminalNo.DataBind(); // cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); // if (cboTerminalNo.Items.Count > 1 && txtTerminalNo.Text.Trim() != string.Empty) cboTerminalNo.SelectedIndex = 1; else cboTerminalNo.SelectedIndex = 0; // clsTerminal.CommitAndDispose(); //} protected void imgContactGroupNameSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { ContactGroups clsContactGroups = new ContactGroups(); cboContactGroupName.DataTextField = "ContactGroupName"; cboContactGroupName.DataValueField = "ContactGroupID"; cboContactGroupName.DataSource = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text); cboContactGroupName.DataBind(); clsContactGroups.CommitAndDispose(); if (string.IsNullOrEmpty(txtContactName.Text)) { cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); } else { cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactGroupName.Text, Constants.ZERO_STRING)); } cboContactGroupName.SelectedIndex = 0; }
protected void imgCustomerGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { ContactGroups clsContactGroup = new ContactGroups(); cboCustomerGroup.DataTextField = "ContactGroupName"; cboCustomerGroup.DataValueField = "ContactGroupCode"; cboCustomerGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtCustomerGroup.Text.TrimEnd()); cboCustomerGroup.DataBind(); cboCustomerGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboCustomerGroup.Items.Count > 1 && txtCustomerGroup.Text.Trim() != string.Empty) { cboCustomerGroup.SelectedIndex = 1; } else { cboCustomerGroup.SelectedIndex = 0; } clsContactGroup.CommitAndDispose(); }
private void LoadOptions() { ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER).DefaultView; cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; cboBirthMonth.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboBirthMonth.Items.Add(new ListItem("January", "1")); cboBirthMonth.Items.Add(new ListItem("February", "2")); cboBirthMonth.Items.Add(new ListItem("March", "3")); cboBirthMonth.Items.Add(new ListItem("April", "4")); cboBirthMonth.Items.Add(new ListItem("May", "5")); cboBirthMonth.Items.Add(new ListItem("June", "6")); cboBirthMonth.Items.Add(new ListItem("July", "7")); cboBirthMonth.Items.Add(new ListItem("August", "8")); cboBirthMonth.Items.Add(new ListItem("September", "9")); cboBirthMonth.Items.Add(new ListItem("October", "10")); cboBirthMonth.Items.Add(new ListItem("November", "11")); cboBirthMonth.Items.Add(new ListItem("December", "12")); cboBirthMonth.SelectedIndex = DateTime.Now.Month; cboAnniversaryMonth.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboAnniversaryMonth.Items.Add(new ListItem("January", "1")); cboAnniversaryMonth.Items.Add(new ListItem("February", "2")); cboAnniversaryMonth.Items.Add(new ListItem("March", "3")); cboAnniversaryMonth.Items.Add(new ListItem("April", "4")); cboAnniversaryMonth.Items.Add(new ListItem("May", "5")); cboAnniversaryMonth.Items.Add(new ListItem("June", "6")); cboAnniversaryMonth.Items.Add(new ListItem("July", "7")); cboAnniversaryMonth.Items.Add(new ListItem("August", "8")); cboAnniversaryMonth.Items.Add(new ListItem("September", "9")); cboAnniversaryMonth.Items.Add(new ListItem("October", "10")); cboAnniversaryMonth.Items.Add(new ListItem("November", "11")); cboAnniversaryMonth.Items.Add(new ListItem("December", "12")); cboAnniversaryMonth.SelectedIndex = 0; }
protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); string stParam = string.Empty; switch (e.CommandName) { case "imgItemDelete": ContactGroups clsContactGroup = new ContactGroups(); clsContactGroup.Delete(chkList.Value); clsContactGroup.CommitAndDispose(); LoadList(); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; } }
private void LoadOptions() { lblContactID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID); ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable().DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable("DepartmentName", SortOption.Ascending, 0).DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; Billing clsBilling = new Billing(clsContactGroup.Connection, clsContactGroup.Transaction); cboBillingDate.DataTextField = "BillingDate"; cboBillingDate.DataValueField = "BillingFile"; cboBillingDate.DataSource = clsBilling.ListBillingDateAsDataTable(long.Parse(lblContactID.Text)).DefaultView; cboBillingDate.DataBind(); cboBillingDate.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT)); cboBillingDate.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); }
public void SummarizeErrors(bool summarize) { Accounts.SummarizeErrors(summarize); BankTransactions.SummarizeErrors(summarize); BankTransfers.SummarizeErrors(summarize); Contacts.SummarizeErrors(summarize); ContactGroups.SummarizeErrors(summarize); CreditNotes.SummarizeErrors(summarize); Employees.SummarizeErrors(summarize); Employees.SummarizeErrors(summarize); Files.SummarizeErrors(summarize); Folders.SummarizeErrors(summarize); Inbox.SummarizeErrors(summarize); Invoices.SummarizeErrors(summarize); Items.SummarizeErrors(summarize); LinkedTransactions.SummarizeErrors(summarize); ManualJournals.SummarizeErrors(summarize); Payments.SummarizeErrors(summarize); PurchaseOrders.SummarizeErrors(summarize); Receipts.SummarizeErrors(summarize); TaxRates.SummarizeErrors(summarize); TrackingCategories.SummarizeErrors(summarize); }
protected void btnFind_Click(object sender, EventArgs e) { var findedContactGroups = ActiveRecordBase <ContactGroup> .FindAll( Order.Asc("Name"), Expression.Eq("ContactGroupOwner", _reportsContactGroupOwner), Expression.Eq("Type", ContactGroupType.Reports), Expression.Like("Name", "%" + tbContactFind.Text + "%")); ContactGroups.DataSource = findedContactGroups; ContactGroups.DataTextField = "Name"; ContactGroups.DataValueField = "Id"; ContactGroups.DataBind(); tbContactFind.Visible = false; btnFind.Visible = false; ContactGroups.Visible = true; if (findedContactGroups.Length > 0) { btnSaveContactGropup.Visible = true; } btnCancelContactGroup.Visible = true; CloseTaskService(); }
public ContactGroup Create(ContactGroup item) { return(ContactGroups.Create(item)); }
public IEnumerable <ContactGroup> Update(IEnumerable <ContactGroup> items) { return(ContactGroups.Update(items)); }
/// <summary> /// Find a group of contacts /// </summary> public ContactGroup FindContactGroup(string name) { int i = ContactGroups.BinarySearch(new ContactGroup(name)); return(i >= 0 ? ContactGroups[i] : null); }
/// <summary> /// Download address book from file /// </summary> public bool Load(string fileName, out string errMsg) { try { // address book cleaning ContactGroups.Clear(); // loading address book var xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); var contactGroupNodes = xmlDoc.DocumentElement.SelectNodes("ContactGroup"); foreach (XmlElement contactGroupElem in contactGroupNodes) { var contactGroup = new ContactGroup(contactGroupElem.GetAttribute("name")) { Parent = this }; var contactNodes = contactGroupElem.SelectNodes("Contact"); foreach (XmlElement contactElem in contactNodes) { var contact = new Contact(contactElem.GetAttribute("name")) { Parent = contactGroup }; var phoneNumberNodes = contactElem.SelectNodes("PhoneNumber"); foreach (XmlElement phoneNumberElem in phoneNumberNodes) { contact.ContactRecords.Add( new PhoneNumber(phoneNumberElem.InnerText) { Parent = contact }); } var emailNodes = contactElem.SelectNodes("Email"); foreach (XmlElement emailElem in emailNodes) { contact.ContactRecords.Add( new Email(emailElem.InnerText) { Parent = contact }); } contact.ContactRecords.Sort(); contactGroup.Contacts.Add(contact); } contactGroup.Contacts.Sort(); ContactGroups.Add(contactGroup); } ContactGroups.Sort(); errMsg = ""; return(true); } catch (Exception ex) { errMsg = AbPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message; return(false); } }
public async Task <IEnumerable <ContactGroup> > UpdateAsync(IEnumerable <ContactGroup> items) { return(await ContactGroups.UpdateAsync(items)); }
private void LoadOptions() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); lblContactID.Text = iID.ToString(); ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable().DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; cboCreditCardStatus.Items.Clear(); foreach (CreditCardStatus selection in Enum.GetValues(typeof(CreditCardStatus))) { cboCreditCardStatus.Items.Add(new ListItem(selection.ToString("G"), selection.ToString("d"))); } cboCreditCardStatus.SelectedIndex = cboCreditCardStatus.Items.IndexOf(cboCreditCardStatus.Items.FindByValue(CreditCardStatus.All.ToString("d"))); Data.CardType clsCardType = new Data.CardType(clsContactGroup.Connection, clsContactGroup.Transaction); cboCreditCardType.Items.Clear(); cboCreditCardType.DataTextField = "CardTypeName"; cboCreditCardType.DataValueField = "CardTypeID"; cboCreditCardType.DataSource = clsCardType.ListAsDataTable(new CardTypeDetails(CreditCardTypes.Internal)).DefaultView; cboCreditCardType.DataBind(); cboCreditCardType.SelectedIndex = 0; Billing clsBilling = new Billing(clsContactGroup.Connection, clsContactGroup.Transaction); cboBillingDate.DataTextField = "BillingDate"; cboBillingDate.DataValueField = "BillingFile"; cboBillingDate.DataSource = clsBilling.ListBillingDateAsDataTable(CreditType.Group, long.Parse(lblContactID.Text), limit: 10).DefaultView; cboBillingDate.DataBind(); cboBillingDate.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT)); cboBillingDate.SelectedIndex = 0; Salutation clsSalutation = new Salutation(clsContactGroup.Connection, clsContactGroup.Transaction); cboSalutation.DataTextField = "SalutationName"; cboSalutation.DataValueField = "SalutationCode"; cboSalutation.DataSource = clsSalutation.ListAsDataTable().DefaultView; cboSalutation.DataBind(); cboSalutation.SelectedIndex = 0; cboSalutation.SelectedIndex = cboSalutation.Items.IndexOf(cboSalutation.Items.FindByValue("MR")); clsContactGroup.CommitAndDispose(); if (Request.QueryString["showbills"] != null) { if (!bool.Parse(Common.Decrypt(Request.QueryString["showbills"].ToString(), Session.SessionID))) { lblBillingSeparator.Visible = false; labelBilling.Visible = false; cboBillingDate.Visible = false; imgPrintBilling.Visible = false; cmdPrintBilling.Visible = false; } } }
/// <summary> /// Загрузить адресную книгу из файла /// </summary> public bool Load(string fileName, out string errMsg) { try { // очистка адресной книги ContactGroups.Clear(); // загрузка адресной книги XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); XmlNodeList contactGroupNodes = xmlDoc.DocumentElement.SelectNodes("ContactGroup"); foreach (XmlElement contactGroupElem in contactGroupNodes) { ContactGroup contactGroup = new ContactGroup(contactGroupElem.GetAttribute("name")); contactGroup.Parent = this; XmlNodeList contactNodes = contactGroupElem.SelectNodes("Contact"); foreach (XmlElement contactElem in contactNodes) { Contact contact = new Contact(contactElem.GetAttribute("name")); contact.Parent = contactGroup; XmlNodeList phoneNumberNodes = contactElem.SelectNodes("PhoneNumber"); foreach (XmlElement phoneNumberElem in phoneNumberNodes) { contact.ContactRecords.Add( new PhoneNumber(phoneNumberElem.InnerText) { Parent = contact }); } XmlNodeList emailNodes = contactElem.SelectNodes("Email"); foreach (XmlElement emailElem in emailNodes) { contact.ContactRecords.Add( new Email(emailElem.InnerText) { Parent = contact }); } contact.ContactRecords.Sort(); contactGroup.Contacts.Add(contact); } contactGroup.Contacts.Sort(); ContactGroups.Add(contactGroup); } ContactGroups.Sort(); errMsg = ""; return(true); } catch (Exception ex) { errMsg = AbPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message; return(false); } }
public async Task <ActionResult <ContactGroups> > CreateNewContactGroup(ContactGroups contactGroups) { await _context.SaveChangesAsync(); return(StatusCode(201)); }
public ContactGroup Update(ContactGroup item) { return(ContactGroups.Update(item)); }
public async Task <ContactGroup> UpdateAsync(ContactGroup item) { return(await ContactGroups.UpdateAsync(item)); }
private void LoadList() { ContactGroups clsContactGroup = new ContactGroups(); DataClass clsDataClass = new DataClass(); string SortField = "ContactGroupID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } if (Request.QueryString["Search"] == null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.List(SortField, sortoption)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.Search(SearchKey, SortField, sortoption)).DefaultView; } clsContactGroup.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }