private void ProcessForm(int typeId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    FabricTypeBO objFabricType = new FabricTypeBO(this.ObjContext);
                    if (typeId > 0)
                    {
                        objFabricType.ID = typeId;
                        objFabricType.GetObject();
                        objFabricType.Name        = this.txtAgeGroupName.Text;
                        objFabricType.Description = this.txtDescription.Text;

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

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
        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
                FabricTypeBO objFabricTypes = new FabricTypeBO();

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

                if (lstFabricTypes.Count > 0)
                {
                    this.RadGridFabricTypes.AllowPaging = (lstFabricTypes.Count > this.RadGridFabricTypes.PageSize);
                    this.RadGridFabricTypes.DataSource  = lstFabricTypes;
                    this.RadGridFabricTypes.DataBind();

                    Session["FabricTypeStatusDetails"] = lstFabricTypes;

                    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.RadGridFabricTypes.Visible = (lstFabricTypes.Count > 0);
            }
        }
        protected void RadGridFabricTypes_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if (item.ItemIndex > -1 && item.DataItem is FabricTypeBO)
                {
                    FabricTypeBO objFabricType = (FabricTypeBO)item.DataItem;

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

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