Example #1
0
        // TODO: Create in API an Object TermTypeLanguages
        protected void Page_Load(object sender, System.EventArgs e)
        {
            lbMessage.Text = string.Empty;
            #region Check Capabilities

            //if ((SessionState.User.IsReadOnly) || (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_TERM_BASE)))
            //{
            //uwToolbar.Items.FromKeyButton("Add").Enabled = false;
            //uwToolbar.Items.FromKeyButton("Delete").Enabled = false;
            //}
            #endregion

            //DDL_RegionList.AutoPostBack = false;
            if (!Page.IsPostBack)
            {
                try
                {
                    #region Load TermType list
                    using (TermTypeList TermTypes = TermType.GetAll())
                    {
                        DDL_TermTypeList.DataSource = TermTypes;
                        DDL_TermTypeList.DataBind();
                    }
                    #endregion
                    LoadRegionList();
                    ShowTermTypeLanguage();
                }
                catch
                {
                    UITools.DenyAccess(DenyMode.Standard);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Show Term
        /// </summary>
        private void ShowTerm()
        {
            #region Load TermType list
            using (TermTypeList TermTypes = TermType.GetAll())
            {
                DDL_TermTypeList.DataSource = TermTypes;
                DDL_TermTypeList.DataBind();
            }
            #endregion

            if (t != null)
            {
                #region Retrieve information about the current container
                txtTermValue.Text = t.Value.ToString();
                using (ContainerList clist = HyperCatalog.Business.Container.GetAll("LabelId=" + termId))
                {
                    if (clist.Count != 0)
                    {
                        txtTermValue.Enabled = false;
                    }
                    else
                    {
                        txtTermValue.Enabled = true;
                    }
                    txtComment.Text = t.Comment.ToString();
                    //ACQ8.20 Ends
                    if (t.TermTypeCode.ToString() == "S")
                    {
                        IsTranslatable.Enabled = false;
                    }
                    IsTranslatable.Checked = t.IsTranslatable;
                    //ACQ8.20 Ends
                    lUsage.Text = "Used " + t.UsageCount.ToString() + " time(s)";
                    DDL_TermTypeList.SelectedValue = t.TermTypeCode.ToString();
                    DDL_TermTypeList.Enabled       = false;

                    hlCreator.Text         = UITools.GetDisplayName(t.User.FullName);
                    hlCreator.NavigateUrl  = "mailto:" + UITools.GetDisplayEmail(t.User.Email) + Server.HtmlEncode("?subject=Term[#" + t.Id.ToString() + "]");;
                    lbOrganization.Text    = t.User.OrgName;
                    lbOrganization.Visible = hlCreator.Text == t.User.FullName;
                    lbCreatedOn.Text       = SessionState.User.FormatUtcDate(t.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime);
                    UITools.ShowToolBarButton(uwToolbar, "Delete");
                    UITools.ShowToolBarSeparator(uwToolbar, "SepDelete");
                }
                using (Database dbObj = Utils.GetMainDB())
                {
                    using (DataSet ds = dbObj.RunSQLReturnDataSet("dbo.[_Term_GetAssociatedInputForms] " + t.Id.ToString()))
                    {
                        dbObj.CloseConnection();
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            dg.DataSource = ds;
                            dg.DataBind();
                            fUsage.Visible = true;
                        }
                        else
                        {
                            fUsage.Visible = false;
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region New Term
                DDL_TermTypeList.Enabled = true;
                hlCreator.Text           = SessionState.User.FullName;
                hlCreator.NavigateUrl    = "mailto:" + UITools.GetDisplayEmail(SessionState.User.Email) + Server.HtmlEncode("?subject=TMExpression");;
                lbOrganization.Text      = SessionState.User.OrgName;
                lbCreatedOn.Text         = SessionState.User.FormatUtcDate(DateTime.Now, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime);

                fUsage.Visible = false;
                UITools.HideToolBarButton(uwToolbar, "Delete");
                UITools.HideToolBarSeparator(uwToolbar, "SepDelete");
                #endregion
            }
        }
Example #3
0
        private void UpdateDataView()
        {
            #region RegionList population
            UpdateClassRegions();
            UpdateTermRegions();
            #endregion
            #region Init TranslationMode radio group
            rdTranslationMode.Items.Clear();
            rdTranslationMode.DataSource = Enum.GetValues(typeof(TRClassTranslationMode));
            rdTranslationMode.DataBind();
            #endregion
            #region Init ListBar
            //using (TRClassList iList = TRClass.GetAll(" RegionCode = '"+ ddClassRegions.SelectedValue.ToString()+"'"))
            //Added by Venkata 07-10-16
            using (TRClassList iList = GetAllTRClass(" RegionCode = '" + ddClassRegions.SelectedValue.ToString() + "'"))
            {
                foreach (TRClass tr_class in iList)
                {
                    uwClassList.Groups.FromKey("classes").Items.Add(tr_class.Item.FullName, tr_class.Item.Id.ToString());
                }
            }
            using (TermTypeList iTypes = TermType.GetAll())
            {
                foreach (TermType termType in iTypes)
                {
                    uwClassList.Groups.FromKey("others").Items.Add(termType.Name, termType.Code.ToString());
                }
            }

            uwClassList.SelectedGroup = 0;
            uwClassList.SelectedItem  = uwClassList.Groups[0].Items[0];
            #endregion
            #region Update CheckBoxLists
            cbMTRDays.Items.Clear();
            for (int i = 1; i <= 31; i++)
            {
                cbMTRDays.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            cbCTRDays.Items.Clear();
            for (int i = 1; i <= 31; i++)
            {
                cbCTRDays.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            #endregion

            #region Update Product Line DropDown List
            using (HyperCatalog.Business.PLList plList = PL.GetAll())
            {
                plList.Sort("Code");
                ddPL.DataSource = plList;
                ddPL.DataBind();
                ddPL.Items.Insert(0, new ListItem("->PL<-", null));
                ddPL.SelectedIndex    = 0;
                cbPLLanguages.Enabled = false;
            }
            #endregion

            UpdateOptions(uwClassList.Groups[0].Items[0].Key);

            pnl_ClassPanel.Visible = true;
            pnl_TermsPanel.Visible = false;
        }
Example #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Check Capabilities
            if ((SessionState.User.IsReadOnly) || (!SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_TERM_BASE)))
            {
                uwToolbar.Items.FromKeyButton("Add").Enabled      = false;
                uwToolbar.Items.FromKeyButton("Settings").Enabled = false;
            }
            #endregion

            errorMsg.Visible = false;

            if (Request["filter"] != null)
            {
                SessionState.tFilterTerm = txtFilter.Text = Request["filter"].ToString();
            }
            if (!Page.IsPostBack)
            {
                #region Load TermType list
                using (TermTypeList termTypes = TermType.GetAll())
                {
                    DDL_TermTypeList.Items.Clear();
                    DDL_TermTypeList.Items.Add("All");
                    foreach (TermType t in termTypes)
                    {
                        DDL_TermTypeList.Items.Add(new ListItem(t.Name, t.Code.ToString()));
                    }
                }
                #endregion

                #region TermType session
                if (SessionState.tTermType != string.Empty)
                {
                    DDL_TermTypeList.SelectedValue = SessionState.tTermType;
                }
                #endregion
                #region FilterTerm session
                if (SessionState.tFilterTerm != string.Empty)
                {
                    txtFilter.Text = SessionState.tFilterTerm;
                }
                #endregion
                #region Letter session
                if (SessionState.tLetter == string.Empty)
                {
                    SessionState.tLetter = "A";
                }
                uwToolbar.Items.FromKeyButton(SessionState.tLetter).Pressed(true);
                #endregion
                #region Validation report date chooser
                Infragistics.WebUI.WebSchedule.WebDateChooser startDate = (Infragistics.WebUI.WebSchedule.WebDateChooser)advancedToolBar.Items.FromKeyCustom("startDate").FindControl("startDate");
                if (startDate != null)
                {
                    System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
                    ci.DateTimeFormat.ShortDatePattern = SessionState.User.FormatDate;
                    ci.DateTimeFormat.LongDatePattern  = SessionState.User.FormatDate;
                    startDate.CalendarLayout.Culture   = ci;
                    startDate.Value = DateTime.Today.AddDays(-5);
                }
                #endregion

                ShowTermBase();
            }
            else
            {
                if (Request["redirectId"] != null && Request["redirectId"].ToString() != string.Empty)
                {
                    UpdateDataEdit(Request["redirectId"].ToString());
                }
            }
        }
Example #5
0
        /// <summary>
        /// Display the list of terms
        /// </summary>
        /// <param name="letter"></param>
        /// <param name="filter"></param>
        private void ShowTermBase()
        {
            string   letter = SessionState.tLetter;
            string   type   = SessionState.tTermType = DDL_TermTypeList.SelectedValue;
            string   filter = SessionState.tFilterTerm;
            TermList termbase;
            string   sSql = String.Empty;

            #region Definition Filter
            if (filter != string.Empty) // filter on all terms
            {
                string cleanFilter = filter.Replace("'", "''").ToLower();
                cleanFilter = cleanFilter.Replace("[", "[[]");
                cleanFilter = cleanFilter.Replace("_", "[_]");
                cleanFilter = cleanFilter.Replace("%", "[%]");
                sSql       += " Lower(TermValue) like '%" + cleanFilter.ToLower() + "%' ";
            }
            if (letter != "All") // only filter on alphabet's letter selected
            {
                if (sSql != string.Empty)
                {
                    sSql += " AND ";
                }
                sSql += " (TermValue like '" + letter.ToUpper() + "%' OR  TermValue like '" + letter.ToLower() + "%') ";
            }
            if (type.ToLower() != "all") // filter on the term's type
            {
                if (sSql != string.Empty)
                {
                    sSql += " AND ";
                }
                sSql += " TermTypeCode = '" + DDL_TermTypeList.SelectedValue.Substring(0, 1).ToString() + "' ";
            }
            #endregion
            using (termbase = Term.GetAll(sSql))
            {
                lbNoresults.Visible = false;
                if (termbase.Count == 0)
                {
                    lbNoresults.Text              = ShowNoDataResult(type, letter);
                    lbNoresults.Visible           = true;
                    dg.Bands[0].ColHeadersVisible = Infragistics.WebUI.UltraWebGrid.ShowMarginInfo.No;
                    dg.Visible = false;
                }
                else
                {
                    termTypeView  = new CollectionView(TermType.GetAll());
                    dg.DataSource = termbase;
                    dg.DataBind();
                    dg.Columns.FromKey("ModifyDate").Format = SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime;
                    dg.Columns[1].HeaderText      = "Terms [" + termbase.Count.ToString() + " item(s)] found";
                    dg.Bands[0].ColHeadersVisible = Infragistics.WebUI.UltraWebGrid.ShowMarginInfo.Yes;
                    Utils.InitGridSort(ref dg);
                    dg.Visible = true;
                    #region PageIndex session
                    if (SessionState.tPageIndexTerm != string.Empty)
                    {
                        dg.DisplayLayout.Pager.CurrentPageIndex = Convert.ToInt32(SessionState.tPageIndexTerm);
                    }
                    else
                    {
                        dg.DisplayLayout.Pager.CurrentPageIndex = 1;
                        SessionState.tPageIndexTerm             = string.Empty;
                    }
                    #endregion
                }
            }
        }