Ejemplo n.º 1
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			const string defaultHeading = "Master Files";
			string stHeading = defaultHeading;			

			const string defaultTitle = "List of Product SubGroup Unit Matrix";
			SiteTitle.Title = defaultTitle;

			const SearchCategoryID defaultSearchIndex = SearchCategoryID.ProductSubGroups;
			SearchCategoryID SearchIndex = defaultSearchIndex;			

			HorizontalNavBar.PageNavigatorid = HorizontalNavID.MasterFiles;
			
			if (Request.QueryString["task"]!=null)
			{
                ProductSubGroup clsProductSubGroup = new ProductSubGroup();
                ProductSubGroupDetails clsDetails = new ProductSubGroupDetails();

                int id = Convert.ToInt16(Common.Decrypt(Request.QueryString["subgroupid"].ToString(), Session.SessionID));
                clsDetails = clsProductSubGroup.Details(id);

                clsProductSubGroup.CommitAndDispose();

                string groupCode = " for Product SubGroup : " + clsDetails.ProductSubGroupName;

				string task = Common.Decrypt(Request.QueryString["task"].ToString(),Session.SessionID);
				switch(task)
				{
					case "add":
						stHeading = "Register New Unit Matrix";	
						SearchIndex = SearchCategoryID.ProductVariations;
						ctrlInsert.Visible = true;
						break;
					case "edit":
						stHeading = "Modify Unit Matrix";
						SearchIndex = SearchCategoryID.ProductVariations;
						ctrlUpdate.Visible = true;
						break;   
					case "list":
						stHeading = "Unit Matrix List";		
						SearchIndex = SearchCategoryID.ProductVariations;
						ctrlList.Visible = true;
						break;		
					default:	
						break;
				}

				LargeHeading.Text = stHeading + groupCode;
				RightBodySectionSearch.SearchIDSelectedItem = SearchIndex;
			}
		}
Ejemplo n.º 2
0
        protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
		{
            HtmlInputCheckBox chkList = null;
            string stParam = string.Empty;

            chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&subgroupid=" + Common.Encrypt(chkList.Value, Session.SessionID);

            switch (e.CommandName)
            {
                case "imgItemDelete":
                    ProductSubGroup clsProductSubGroup = new ProductSubGroup();
                    clsProductSubGroup.Delete(chkList.Value);
                    clsProductSubGroup.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;
                case "imgVariationsClick":
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_Variations/Default.aspx" + stParam);
                    break;
                case "imgVariationsMatrixClick":
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_VariationsMatrix/Default.aspx" + stParam);
                    break;
                case "imgUnitsMatrixClick":
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_UnitsMatrix/Default.aspx" + stParam);
                    break;
            }
		}
        private void LoadSubGroup()
        {
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductSubGroupCode = txtProductSubGroup.Text;
            clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value);

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboProductSubGroup.DataBind();
            clsProductSubGroup.CommitAndDispose();

            if (cboProductSubGroup.Items.Count == 0) cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductSubGroup.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
 protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     try
     {
         LoadProduct();
         if (cboProductSubGroup.SelectedItem.Value != Constants.ZERO_STRING)
         {
             ProductSubGroup clsProductSubGroup = new ProductSubGroup();
             ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(long.Parse(cboProductSubGroup.SelectedItem.Value));
             clsProductSubGroup.CommitAndDispose();
             txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0");
             txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0");
             txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
		private void SaveRecord()
		{
			ProductSubGroupDetails clsDetails = new ProductSubGroupDetails();

			clsDetails.ProductSubGroupID = Convert.ToInt16(lblProductSubGroupID.Text);
			clsDetails.ProductGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value);
			clsDetails.ProductSubGroupCode = txtProductSubGroupCode.Text;
			clsDetails.ProductSubGroupName = txtProductSubGroupName.Text;
			clsDetails.BaseUnitID = Convert.ToInt32(cboProductSubGroupUnit.SelectedItem.Value);
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked;
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
			
			ProductSubGroup clsProductSubGroup = new ProductSubGroup();
			clsProductSubGroup.Update(clsDetails);
			clsProductSubGroup.CommitAndDispose();
		}
        protected void imgProductSubGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductSubGroupName = txtProductSubGroup.Text };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView;
            cboProductSubGroup.DataBind();
            cboProductSubGroup.SelectedIndex = 0;
            cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            if (cboProductSubGroup.Items.Count > 1 && txtProductSubGroup.Text.Trim() != string.Empty) cboProductSubGroup.SelectedIndex = 1; else cboProductSubGroup.SelectedIndex = 0;
            clsProductSubGroup.CommitAndDispose();
        }
        protected void cboProductGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            Int64 intProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            clsProductSubGroup.GetConnection();
            ProductGroup clsProductGroup = new ProductGroup(clsProductSubGroup.Connection, clsProductSubGroup.Transaction);
            ProductGroupDetails clsDetails;
            //System.Data.DataTable dtProductSubGroup;

            if (intProductGroupID == 0)
            {
                clsDetails = clsProductGroup.Details(DataConstants.DEFAULT_PRODUCT_GROUP);
            }
            else
            {
                clsDetails = clsProductGroup.Details(intProductGroupID);
            }

            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails() { ProductGroupID = intProductGroupID };
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboProductSubGroup.DataBind();
            cboProductSubGroup.Items.Insert(0, new ListItem("Do not Apply to Product Sub Groups", "-1"));
            cboProductSubGroup.Items.Insert(1, new ListItem("Apply to all Product Sub Groups", "0"));
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
            
            clsProductSubGroup.CommitAndDispose();

            cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.IndexOf(cboChartOfAccountPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDPurchase.ToString()));
            cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.IndexOf(cboChartOfAccountSold.Items.FindByValue(clsDetails.ChartOfAccountIDSold.ToString()));
            cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.IndexOf(cboChartOfAccountInventory.Items.FindByValue(clsDetails.ChartOfAccountIDInventory.ToString()));
            cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.IndexOf(cboChartOfAccountIDTaxPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDTaxPurchase.ToString()));
            cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.IndexOf(cboChartOfAccountIDTaxSold.Items.FindByValue(clsDetails.ChartOfAccountIDTaxSold.ToString()));

        }
