Ejemplo n.º 1
0
 public string PutFunctionCategory(int id, FunctionCategory f)
 {
     try
     {
         var fn = (from fc in es.Function_Category
                   where fc.Function_Category_ID == id
                   select fc).SingleOrDefault();
         if (fn == null)
         {
             return("Id invalid");
         }
         else
         {
             fn.Function_Category1 = f.Function_Category;
             var res = es.SaveChanges();
             if (res > 0)
             {
                 return("Data Uploaded");
             }
         }
         return("Error In Updating Data");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// Loads a single function from a DataRow of the MDSCHEMA_FUNCTIONS rowset.
        /// </summary>
        /// <param name="parameterInfoRelation">Relationship to follow to get to parameters
        /// info.</param>
        /// <param name="row">DataRow to load data from</param>
        private DaxFunction LoadFunctionDataRow(DataRelation parameterInfoRelation, DataRow row)
        {
            string           functionName        = row[FUNCTIONS_FIELD_NAME] as string;
            string           functionDescription = row[FUNCTIONS_FIELD_DESCRIPTION] as string;
            FunctionCategory functionCategory    = DaxFunction.ConvertFunctionCategory(row[FUNCTIONS_FIELD_CATEGORY] as string);

            // Function name cannot be empty.
            Debug.Assert(!string.IsNullOrEmpty(functionName), "Function name cannot be empty.");

            List <DaxFunctionParam> parameters = new List <DaxFunctionParam>();

            DataRow[] parameterRows = row.GetChildRows(parameterInfoRelation);
            foreach (DataRow parameterRow in parameterRows)
            {
                string name       = (string)parameterRow[PARAMETERS_FIELD_NAME];
                bool   optional   = (bool)parameterRow[PARAMETERS_FIELD_OPTIONAL];
                bool   repeatable = (bool)parameterRow[PARAMETERS_FIELD_REPEATABLE];

                DaxFunctionParam parameter = new DaxFunctionParam(name, FormulaType.Any, repeatable, optional);
                parameters.Add(parameter);
            }

            DaxFunction function = new DaxFunction(functionName, functionDescription, functionCategory, FormulaType.Any, parameters);

            return(function);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initialize a DAXFunction object with specific values
 /// </summary>
 /// <param name="name">The function name</param>
 /// <param name="description">The function description</param>
 /// <param name="category">The category the function belongs to</param>
 /// <param name="returnType">The return type of the function.</param>
 /// <param name="functionParameters">A list of function parameters</param>
 internal DaxFunction(string name, string description, FunctionCategory category,
                      FormulaType returnType, List <DaxFunctionParam> functionParameters)
 {
     this.Name                = name;
     this.ReturnType          = returnType;
     this.ParameterCollection = functionParameters;
     this.Description         = description;
     this.Category            = category;
 }
Ejemplo n.º 4
0
 public FunctionCategory GetByIdFunctionCategory(int id)
 {
     try
     {
         FunctionCategory fn = new FunctionCategory();
         var r = es.Function_Category.Where(x => x.Function_Category_ID == id).SingleOrDefault();
         fn.Function_Category_ID = r.Function_Category_ID;
         fn.Function_Category    = r.Function_Category1;
         return(fn);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// Finds out a category of an expression
 /// To be precise, finds out whether expr belongs to cat
 /// </summary>
 /// <param name="expr"></param>
 /// <param name="cat"></param>
 /// <returns></returns>
 private static bool Contains(Entity expr, FunctionCategory cat)
 {
     if (cat.Contains(expr.Name))
     {
         return(true);
     }
     foreach (var child in expr.Children)
     {
         if (Contains(child, cat))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 6
0
 public IEnumerable <FunctionCategory> GetIFunctionCategory()
 {
     try
     {
         List <FunctionCategory> fc = new List <FunctionCategory>();
         var res = es.Function_Category.ToArray();
         foreach (var r in res)
         {
             FunctionCategory fn = new FunctionCategory();
             fn.Function_Category_ID = r.Function_Category_ID;
             fn.Function_Category    = r.Function_Category1;
             fc.Add(fn);
         }
         return(fc);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 7
0
 public bool PostFunctionCategory(FunctionCategory r)
 {
     try
     {
         Function_Category fn = new Function_Category();
         fn.Function_Category1 = r.Function_Category;
         es.Function_Category.Add(fn);
         var res = es.SaveChanges();
         if (res > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 8
0
 public string PutFunctionCategory(FunctionCategory d, int id)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
        public bool SupportCategory(FunctionScenarioType type, FunctionCategory category)
        {
            if (type == FunctionScenarioType.Unspecified)
            {
                return(true);
            }
            FunctionCategory[] categories = null;
            switch (type)
            {
            case FunctionScenarioType.Unspecified:
                categories = new FunctionCategory[] {
                };
                break;

            case FunctionScenarioType.Router:
                categories = new FunctionCategory[] {
                    FunctionCategory.Math,
                    FunctionCategory.Text,
                    FunctionCategory.Time,
                    FunctionCategory.Logic,
                    FunctionCategory.Organization,
                    FunctionCategory.Other
                };
                break;

            case FunctionScenarioType.Computation:
                categories = new FunctionCategory[] {
                    FunctionCategory.Math,
                    FunctionCategory.Text,
                    FunctionCategory.Time,
                    FunctionCategory.Logic,
                    FunctionCategory.Other
                };
                break;

            case FunctionScenarioType.Submit:
                categories = new FunctionCategory[] {
                    FunctionCategory.Math,
                    FunctionCategory.Text,
                    FunctionCategory.Time,
                    FunctionCategory.Logic,
                    FunctionCategory.Organization,
                    FunctionCategory.Other
                };
                break;

            case FunctionScenarioType.Business:
                categories = new FunctionCategory[] {
                    FunctionCategory.Math,
                    FunctionCategory.Time,
                    FunctionCategory.Logic,
                    FunctionCategory.BackMethod,
                    FunctionCategory.Other
                };
                break;

            case FunctionScenarioType.AssociationFilter:
                categories = new FunctionCategory[] {
                    FunctionCategory.Math,
                    FunctionCategory.Text,
                    FunctionCategory.Time,
                    FunctionCategory.Logic,
                    FunctionCategory.Other
                };
                break;

            case FunctionScenarioType.ReportSource:
                categories = new FunctionCategory[] {
                    FunctionCategory.Time,
                    FunctionCategory.Logic
                };
                break;

            default:
                categories = new FunctionCategory[] { };
                break;
            }
            return(categories.Contains(category));
        }
Ejemplo n.º 10
0
 public string put(int id, FunctionCategory fd)
 {
     return(fc.PutFunctionCategory(id, fd));
 }
Ejemplo n.º 11
0
 public bool post([FromBody] FunctionCategory fd)
 {
     return(fc.PostFunctionCategory(fd));
 }
Ejemplo n.º 12
0
    private void ShowGroupButtons()
    {
        if (GUI.Button(GetGoBackRect(), "Go to Basic Functions View"))
        {
            uiStyle = ViewKind.Basic;
        }

        if (GUI.Button(GetLeftRect1(), "Notice"))
        {
            functionCategory = FunctionCategory.Notice;
        }

        if (GUI.Button(GetMiddleRect1(), "Preferences"))
        {
            functionCategory = FunctionCategory.Preferences;
        }

        if (GUI.Button(GetRightRect1(), "Purpose-1"))
        {
            functionCategory = FunctionCategory.Purpose_1;
        }

        if (GUI.Button(GetLeftRect2(), "Purpose-2"))
        {
            functionCategory = FunctionCategory.Purpose_2;
        }

        if (GUI.Button(GetMiddleRect2(), "Vendor-1"))
        {
            functionCategory = FunctionCategory.Vendor_1;
        }

        if (GUI.Button(GetRightRect2(), "Vendor-2"))
        {
            functionCategory = FunctionCategory.Vendor_2;
        }

        if (GUI.Button(GetLeftRect3(), "Consent-1"))
        {
            functionCategory = FunctionCategory.Consent_1;
        }

        if (GUI.Button(GetMiddleRect3(), "Consent-2"))
        {
            functionCategory = FunctionCategory.Consent_2;
        }

        if (GUI.Button(GetRightRect3(), "Consent-3"))
        {
            functionCategory = FunctionCategory.Consent_3;
        }

        if (GUI.Button(GetLeftRect4(), "Language"))
        {
            functionCategory = FunctionCategory.Language;
        }

        if (GUI.Button(GetMiddleRect4(), "Initialization"))
        {
            functionCategory = FunctionCategory.Initialization;
        }

        if (GUI.Button(GetRightRect4(), "Events"))
        {
            functionCategory = FunctionCategory.Events;
        }

        if (GUI.Button(GetLeftRect5(), "Legitimate"))
        {
            functionCategory = FunctionCategory.Legitimate;
        }

        if (GUI.Button(GetMiddleRect5(), "GetUserStatus"))
        {
            functionCategory = FunctionCategory.GetUserStatus;
        }

        if (GUI.Button(GetRightRect5(), "Tests"))
        {
            functionCategory = FunctionCategory.Tests;
        }
    }
Ejemplo n.º 13
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="model">实体</param>
 public void Delete(FunctionCategory model)
 {
     dal.Delete <FunctionCategory>(model);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model">实体</param>
 public void Update(FunctionCategory model)
 {
     dal.Update <FunctionCategory>(model);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns>主键值</returns>
 public object Add(FunctionCategory model)
 {
     return(dal.Add <FunctionCategory>(model));
 }