コード例 #1
0
ファイル: _List.ascx.cs プロジェクト: marioricci/erp-luma
		private bool DeActivate()
		{
			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)
			{
				PromoBySupplier clsPromoBySupplier = new PromoBySupplier();
				clsPromoBySupplier.DeActivate( stIDs.Substring(0,stIDs.Length-1));
				clsPromoBySupplier.CommitAndDispose();
			}

			return boRetValue;
		}
コード例 #2
0
ファイル: _List.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadList()
		{	
			PromoBySupplier clsPromoBySupplier = new PromoBySupplier();
			DataClass clsDataClass = new DataClass();

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

            PromoBySupplierDetails clsSearchKey = new PromoBySupplierDetails();

			if (Request.QueryString["Search"]!=null)
			{
                clsSearchKey.PromoBySupplierCode = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID);
			}

            PageData.DataSource = clsPromoBySupplier.ListAstDataTable(clsSearchKey, SortField, sortoption).DefaultView;

			clsPromoBySupplier.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
ファイル: _Update.ascx.cs プロジェクト: marioricci/erp-luma
		private long SaveRecord()
		{
            long lngRetValue = 0;
            string stScript = string.Empty;

            DateTime dteStartDateTime = DateTime.MinValue;
            try { dteStartDateTime = Convert.ToDateTime(txtStartDate.Text + " " + txtStartTime.Text); }
            catch
            {
                stScript += "<Script>";
                stScript += "window.alert('Please enter a valid start date time of promo.')";
                stScript += "</Script>";
                Response.Write(stScript);
                return lngRetValue;
            }
            DateTime dteEndDateTime = DateTime.MinValue;
            try { dteEndDateTime = Convert.ToDateTime(txtEndDate.Text + " " + txtEndTime.Text); }
            catch
            {
                stScript += "<Script>";
                stScript += "window.alert('Please enter a valid end date time of promo.')";
                stScript += "</Script>";
                Response.Write(stScript);
                return lngRetValue;
            }

            PromoBySupplier clsPromoBySupplier = new PromoBySupplier();
            PromoBySupplierDetails clsDetails = new PromoBySupplierDetails();

            clsDetails.PromoBySupplierID = Convert.ToInt64(lblPromoBySupplierID.Text);
            clsDetails.PromoBySupplierCode = txtPromoBySupplierCode.Text;
            clsDetails.PromoBySupplierName = txtPromoBySupplierName.Text;
            clsDetails.PromoLevel = (PromoLevel)Enum.Parse(typeof(PromoLevel), cboPromoLevel.SelectedItem.Value);
            clsDetails.StartDate = dteStartDateTime;
            clsDetails.EndDate = dteEndDateTime;
            clsDetails.PromoTypeID = Constants.C_DEF_PROMO_TYPE_ID;

            clsPromoBySupplier.Update(clsDetails);
            clsPromoBySupplier.CommitAndDispose();

            lngRetValue = clsDetails.PromoBySupplierID;
            return lngRetValue;
		}
コード例 #4
0
ファイル: _Stuff.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			PromoBySupplier clsPromoBySupplier = new PromoBySupplier();
			PromoBySupplierDetails clsDetails = clsPromoBySupplier.Details(iID);
			clsPromoBySupplier.CommitAndDispose();

			lblPromoBySupplierID.Text = clsDetails.PromoBySupplierID.ToString();
			txtPromoBySupplierCode.Text = clsDetails.PromoBySupplierCode;
			txtPromoBySupplierName.Text = clsDetails.PromoBySupplierName;
            txtPromoLevel.Text = clsDetails.PromoLevel.ToString("G");
			txtStartDate.Text = clsDetails.StartDate.ToString("yyyy-MM-dd HH:mm");
			txtEndDate.Text = clsDetails.EndDate.ToString("yyyy-MM-dd HH:mm");

			LoadList();
            
            switch (clsDetails.PromoLevel)
            {
                case PromoLevel.All:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    cboProductGroup.Enabled = true; txtProductGroupCode.Enabled = true; imgProductGroupCodeSearch.Enabled = true;
                    cboSubGroup.Enabled = true; txtSubGroupCode.Enabled = true; imgSubGroupCodeSearch.Enabled = true;
                    cboProducts.Enabled = true; txtProductCode.Enabled = true; cmdProductCode.Enabled = true;
                    cboProductVariation.Enabled = true;
                    break;
                case PromoLevel.Contact:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    break;
                case PromoLevel.ProductGroup:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    cboProductGroup.Enabled = true; txtProductGroupCode.Enabled = true; imgProductGroupCodeSearch.Enabled = true;
                    break;
                case PromoLevel.ProductSubGroup:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    cboProductGroup.Enabled = true; txtProductGroupCode.Enabled = true; imgProductGroupCodeSearch.Enabled = true;
                    cboSubGroup.Enabled = true; txtSubGroupCode.Enabled = true; imgSubGroupCodeSearch.Enabled = true;
                    break;
                case PromoLevel.Product:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    cboProductGroup.Enabled = true; txtProductGroupCode.Enabled = true; imgProductGroupCodeSearch.Enabled = true;
                    cboSubGroup.Enabled = true; txtSubGroupCode.Enabled = true; imgSubGroupCodeSearch.Enabled = true;
                    cboProducts.Enabled = true; txtProductCode.Enabled = true; cmdProductCode.Enabled = true;
                    break;
                case PromoLevel.Variation:
                    cboContact.Enabled = true; txtContactCode.Enabled = true; imgContactCodeSearch.Enabled = true;
                    cboProductGroup.Enabled = true; txtProductGroupCode.Enabled = true; imgProductGroupCodeSearch.Enabled = true;
                    cboSubGroup.Enabled = true; txtSubGroupCode.Enabled = true; imgSubGroupCodeSearch.Enabled = true;
                    cboProducts.Enabled = true; txtProductCode.Enabled = true; cmdProductCode.Enabled = true;
                    cboProductVariation.Enabled = true;
                    break;
                case PromoLevel.NotApplicable:
                    break;
                default:
                    break;
            }
		}
コード例 #5
0
ファイル: _Update.ascx.cs プロジェクト: marioricci/erp-luma
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			PromoBySupplier clsPromoBySupplier = new PromoBySupplier();
			PromoBySupplierDetails clsDetails = clsPromoBySupplier.Details(iID);
			clsPromoBySupplier.CommitAndDispose();

			lblPromoBySupplierID.Text = clsDetails.PromoBySupplierID.ToString();
			txtPromoBySupplierCode.Text = clsDetails.PromoBySupplierCode;
			txtPromoBySupplierName.Text = clsDetails.PromoBySupplierName;
            cboPromoLevel.SelectedIndex = cboPromoLevel.Items.IndexOf(cboPromoLevel.Items.FindByValue(clsDetails.PromoLevel.ToString("d")));
			txtStartDate.Text = clsDetails.StartDate.ToString("yyyy-MM-dd");
            txtStartTime.Text = clsDetails.StartDate.ToString("HH:mm");
            txtEndDate.Text = clsDetails.EndDate.ToString("yyyy-MM-dd");
            txtEndTime.Text = clsDetails.EndDate.ToString("HH:mm");
		}