Esempio n. 1
0
        private void LoadRecord()
        {
            Int16 iID = Convert.ToInt16(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            StockTypes clsStockType = new StockTypes();
            StockTypesDetails clsDetails = clsStockType.Details(iID);
            clsStockType.CommitAndDispose();

            lblStockTypeID.Text = clsDetails.StockTypeID.ToString();
            txtStockTypeCode.Text = clsDetails.StockTypeCode;
            txtDescription.Text = clsDetails.Description;
            cboDirection.SelectedIndex = cboDirection.Items.IndexOf(cboDirection.Items.FindByValue(clsDetails.StockDirection.ToString("d")));
        }
Esempio n. 2
0
        private void SaveRecord()
		{
			StockTypes clsStockType = new StockTypes();
			StockTypesDetails clsDetails = new StockTypesDetails();

			clsDetails.StockTypeID = Convert.ToInt16(lblStockTypeID.Text);
			clsDetails.StockTypeCode = txtStockTypeCode.Text;
			clsDetails.Description = txtDescription.Text;
			clsDetails.StockDirection = (StockDirections) Enum.Parse(typeof(StockDirections), cboDirection.SelectedItem.Value);

			clsStockType.Update(clsDetails);
			clsStockType.CommitAndDispose();
        }
Esempio n. 3
0
        private Int32 SaveRecord()
		{
			StockTypes clsStockType = new StockTypes();
			StockTypesDetails clsDetails = new StockTypesDetails();

			clsDetails.StockTypeCode = txtStockTypeCode.Text;
			clsDetails.Description = txtDescription.Text;
			clsDetails.StockDirection = (StockDirections) Enum.Parse(typeof(StockDirections), cboDirection.SelectedItem.Value);

			int id = clsStockType.Insert(clsDetails);
			
			clsStockType.CommitAndDispose();

			return id;
        }
Esempio n. 4
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			StockTypes clsStockTypes = new StockTypes();
			cboStockTypes.DataTextField = "StockTypeCode";
			cboStockTypes.DataValueField = "StockTypeID";
			cboStockTypes.DataSource = clsDataClass.DataReaderToDataTable(clsStockTypes.List("StockTypeCode", SortOption.Ascending)).DefaultView;
			cboStockTypes.DataBind();
			cboStockTypes.SelectedIndex = cboStockTypes.Items.Count - 1;

            Contacts clsContact = new Contacts(clsStockTypes.Connection, clsStockTypes.Transaction);
			cboSupplier.DataTextField = "ContactName";
			cboSupplier.DataValueField = "ContactID";
			cboSupplier.DataSource = clsDataClass.DataReaderToDataTable(clsContact.Suppliers(null, 0, "ContactName", SortOption.Ascending)).DefaultView;
			cboSupplier.DataBind();

            Branch clsBranch = new Branch(clsStockTypes.Connection, clsStockTypes.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            
            clsStockTypes.CommitAndDispose();

            cboStockTypes_SelectedIndexChanged(null, null);
            cboSupplier.SelectedIndex = 0;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

			NewTransaction();
		}
Esempio n. 5
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)
			{
				StockTypes clsStockType = new StockTypes();
				clsStockType.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsStockType.CommitAndDispose();
			}

			return boRetValue;
		}
Esempio n. 6
0
        private void LoadList()
        {
            StockTypes clsStockType = new StockTypes();
            DataClass clsDataClass = new DataClass();

            string SortField = "StockTypeID";
            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 = clsStockType.ListAsDataTable(SortField, sortoption).DefaultView;
            }
            else
            {
                string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID);
                PageData.DataSource = clsStockType.SearchAsDataTable(SearchKey, SortField, sortoption).DefaultView;
            }

            clsStockType.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;
        }
Esempio n. 7
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":
                    StockTypes clsStockTypes = new StockTypes();
                    clsStockTypes.Delete(chkList.Value);
                    clsStockTypes.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;
            }
        }