コード例 #1
0
 public ConceptEnvironment()
 {
     this.ConceptList = new Dictionary <decimal, SecondaryConcept>();
     foreach (SecondaryConcept ScndCnp in SecondaryConcept.GetRepository(false).GetAll())
     {
         this.ConceptList.Add(ScndCnp.IdentifierCode, ScndCnp);
     }
     this.CalendarList = Calendar.GetRepository(false).GetAll();
 }
コード例 #2
0
        /// <summary>
        /// بر اساس نوع مفهوم ثانویه یک نمونه از کلاس "مقدار مفهوم ثانویه" ایجاد می نماید
        /// مقدار مفهوم ثانویه بر دو نوع "زوج مرتبی" و "غیر زوج مرتبی" می باشد
        /// </summary>
        /// <param name="scndCnp">مفهوم ثانویه ای که باید بر اساس آن مقدار مفهوم ثانویه ایجاد شود</param>
        /// <returns>یک نمونه از کلاس مقدار مفهوم ثانویه پایه</returns>
        public static BaseScndCnpValue GetScndCnpValueFacorty(SecondaryConcept scndCnp)
        {
            switch (scndCnp.Type)
            {
            case ScndCnpPairableType.PSC: return(new PairableScndCnpValue());

            case ScndCnpPairableType.NPSC: return(new NonePairableScndCnpValue());

            default: throw new ArgumentException("نوع مفهوم ثانویه ناشناس است");
            }
        }
コード例 #3
0
    public string[] UpdateColumn_DesignedReportsSelectColumnPage(string state, string SelectedColumnID, string Title, string Active, string ReportID, string ConceptID, string Order, string ColumnType, string TrafficColumnsCount, string KeyColumn)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            decimal      ColumnID            = 0;
            decimal      selectedColumnID    = decimal.Parse(this.StringBuilder.CreateString(SelectedColumnID), CultureInfo.InvariantCulture);
            string       title               = this.StringBuilder.CreateString(Title);
            bool         active              = Convert.ToBoolean(this.StringBuilder.CreateString(Active) == "" ? "false" : this.StringBuilder.CreateString(Active));
            decimal      reportID            = decimal.Parse(this.StringBuilder.CreateString(ReportID), CultureInfo.InvariantCulture);
            decimal      fieldId             = decimal.Parse(this.StringBuilder.CreateString(ConceptID), CultureInfo.InvariantCulture);
            Int16        order               = Int16.Parse(this.StringBuilder.CreateString(Order));
            int          trafficColumnsCount = int.Parse(this.StringBuilder.CreateString(TrafficColumnsCount), CultureInfo.InvariantCulture);
            bool         isConcept           = false;
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());
            DesignedReportTrafficKeyColumn keyColumn = DesignedReportTrafficKeyColumn.AllTraffic;
            GTS.Clock.Model.Report.DesignedReportColumn columnObj = new GTS.Clock.Model.Report.DesignedReportColumn();
            columnObj.ID = selectedColumnID;
            GTS.Clock.Model.Report.Report reportObj = new GTS.Clock.Model.Report.Report();
            reportObj.ID     = reportID;
            columnObj.Report = reportObj;
            if (uam != UIActionType.DELETE)
            {
                DesignedReportColumnType columnType = DesignedReportColumnType.None;
                if (ColumnType != string.Empty)
                {
                    columnType = (DesignedReportColumnType)Enum.Parse(typeof(DesignedReportColumnType), this.StringBuilder.CreateString(ColumnType));
                }
                if (columnType == DesignedReportColumnType.Traffic)
                {
                    keyColumn = (DesignedReportTrafficKeyColumn)Enum.Parse(typeof(DesignedReportTrafficKeyColumn), this.StringBuilder.CreateString(KeyColumn));
                }

                GTS.Clock.Model.Concepts.SecondaryConcept conceptObj    = null;
                DesignedReportPersonInfoColumn            personInfoObj = null;
                DesignedReportTrafficColumn trafficObj          = null;
                PersonParamField            personParamFieldObj = null;
                switch (columnType)
                {
                case DesignedReportColumnType.Concept:
                    conceptObj           = new SecondaryConcept();
                    conceptObj.ID        = fieldId;
                    columnObj.ColumnType = DesignedReportColumnType.Concept;
                    isConcept            = true;

                    break;

                case DesignedReportColumnType.Traffic:
                    trafficObj           = new DesignedReportTrafficColumn();
                    trafficObj.ID        = fieldId;
                    trafficObj.Key       = keyColumn;
                    columnObj.ColumnType = DesignedReportColumnType.Traffic;

                    break;

                case DesignedReportColumnType.PersonInfo:
                    personInfoObj        = new DesignedReportPersonInfoColumn();
                    personInfoObj.ID     = fieldId;
                    columnObj.ColumnType = DesignedReportColumnType.PersonInfo;
                    break;

                case DesignedReportColumnType.PersonParam:
                    personParamFieldObj    = new PersonParamField();
                    personParamFieldObj.ID = fieldId;
                    columnObj.ColumnType   = DesignedReportColumnType.PersonParam;
                    break;

                default:
                    break;
                }



                columnObj.Title              = title;
                columnObj.Active             = active;
                columnObj.Concept            = conceptObj;
                columnObj.PersonInfo         = personInfoObj;
                columnObj.Traffic            = trafficObj;
                columnObj.PersonParam        = personParamFieldObj;
                columnObj.Order              = order;
                columnObj.IsConcept          = isConcept;
                columnObj.TrafficColumnCount = trafficColumnsCount;
                if (uam != UIActionType.EDIT)
                {
                    IList <GTS.Clock.Model.Report.DesignedReportColumn> designedReportColumnList = DesignedReportsColumnBusiness.GetDesignedReportsColumnsByReportID(reportID);
                    Int16 lastOrder = 0;
                    if (designedReportColumnList.Count > 0)
                    {
                        lastOrder = designedReportColumnList.OrderByDescending(o => o.Order).FirstOrDefault().Order;
                    }

                    columnObj.Order = (Int16)(lastOrder + 1);
                }
            }

            switch (uam)
            {
            case UIActionType.ADD:

                ColumnID = this.DesignedReportsColumnBusiness.InsertColumn(columnObj);

                break;

            case UIActionType.EDIT:
                if (selectedColumnID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoColumnSelectedforEdit").ToString()), retMessage);
                    return(retMessage);
                }
                ColumnID = this.DesignedReportsColumnBusiness.UpdateColumn(columnObj);
                break;

            case UIActionType.DELETE:
                if (selectedColumnID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoColumnSelectedforEdit").ToString()), retMessage);
                    return(retMessage);
                }
                ColumnID = this.DesignedReportsColumnBusiness.DeleteColumn(columnObj);
                break;
            }


            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            string SuccessMessageBody = string.Empty;
            switch (uam)
            {
            case UIActionType.ADD:
                SuccessMessageBody = GetLocalResourceObject("AddComplete").ToString();
                break;

            case UIActionType.EDIT:
                SuccessMessageBody = GetLocalResourceObject("EditComplete").ToString();
                break;

            case UIActionType.DELETE:
                SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                break;

            default:
                break;
            }
            retMessage[1] = SuccessMessageBody;
            retMessage[2] = "success";
            retMessage[3] = ColumnID.ToString();

            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }