Exemple #1
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 Production Line
            ProductionLineBO objProductionLine = new ProductionLineBO();

            List <ProductionLineBO> lstProductionLine = new List <ProductionLineBO>();

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

            if (lstProductionLine.Count > 0)
            {
                this.RadGridProductionLine.AllowPaging = (lstProductionLine.Count > this.RadGridProductionLine.PageSize);
                this.RadGridProductionLine.DataSource  = lstProductionLine;
                this.RadGridProductionLine.DataBind();

                Session["ProductionLineDetails"] = lstProductionLine;

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

            // this.lblSerchKey.Text = string.Empty;
            this.RadGridProductionLine.Visible = (lstProductionLine.Count > 0);
        }
Exemple #2
0
        protected void RadGridProductionLine_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if (item.ItemIndex > -1 && item.DataItem is ProductionLineBO)
                {
                    ProductionLineBO objProductionLine = (ProductionLineBO)item.DataItem;

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

                    HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                    linkDelete.Attributes.Add("qid", objProductionLine.ID.ToString());
                }
            }
        }
Exemple #3
0
        protected void dgProductionLines_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is ProductionLineBO)
            {
                ProductionLineBO objProductionLine = (ProductionLineBO)item.DataItem;

                Literal lblName = (Literal)item.FindControl("lblName");
                lblName.Text = objProductionLine.Name;

                Literal lblDescription = (Literal)item.FindControl("lblDescription");
                lblDescription.Text = objProductionLine.Description;

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

                HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                linkDelete.Attributes.Add("qid", objProductionLine.ID.ToString());
            }
        }
Exemple #4
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(int queryId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    ProductionLineBO objProductionLine = new ProductionLineBO(this.ObjContext);
                    if (queryId > 0)
                    {
                        objProductionLine.ID = queryId;
                        objProductionLine.GetObject();
                    }

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


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

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                //IndicoLogging.log("Error occured while Adding the Item", ex);
            }
        }
Exemple #5
0
        private void IgnoreProductionLine_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".IgnoreProductionLine_Load()";

            try
            {
                Security objSecurity = new Security();
                this.Name = THIS;
                if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0)
                {
                    this.Close();
                    PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning);
                    return;
                }


                //get grid layout
                dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData);

                //load all production line
                ProductionLineBO boProductionLine = new ProductionLineBO();
                dstData = boProductionLine.List();
                if (dtbIgnoreList.Rows.Count > 0)
                {
                    foreach (DataRow drowData in dtbIgnoreList.Rows)
                    {
                        dstData.Tables[0].Select(PRO_ProductionLineTable.PRODUCTIONLINEID_FLD
                                                 + "=" + drowData[PRO_ProductionLineTable.PRODUCTIONLINEID_FLD].ToString().Trim())[0][IGNORED_FLD] = true;
                    }
                }
                dgrdData.DataSource = dstData.Tables[0];

                FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut);
                foreach (C1DisplayColumn c1Col in dgrdData.Splits[0].DisplayColumns)
                {
                    if (c1Col.DataColumn.DataField != IGNORED_FLD)
                    {
                        c1Col.Locked = true;
                    }
                }
            }
            catch (PCSException ex)
            {
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR);
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
        }