Exemple #1
0
        private void LoadRecord()
        {
            Int16 iID = Convert.ToInt16(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            Department clsDepartment = new Department();
            DepartmentDetails clsDetails = clsDepartment.Details(iID);
            clsDepartment.CommitAndDispose();

            lblDepartmentID.Text = clsDetails.DepartmentID.ToString();
            txtDepartmentCode.Text = clsDetails.DepartmentCode;
            txtDepartmentName.Text = clsDetails.DepartmentName;
        }
Exemple #2
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)
			{
				Department clsDepartment = new Department();
				clsDepartment.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsDepartment.CommitAndDispose();
			}

			return boRetValue;
		}
Exemple #3
0
		private void LoadList()
		{	
			Department clsDepartment = new Department();
			DataClass clsDataClass = new DataClass();

			string SortField = "DepartmentID";
			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 = "";

			if (Request.QueryString["Search"]!=null)
			{		
                SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
			}
            PageData.DataSource = clsDepartment.ListAsDataTable(SearchKey, SortField, sortoption, 0).DefaultView;
			clsDepartment.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;
		}
Exemple #4
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":
                    Department clsDepartment = new Department();
                    clsDepartment.Delete(chkList.Value);
                    clsDepartment.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;
            }
        }
Exemple #5
0
        private void SaveRecord()
        {
            Department clsDepartment = new Department();
            DepartmentDetails clsDetails = new DepartmentDetails();

            clsDetails.DepartmentID = Convert.ToInt16(lblDepartmentID.Text);
            clsDetails.DepartmentCode = txtDepartmentCode.Text;
            clsDetails.DepartmentName = txtDepartmentName.Text;

            clsDepartment.Update(clsDetails);
            clsDepartment.CommitAndDispose();
        }
Exemple #6
0
        private Int32 SaveRecord()
        {
            Department clsDepartment = new Department();
            DepartmentDetails clsDetails = new DepartmentDetails();

            clsDetails.DepartmentCode = txtDepartmentCode.Text;
            clsDetails.DepartmentName = txtDepartmentName.Text;

            Int32 id = clsDepartment.Insert(clsDetails);

            clsDepartment.CommitAndDispose();

            return id;
        }