Пример #1
0
		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;
		}
Пример #2
0
		private void LoadList()
		{	
			Contacts clsContact = new Contacts();
            
			string SortField = "ContactCode";
			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 = clsContact.ListAsDataTable(SortField, sortoption).DefaultView;
			}
			else
			{
				string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
				PageData.DataSource = clsContact.SearchAsDataTable(SearchKey, SortField, sortoption).DefaultView;
			}

			clsContact.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;
		}
Пример #3
0
		private void LoadList()
		{	
			Contacts clsContact = new Contacts();
            
			string SortField = "ContactCode";
			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);	}

            string strContactCode = txtContactCode.Text;
            string strContactName = txtContactName.Text;
            string strContactGroupCode = cboGroup.SelectedItem.Text;
            Int16 intModeOfTerms = Int16.Parse(cboModeOfTerms.SelectedItem.Value);

            PageData.DataSource = clsContact.ListAsDataTable(ContactGroupCategory.CUSTOMER, ContactCode: strContactCode, ContactName: strContactName, ContactGroupCode: strContactGroupCode, SortField: SortField, SortOrder: sortoption, ModeOfTerms: intModeOfTerms).DefaultView;

			clsContact.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;
		}
Пример #4
0
		private void LoadList()
		{	
			Contacts clsContact = new Contacts();
			DataClass clsDataClass = new DataClass();
            ContactColumns clsContactColumns = new ContactColumns();
            clsContactColumns.ContactID = true;
            clsContactColumns.ContactCode = true;
            clsContactColumns.ContactName = true;
            clsContactColumns.RewardDetails = true;

            ContactColumns clsSearchColumns = new ContactColumns();
            clsSearchColumns.ContactCode = true;
            clsSearchColumns.ContactName = true;
            clsSearchColumns.RewardDetails = true;

			string SortField = "ContactID";
			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);	}

            string SearchKey = txtSearch.Text;
            string ContactGroupCode = "";
            ContactGroupCode = cboGroup.SelectedIndex == 0 ? "" : cboGroup.SelectedItem.Text;

            DateTime dteBirthDateFrom = Constants.C_DATE_MIN_VALUE;
            DateTime dteBirthDateTo = Constants.C_DATE_MIN_VALUE;
            DateTime dteAnniversaryDateFrom = Constants.C_DATE_MIN_VALUE;
            DateTime dteAnniversaryDateTo = Constants.C_DATE_MIN_VALUE;

            dteBirthDateFrom = DateTime.TryParse(txtBirthStartDate.Text, out dteBirthDateFrom) ? dteBirthDateFrom : Constants.C_DATE_MIN_VALUE;
            dteBirthDateTo = DateTime.TryParse(txtBirthEndDate.Text, out dteBirthDateTo) ? dteBirthDateTo : Constants.C_DATE_MIN_VALUE;
            dteAnniversaryDateFrom = DateTime.TryParse(txtAnnivStartDate.Text, out dteAnniversaryDateFrom) ? dteAnniversaryDateFrom : Constants.C_DATE_MIN_VALUE;
            dteAnniversaryDateTo = DateTime.TryParse(txtAnnivEndDate.Text, out dteAnniversaryDateTo) ? dteAnniversaryDateTo : Constants.C_DATE_MIN_VALUE;

            //PageData.DataSource = clsContact.Customers(clsContactColumns, 0, System.Data.SqlClient.SortOrder.Ascending, clsSearchColumns, SearchKey, 0, false, null, System.Data.SqlClient.SortOrder.Ascending).DefaultView;
            PageData.DataSource = clsContact.ListAsDataTable(ContactGroupCategory.CUSTOMER, ContactCode: SearchKey, ContactName: SearchKey, ContactGroupCode: ContactGroupCode, SortField: SortField, SortOrder: sortoption, BirthDateFrom: dteBirthDateFrom.ToString("yyyy-MM-dd"), BirthDateTo: dteBirthDateTo.ToString("yyyy-MM-dd"), AnniversaryDateFrom: dteAnniversaryDateFrom.ToString("yyyy-MM-dd"), AnniversaryDateTo: dteAnniversaryDateTo.ToString("yyyy-MM-dd"), BirthMonth: cboBirthMonth.SelectedIndex, AnniversaryMonth: cboAnniversaryMonth.SelectedIndex).DefaultView;
                //clsContact.CustomersDataTable(SearchKey, SortField: SortField, SortOrder: sortoption).DefaultView;

			clsContact.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;
		}