Ejemplo n.º 8
0
		protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns();
            clsProductSubGroupColumns.ProductSubGroupCode = true;
            clsProductSubGroupColumns.ProductSubGroupName = true;

            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value);
            clsSearchKeys.ProductSubGroupCode = txtSubGroupCode.Text;

            ProductSubGroup clsSubGroup = new ProductSubGroup();
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, 0);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            if (cboSubGroup.Items.Count > 1 && txtSubGroupCode.Text.Trim() != string.Empty) cboSubGroup.SelectedIndex = 1; else cboSubGroup.SelectedIndex = 0;
            clsSubGroup.CommitAndDispose();

			cboProductSubGroup_SelectedIndexChanged(null, System.EventArgs.Empty);
		}
Ejemplo n.º 9
0
		protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboProductSubGroup.Items.Count != 0)
			{
				ProductSubGroup clsProductSubGroup = new ProductSubGroup();
				ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(cboProductSubGroup.SelectedItem.Value));
				cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf( cboProductUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString()));
				txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
                txtWSPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
				txtPurchasePrice.Text = clsProductSubGroupDetails.PurchasePrice.ToString("#,##0.#0");
                chkIncludeInSubtotalDiscount.Checked = clsProductSubGroupDetails.IncludeInSubtotalDiscount;
				txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0");
				txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0");
				txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0");
				clsProductSubGroup.CommitAndDispose();	
			}
		}
