Ejemplo n.º 1
0
        public static string GetControlDisplayName(bool supportMutiLangs, string className, string ctrlName, List<Annex> annexes, string defDisplayName)
        {
            try
            {
                if (defDisplayName.IsNullOrEmpty())
                {
                    if (!ctrlName.Contains("_")) defDisplayName = ctrlName;
                    else defDisplayName = ctrlName.GetLastSeparatedString('_');
                }

                if (supportMutiLangs)
                {
                    var text = AnnexHelper.GetText(className, ctrlName, annexes, AnnexTextType.DisplayName, CultureHelper.CurrentLanguageCode, GetAnnexMode.OnlyByCurLang);
                    if (text.IsNullOrEmpty()) text = defDisplayName;
                    return text;
                }
                else
                {

                    return defDisplayName;
                }
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + TypeName + ".GetDisplayName Error: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected void RefreshBackgroundTaskComponent(List <BackgroundTaskPool.BackgroundTask> backTasks)
        {
            try
            {
                var backTasksProcessingNo = backTasks.FindAll(x => x.Status == (int)TaskStatus.Processing).Count;
                var backTasksWaitingNo    = backTasks.FindAll(x => x.Status == (int)TaskStatus.Waiting).Count;
                RunningStatusSectionBackgroundTaskRegionImageTextButton.Text = BackgroundTaskImageTextButtonText + @" " + backTasksProcessingNo + @"/" + backTasksWaitingNo;
                if (backTasksProcessingNo > 0)
                {
                    RunningStatusSectionBackgroundTaskRegionProgressCircleZone.Width = BackgroundTaskProgressCircleSize;
                    RunningStatusSectionBackgroundTaskRegionProgressCircle.Visible   = true;
                    RunningStatusSectionBackgroundTaskRegionProgressCircle.Width     = BackgroundTaskProgressCircleSize;
                    RunningStatusSectionBackgroundTaskRegionProgressCircle.Start();
                }
                else
                {
                    RunningStatusSectionBackgroundTaskRegionProgressCircle.Visible = false;
                    RunningStatusSectionBackgroundTaskRegionProgressCircle.Stop();
                    RunningStatusSectionBackgroundTaskRegionProgressCircleZone.Width = 0;
                }
                BackgroundTaskDetailLabel.Text = BackgroundTaskInfoLabelText;
                var idValTextList = new List <IdValueText>();
                foreach (var task in backTasks)
                {
                    var typeIdName = _backgroundTaskTypeList.Find(x => x.Id == task.Type);
                    if (typeIdName != null)
                    {
                        task.TypeName = AnnexHelper.GetText("", typeIdName.Name, _backgroundTaskTypeAnnexes, AnnexTextType.DisplayName, CultureHelper.CurrentLanguageCode, GetAnnexMode.StepByStep);
                    }
                    else
                    {
                        task.TypeName = WinformRes.Unknown;
                    }

                    Type t        = task.GetType();
                    var  myFields = t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                    for (int i = 0; i < myFields.Length; i++)
                    {
                        var idValueText = new IdValueText();
                        idValueText.Id    = task.Id;
                        idValueText.Value = myFields[i].Name;
                        var obj = myFields[i].GetValue(task);
                        idValueText.Text = obj == null ? "" : obj.ToString();
                        idValTextList.Add(idValueText);
                    }
                }
                ////BackgroundTaskDetailListViewEx.Render(idValTextList);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + "." + "RefreshBackgroundTaskComponent Error: " + ex.Message);
            }
        }
Ejemplo n.º 3
0
 private static string GetAnnexText(bool supportMultiLangs, AnnexTextType annexTextType, string className, string ctrlName, List <Annex> annexes, string defText)
 {
     if (supportMultiLangs)
     {
         var text = AnnexHelper.GetText(className, ctrlName, annexes, annexTextType, CultureHelper.CurrentLanguageCode, GetAnnexMode.OnlyByCurLang);
         if (text.IsNullOrEmpty())
         {
             text = defText;
         }
         return(text);
     }
     else
     {
         return(defText);
     }
 }
Ejemplo n.º 4
0
        internal string GetJobDisplayName()
        {
            try
            {
                var job = JobServiceData.Job;
                var txt = "";
                if (GlobalConfiguration.SupportMutiCultures)
                {
                    txt = AnnexHelper.GetText("", job.Id, JobServiceData.JobAnnexes, AnnexTextType.DisplayName, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.OnlyByCurLang);
                }

                if (txt.IsNullOrEmpty())
                {
                    txt = job.DisplayName;
                }
                return(txt);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + ".GetJobDisplayName Error: " + ex.Message);
            }
        }
        internal string GetValidationResult(string text, string validationRule)
        {
            try
            {
                var subParamSeparator = validationRule.GetSubParamSeparator();
                var ruleArray         = validationRule.Split(subParamSeparator);
                var ruleName          = ruleArray[0];
                if (ruleName == "PasswordFormat2")
                {
                    if (text.IsPassword())
                    {
                        return("true");
                    }
                    else
                    {
                        if (ValidationServiceData.ValidationAnnexes == null)
                        {
                            ValidationServiceData.Init();
                        }

                        var txt = "";
                        txt = GlobalConfiguration.SupportMutiCultures ? AnnexHelper.GetText("", ruleName, ValidationServiceData.ValidationAnnexes, AnnexTextType.Description, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep) :
                              AnnexHelper.GetText("", ruleName, JobServiceData.JobAnnexes, AnnexTextType.Description, "", GetAnnexMode.FirstAnnex);

                        return(txt);
                    }
                }

                else
                {
                    throw new ArgumentException(" has no validation rule: " + ruleArray[0] + "! ");
                }
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + ".GetValidationResult Error: " + ex.Message);
            }
        }
