Ejemplo n.º 1
0
        private void ProcessForm(int agegroupId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    AgeGroupBO objAgeGroup = new AgeGroupBO(this.ObjContext);
                    if (agegroupId > 0)
                    {
                        objAgeGroup.ID = agegroupId;
                        objAgeGroup.GetObject();
                        objAgeGroup.Name        = this.txtAgeGroupName.Text;
                        objAgeGroup.Description = this.txtDescription.Text;

                        if (isDelete)
                        {
                            objAgeGroup.Delete();
                        }
                    }
                    else
                    {
                        objAgeGroup.Name        = this.txtAgeGroupName.Text;
                        objAgeGroup.Description = this.txtDescription.Text;
                        objAgeGroup.Add();
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
Ejemplo n.º 2
0
        private void PopulateDataGrid()
        {
            {
                // Hide Controls
                this.dvEmptyContent.Visible   = false;
                this.dvDataContent.Visible    = false;
                this.dvNoSearchResult.Visible = false;

                // Search text
                string searchText = this.txtSearch.Text.ToLower().Trim();

                // Populate Items
                AgeGroupBO objAgeGroup = new AgeGroupBO();

                List <AgeGroupBO> lstAgeGroup = new List <AgeGroupBO>();
                if ((searchText != string.Empty) && (searchText != "search"))
                {
                    lstAgeGroup = (from o in objAgeGroup.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                                   where o.Name.ToLower().Contains(searchText) ||
                                   (o.Description != null ? o.Description.ToLower().Contains(searchText) : false)
                                   select o).ToList();
                }
                else
                {
                    lstAgeGroup = objAgeGroup.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList();
                }

                if (lstAgeGroup.Count > 0)
                {
                    this.RadGridAgeGroup.AllowPaging = (lstAgeGroup.Count > this.RadGridAgeGroup.PageSize);
                    this.RadGridAgeGroup.DataSource  = lstAgeGroup;
                    this.RadGridAgeGroup.DataBind();
                    Session["AgeGroupDetails"] = lstAgeGroup;

                    this.dvDataContent.Visible = true;
                }
                else if ((searchText != string.Empty && searchText != "search"))
                {
                    this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty);

                    this.dvDataContent.Visible    = true;
                    this.dvNoSearchResult.Visible = true;
                }
                else
                {
                    this.dvEmptyContent.Visible = true;
                    this.btnAddAgeGroup.Visible = false;
                }

                this.RadGridAgeGroup.Visible = (lstAgeGroup.Count > 0);
            }
        }
Ejemplo n.º 3
0
        protected void RadGridAgeGroup_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if (item.ItemIndex > -1 && item.DataItem is AgeGroupBO)
                {
                    AgeGroupBO objAgeGroup = (AgeGroupBO)item.DataItem;

                    HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit");
                    linkEdit.Attributes.Add("qid", objAgeGroup.ID.ToString());

                    HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                    linkDelete.Attributes.Add("qid", objAgeGroup.ID.ToString());
                    linkDelete.Visible = (objAgeGroup.PatternsWhereThisIsAgeGroup.Count == 0);
                }
            }
        }