Ejemplo n.º 10
0
		private void LoadProductSubGroups(System.Data.SqlClient.SortOrder SequenceSortOrder)
		{
			try
			{
				tblLayoutGroup.Controls.Clear();
				if (mboLocked) return;

				Int64 intSequenceNoStart = 0;

				if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
					try { intSequenceNoStart = long.Parse(cmdSubGroupLeft.Tag.ToString()); }
					catch { }
				else
					try { intSequenceNoStart = long.Parse(cmdSubGroupRight.Tag.ToString()); }
					catch { }

                // Sep 24, 2014 put an override if cmdSubGroupLeft.Tag = 0
                // always do an asceding coz its already the end.
                if (intSequenceNoStart < Constants.C_RESTOPLUS_MAX_SUB_GROUP) intSequenceNoStart = 0; //reset to 0 if it's 1
                if (intSequenceNoStart == 0) SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending;

				ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns();
				clsProductSubGroupColumns.ProductSubGroupCode = true;
				clsProductSubGroupColumns.SequenceNo = true;

				ProductSubGroup clsProductSubGroup = new ProductSubGroup(mConnection, mTransaction);
                System.Data.DataTable dtProductSubGroup = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, new ProductSubGroupDetails(), intSequenceNoStart, SequenceSortOrder, "SequenceNo", SequenceSortOrder, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_SUB_GROUP : Constants.C_RESTOPLUS_MAX_SUB_GROUP + 1);
				clsProductSubGroup.CommitAndDispose();

                // re-order the products by sequence no
                if (dtProductSubGroup.Rows.Count > 0)
                {
                    System.Data.DataView dv = dtProductSubGroup.DefaultView;
                    dv.Sort = "SequenceNo";
                    dtProductSubGroup = dv.ToTable();
                }

				int iRow = 0;
				int iCol = 0;
				int iCtr = 1;

				if (dtProductSubGroup.Rows.Count == 0)
				{
					cmdSubGroupLeft.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
					cmdSubGroupRight.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
				}
				foreach (System.Data.DataRow dr in dtProductSubGroup.Rows)
				{
					if (iCtr > Constants.C_RESTOPLUS_MAX_SUB_GROUP) break;

                    if (iCtr == 1) cmdSubGroupLeft.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString();
                    if (iCtr >= 1 && dtProductSubGroup.Rows.Count > Constants.C_RESTOPLUS_MAX_SUB_GROUP) cmdSubGroupRight.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString();

					SubGroupButton cmdSubGroup = new SubGroupButton();

					cmdSubGroup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
					cmdSubGroup.BackColor = System.Drawing.Color.Red;
					cmdSubGroup.Dock = System.Windows.Forms.DockStyle.Fill;
					cmdSubGroup.FlatAppearance.BorderColor = System.Drawing.Color.Gold;
					cmdSubGroup.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
					cmdSubGroup.ForeColor = System.Drawing.SystemColors.ControlText;
					cmdSubGroup.GradientBottom = System.Drawing.Color.Red;
					cmdSubGroup.GradientTop = System.Drawing.Color.Gold;
					cmdSubGroup.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
					cmdSubGroup.Location = new System.Drawing.Point(3, 3);
					cmdSubGroup.Size = new System.Drawing.Size(110, 82);
					cmdSubGroup.TabIndex = iCtr-1;
					cmdSubGroup.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
					cmdSubGroup.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
					cmdSubGroup.UseVisualStyleBackColor = false;

					cmdSubGroup.Name = "cmdSubGroup" + iCtr.ToString();
					cmdSubGroup.Text = dr[Data.ProductSubGroupColumnNames.ProductSubGroupCode].ToString();
					cmdSubGroup.Tag = dr[Data.ProductSubGroupColumnNames.ProductSubGroupID].ToString();
					cmdSubGroup.Click += new System.EventHandler(cmdSubGroup_Click);

                    if (!string.IsNullOrEmpty(dr[Data.ProductSubGroupColumnNames.ImagePath].ToString()))
                    {
                        try { cmdSubGroup.Image = new Bitmap(Application.StartupPath + "/images/subgroups/" + dr[Data.ProductSubGroupColumnNames.ImagePath].ToString()); }
					    catch { }
                    }
                    
					tblLayoutGroup.Controls.Add(cmdSubGroup, iCol, iRow);

					iCol++; iCtr++;
				}
			}
			catch { }
		}
Ejemplo n.º 11
0
		protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductGroupID = Int64.Parse(cboProductGroup.SelectedItem.Value) } ;

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView;
            cboProductSubGroup.DataBind();
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
            clsProductSubGroup.CommitAndDispose();

            cboProductSubGroup_SelectedIndexChanged(null, null);
		}
Ejemplo n.º 12
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID);

			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.List(Convert.ToInt32(lblSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
			lstItem.DataBind();
			clsProductSubGroupVariation.CommitAndDispose();

            Data.Unit clsUnit = new Data.Unit();
			cboUnit.DataTextField = "UnitName";
			cboUnit.DataValueField = "UnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	

			ProductSubGroup clsProductSubGroup = new ProductSubGroup();
			ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(lblSubGroupID.Text));
			clsProductSubGroup.CommitAndDispose();

			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
			txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsProductSubGroupDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsProductSubGroupDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0");
			
		}
Ejemplo n.º 13
0
		private void LoadRecord()
		{
			Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			ProductSubGroup clsProductSubGroup = new ProductSubGroup();
			ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(iID);
			clsProductSubGroup.CommitAndDispose();

			lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString();
			cboGroup.SelectedIndex = cboGroup.Items.IndexOf( cboGroup.Items.FindByValue(clsDetails.ProductGroupID.ToString()));
			txtProductSubGroupCode.Text = clsDetails.ProductSubGroupCode;
			txtProductSubGroupName.Text = clsDetails.ProductSubGroupName;
			cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");
		}