Ejemplo n.º 6
0
        //#WinConfigGroup
        //##GetWinConfigGroupProperty
        internal string GetWinConfigGroupProperty(int id, string property)
        {
            try
            {
                var winConfigGrp = WinConfigServiceData.WinConfigGroups.Find(x => x.Id == id);

                if (property.ToLower() == "DisplayName".ToLower())
                {
                    var text = GlobalConfiguration.SupportMutiCultures
                        ? AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.DisplayName, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep)
                        : AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.DisplayName, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.FirstAnnex);
                    return(text);
                }
                else if (property.ToLower() == "Description".ToLower())
                {
                    var text = GlobalConfiguration.SupportMutiCultures
                        ? AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Description, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep)
                        : AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Description, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.FirstAnnex);
                    return(text);
                }
                else if (property.ToLower() == "ManualFixDes".ToLower())
                {
                    var text = GlobalConfiguration.SupportMutiCultures
                        ? AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep)
                        : AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.FirstAnnex);
                    return(text);
                }
                else if (property.ToLower() == "ManualFix1Des".ToLower())
                {
                    var text = GlobalConfiguration.SupportMutiCultures
                        ? AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark1, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep)
                        : AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark1, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.FirstAnnex);
                    return(text);
                }
                else if (property.ToLower() == "ManualFix2Des".ToLower())
                {
                    var text = GlobalConfiguration.SupportMutiCultures
                        ? AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark2, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.StepByStep)
                        : AnnexHelper.GetText("", id, WinConfigServiceData.WinConfigGroupAnnexes, AnnexTextType.Remark2, GlobalConfiguration.CurrentLanguageCode, GetAnnexMode.FirstAnnex);
                    return(text);
                }
                else if (property.ToLower() == "HasManualJudge".ToLower())
                {
                    return(winConfigGrp.HasManualJudge.ToString());
                }
                else if (property.ToLower() == "HasSeeDetail".ToLower())
                {
                    return(winConfigGrp.HasSeeDetail.ToString());
                }
                else if (property.ToLower() == "HasRefresh".ToLower())
                {
                    return(winConfigGrp.HasRefresh.ToString());
                }
                else if (property.ToLower() == "HasAutoFix".ToLower())
                {
                    return(winConfigGrp.HasAutoFix.ToString());
                }
                else if (property.ToLower() == "HasManualFix".ToLower())
                {
                    return(winConfigGrp.HasManualFix.ToString());
                }
                else if (property.ToLower() == "ManualFixAction".ToLower())
                {
                    return(winConfigGrp.ManualFixAction);
                }

                else if (property.ToLower() == "HasManualFix1".ToLower())
                {
                    return(winConfigGrp.HasManualFix1.ToString());
                }
                else if (property.ToLower() == "ManualFix1Action".ToLower())
                {
                    return(winConfigGrp.ManualFix1Action);
                }

                else if (property.ToLower() == "HasManualFix2".ToLower())
                {
                    return(winConfigGrp.HasManualFix2.ToString());
                }
                else if (property.ToLower() == "ManualFix2Action".ToLower())
                {
                    return(winConfigGrp.ManualFix2Action);
                }

                else if (property.ToLower() == "HasSave".ToLower())
                {
                    return(winConfigGrp.HasSave.ToString());
                }
                else if (property.ToLower() == "HasReadDoc".ToLower())
                {
                    return(winConfigGrp.HasReadDoc.ToString());
                }
                else if (property.ToLower() == "ReadDocAction".ToLower())
                {
                    return(winConfigGrp.ReadDocAction);
                }
                else
                {
                    throw new ArgumentException("has no property: " + property);
                }
            }
            catch (Exception ex)
            {
                throw new ArgumentException("\n>> " + GetType().FullName + ".GetWinConfigGroupProperty Error: " + ex.Message);
            }
        }