コード例 #1
0
        protected void RadGridColorProfile_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if (item.ItemIndex > -1 && item.DataItem is ColourProfileBO)
                {
                    ColourProfileBO objColourProfile = (ColourProfileBO)item.DataItem;

                    //Label lblName = (Label)item.FindControl("lblName");
                    //lblName.Text = objColourProfile.Name;

                    //Label lblDescription = (Label)item.FindControl("lblDescription");
                    //lblDescription.Text = objColourProfile.Description;

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

                    HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                    linkDelete.Attributes.Add("qid", objColourProfile.ID.ToString());
                    linkDelete.Visible = (objColourProfile.ProductsWhereThisIsColourProfile.Count == 0);
                }
            }
        }
コード例 #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
            ColourProfileBO objColourProfile = new ColourProfileBO();

            List <ColourProfileBO> lstColourProfiles = new List <ColourProfileBO>();

            if ((searchText != string.Empty) && (searchText != "search"))
            {
                lstColourProfiles = (from o in objColourProfile.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                                     where o.Name.ToLower().Contains(searchText) ||
                                     (o.Description != null ? o.Description.ToLower().Contains(searchText) : false)
                                     select o).ToList();
            }
            else
            {
                lstColourProfiles = objColourProfile.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList();
            }

            if (lstColourProfiles.Count > 0)
            {
                this.RadGridColorProfile.AllowPaging = (lstColourProfiles.Count > this.RadGridColorProfile.PageSize);
                this.RadGridColorProfile.DataSource  = lstColourProfiles;
                this.RadGridColorProfile.DataBind();
                Session["ColorProfileDetails"] = lstColourProfiles;

                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.btnAddColorProfile.Visible = false;
            }

            //this.lblSerchKey.Text = string.Empty;
            this.RadGridColorProfile.Visible = (lstColourProfiles.Count > 0);
        }
コード例 #3
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(int queryId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    ColourProfileBO objColourProfile = new ColourProfileBO(this.ObjContext);
                    if (queryId > 0)
                    {
                        objColourProfile.ID = queryId;
                        objColourProfile.GetObject();
                    }

                    if
                    (isDelete)
                    {
                        objColourProfile.Delete();
                    }
                    else
                    {
                        objColourProfile.Name        = this.txtColorProfilesName.Text;
                        objColourProfile.Description = this.txtDescription.Text;


                        if (queryId == 0)
                        {
                            objColourProfile.Add();
                        }
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                //IndicoLogging.log("Error occured while Adding the Item", ex);
            }
        }