Ejemplo n.º 14
0
		private void LoadList()
		{	
			string SortField = "SequenceNo ASC, ProductSubGroupCode";
            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 = string.Empty;
            if (Request.QueryString["Search"] != null)
            { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); }
            else if (Session["Search"] != null)
            { SearchKey = Common.Decrypt(Session["Search"].ToString(), Session.SessionID); }

            try { Session.Remove("Search"); }
            catch { }
            if (SearchKey == null) { SearchKey = string.Empty; }
            else if (SearchKey != string.Empty) { Session.Add("Search", Common.Encrypt(SearchKey, Session.SessionID)); }

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsAll = true };
            
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupDetails = new ProductGroupDetails() { ProductGroupCode = SearchKey, ProductGroupName = SearchKey };
            clsSearchKeys.ProductSubGroupCode = SearchKey;
            clsSearchKeys.ProductSubGroupName = SearchKey;

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            System.Data.DataTable dt = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: SortField, SortOrder: (sortoption == SortOption.Ascending ? System.Data.SqlClient.SortOrder.Ascending : System.Data.SqlClient.SortOrder.Descending));
            clsProductSubGroup.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;
			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;
		}
Ejemplo n.º 15
0
		private Int64 SaveRecord()
		{
			ProductSubGroupDetails clsDetails = new ProductSubGroupDetails();

			clsDetails.ProductGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value);
			clsDetails.ProductSubGroupCode = txtProductSubGroupCode.Text;
			clsDetails.ProductSubGroupName = txtProductSubGroupName.Text;
			clsDetails.BaseUnitID = Convert.ToInt32(cboProductSubGroupUnit.SelectedItem.Value);
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(chkIncludeInSubtotalDiscount.Checked);
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
            clsDetails.SequenceNo = Int32.Parse(txtSequenceNo.Text);
            clsDetails.ImagePath = lblImagePath.Text;

            string strfile = "";
            string strfolder = "/RetailPlus/temp/uploaded/subgroupimages/";
            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFile pfile = Request.Files[i];
                if (pfile.ContentLength > 0)
                {
                    strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(pfile.FileName));

                    if (!System.IO.Directory.Exists(Server.MapPath(strfolder)))
                        System.IO.Directory.CreateDirectory(Server.MapPath(strfolder));

                    if (System.IO.File.Exists(strfile))
                        System.IO.File.Delete(strfile);

                    pfile.SaveAs(strfile);
                    clsDetails.ImagePath = pfile.FileName;
                }
            }

			ProductSubGroup clsProductSubGroup = new ProductSubGroup();
			Int64 id = clsProductSubGroup.Insert(clsDetails);
			clsDetails.ProductSubGroupID = id;

			if (chkVariations.Checked == true)
			{
				clsProductSubGroup.InheritGroupVariations(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID);
			}

			if (chkVariationsMatrix.Checked == true)
			{
				if (chkVariations.Checked == false)
				{
					clsProductSubGroup.InheritGroupVariations(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID);
				}
				clsProductSubGroup.InheritGroupVariationsMatrix(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID);
			}
			if (chkUnitMatrix.Checked == true)
			{
				clsProductSubGroup.InheritGroupUnitMatrix(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID);
			}

			clsProductSubGroup.CommitAndDispose();

			return id;
		}
Ejemplo n.º 16
0
		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)
			{
				ProductSubGroup clsProductSubGroup = new ProductSubGroup();
				clsProductSubGroup.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsProductSubGroup.CommitAndDispose();
			}

			return boRetValue;
		}
Ejemplo n.º 17
0
        protected void cboGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupID = long.Parse(cboGroup.SelectedItem.Value);

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            if (cboGroup.SelectedItem.Value != Constants.ZERO_STRING)
                cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL + " " + cboGroup.SelectedItem.Text, Constants.ZERO_STRING));
            else
                cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;
            clsProductSubGroup.CommitAndDispose();
        }
Ejemplo n.º 18
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			int subgroupid = Convert.ToInt32(Common.Decrypt(Request.QueryString["subgroupid"].ToString(),Session.SessionID));
			lblSubGroupID.Text = Convert.ToString(subgroupid);
			
			ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix();
			ProductSubGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(subgroupid);

			if (clsUnitDetails.BottomUnitName == null)
			{
				ProductSubGroup clsProductSubGroup = new ProductSubGroup();
				ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(subgroupid);
				clsProductSubGroup.CommitAndDispose();

				txtBaseUnit.Text = clsDetails.BaseUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID);
			}
			else
			{
				txtBaseUnit.Text = clsUnitDetails.BottomUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID);
			}

			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(subgroupid,"UnitName",SortOption.Ascending)).DefaultView;
			cboBottomUnit.DataBind();
			if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text)))
			{
				cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
			}
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();
		}
Ejemplo n.º 19
0
		protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboProductSubGroup.Items.Count != 0)
			{
				ProductSubGroup clsProductSubGroup = new ProductSubGroup();
				ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(cboProductSubGroup.SelectedItem.Value));
				cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf( cboProductUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString()));
				txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
				clsProductSubGroup.CommitAndDispose();	
			}
		}