public ActionResult Form(Functionality functionality, int index)
 {
     return View(new Form
     {
         Functionality = index >= 0 ? functionality : new Functionality(),
         Index = index
     });
 }
        private void buildChildren()
        {
            Functionality table     = new Functionality(this, FunctionalitiesCode.INPUT_TABLE, "Input Table", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);
            Functionality autoTable = new Functionality(this, FunctionalitiesCode.AUTOMATIC_SOURCING, "Automatic Sourcing for Table", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);

            /*
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_LIST, "Input Table List", true));
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_VIEW, "Input Table View", true));
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_EDIT, "Input Table Edit", true));
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_SOURCING, "Automatic Sourcing for Table List", true));
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_SOURCING_VIEW, "Automatic Sourcing for Table View", true));
             * table.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_SOURCING_EDIT, "Automatic Sourcing for Table Edit", true));
             */
            this.Children.Add(table);
            this.Children.Add(autoTable);

            Functionality grid     = new Functionality(this, FunctionalitiesCode.INPUT_TABLE_GRID, "Input Table Grid", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);
            Functionality autoGrid = new Functionality(this, FunctionalitiesCode.AUTOMATIC_INPUT_TABLE_GRID, "Automatic Sourcing for Table Grid", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);

            /*
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_GRID_LIST, "Input Table Grid List", true));
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_GRID_VIEW, "Input Table Grid View", true));
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.INPUT_TABLE_GRID_EDIT, "Input Table Grid Edit", true));
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_INPUT_TABLE_GRID_LIST, "Automatic Sourcing for Table Grid List", true));
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_INPUT_TABLE_GRID_VIEW, "Automatic Sourcing for Table Grid View", true));
             * grid.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_INPUT_TABLE_GRID_EDIT, "Automatic Sourcing for Table Grid Edit", true));
             */
            this.Children.Add(grid);
            this.Children.Add(autoGrid);

            Functionality linkedAttrGrid = new Functionality(this, FunctionalitiesCode.LINKED_ATTRIBUTE_GRID, "Linked Attribute Grid", true, RightType.VIEW, RightType.EDIT);

            this.Children.Add(linkedAttrGrid);

            Functionality target          = new Functionality(this, FunctionalitiesCode.TARGET, "Target", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);
            Functionality autoTargetTable = new Functionality(this, FunctionalitiesCode.AUTOMATIC_TARGET, "Automatic Sourcing for Target", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);

            /*
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.TARGET_LIST, "Target List", true));
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.TARGET_VIEW, "Target View", true));
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.TARGET_EDIT, "Target Edit", true));
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_TARGET_LIST, "Automatic Sourcing for Target List", true));
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_TARGET_VIEW, "Automatic Sourcing for Target View", true));
             * target.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_TARGET_EDIT, "Automatic Sourcing for Target Edit", true));
             */
            this.Children.Add(target);
            this.Children.Add(autoTargetTable);

            Functionality design = new Functionality(this, FunctionalitiesCode.DESIGN, "Design", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);

            /*
             * design.Children.Add(new Functionality(this, FunctionalitiesCode.DESIGN_LIST, "Design List", true));
             * design.Children.Add(new Functionality(this, FunctionalitiesCode.DESIGN_VIEW, "Design View", true));
             * design.Children.Add(new Functionality(this, FunctionalitiesCode.DESIGN_EDIT, "Design Edit", true));
             */
            this.Children.Add(design);

            Functionality enrichmentTable     = new Functionality(this, FunctionalitiesCode.ENRICHMENT_TABLE, "Enrichment Table", true);
            Functionality autoEnrichmentTable = new Functionality(this, FunctionalitiesCode.AUTOMATIC_ENRICHMENT_TABLE, "Automatic Sourcing for Enrichment Table", true, RightType.VIEW, RightType.EDIT, RightType.CREATE);

            /*
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.ENRICHMENT_TABLE_LIST, "Enrichment Table List", true));
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.ENRICHMENT_TABLE_VIEW, "Enrichment Table View", true));
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.ENRICHMENT_TABLE_EDIT, "Enrichment Table Edit", true));
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_ENRICHMENT_TABLE_LIST, "Automatic Sourcing for Enrichment Table List", true));
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_ENRICHMENT_TABLE_VIEW, "Automatic Sourcing for Enrichment Table View", true));
             * enrichmentTable.Children.Add(new Functionality(this, FunctionalitiesCode.AUTOMATIC_ENRICHMENT_TABLE_EDIT, "Automatic Sourcing for Enrichment Table Edit", true));
             */
            this.Children.Add(enrichmentTable);
            this.Children.Add(autoEnrichmentTable);

            Functionality accessories = new Functionality(this, FunctionalitiesCode.ACCESSORIES, "Accessories", true);

            /*
             * accessories.Children.Add(new Functionality(this, FunctionalitiesCode.MULTIPLE_FILES_UPLOAD, "Multiple files uplod", true));
             */
            this.Children.Add(accessories);
        }
 private void LoadData()
 {
     comboBoxSerializationFormats.Items.AddRange(Functionality.GetSupportedSerializationFormatsNames().ToArray());
     comboBoxSerializationFormats.SelectedIndex = 0;
 }
Example #4
0
        private void InitDBData()
        {
            try
            {
                //Entity Framework

                //***** Role *****//
                using (var db = new HKSupplyContext())
                {
                    var roleAdmin = new Role
                    {
                        RoleId      = "ADMIN",
                        Description = "Application Administrator",
                        Enabled     = true,
                        Remarks     = null
                    };

                    var roleOperator = new Role
                    {
                        RoleId      = "OPERATOR",
                        Description = "Operator",
                        Enabled     = true,
                        Remarks     = null
                    };

                    db.Roles.Add(roleAdmin);
                    db.Roles.Add(roleOperator);
                    db.SaveChanges();

                    //var query = from b in db.Roles
                    //            orderby b.RoleId
                    //            select b;
                    //foreach (var item in query)
                    //{
                    //    MessageBox.Show(item.Description);
                    //}

                    //*****users *****//

                    var userAdmin = new User
                    {
                        UserLogin  = "******",
                        Name       = "Administrator",
                        Password   = PasswordHelper.GetHash("adminpwd"),
                        UserRole   = roleAdmin,
                        Enabled    = true,
                        LastLogin  = null,
                        LastLogout = null,
                        Remarks    = null
                    };

                    var userMario = new User
                    {
                        UserLogin  = "******",
                        Name       = "Mario Ruz Martínez",
                        Password   = PasswordHelper.GetHash("mariopwd"),
                        UserRole   = roleAdmin,
                        Enabled    = true,
                        LastLogin  = null,
                        LastLogout = null,
                        Remarks    = null
                    };

                    var userOp1 = new User
                    {
                        UserLogin  = "******",
                        Name       = "Operator 1",
                        Password   = PasswordHelper.GetHash("op1pwd"),
                        UserRole   = roleOperator,
                        Enabled    = true,
                        LastLogin  = null,
                        LastLogout = null,
                        Remarks    = null
                    };

                    db.Users.Add(userAdmin);
                    db.Users.Add(userMario);
                    db.Users.Add(userOp1);

                    db.SaveChanges();

                    //var queryUser = from u in db.Users
                    //                orderby u.UserLogin
                    //                select u;

                    //foreach (var item in queryUser)
                    //{
                    //    MessageBox.Show(item.UserLogin);
                    //}

                    //***** Functionalities *****//

                    var funcUM = new Functionality
                    {
                        FunctionalityName = "UserManagement",
                        Category          = "Masters",
                        FormName          = "frmUserManagement"
                    };

                    var funcRM = new Functionality
                    {
                        FunctionalityName = "RoleManagement",
                        Category          = "Masters",
                        FormName          = "frmRoleManagement"
                    };

                    var funcFM = new Functionality
                    {
                        FunctionalityName = "FunctionalityManagement",
                        Category          = "Masters",
                        FormName          = "frmFunctionalityManagement"
                    };

                    var funcMMA = new Functionality
                    {
                        FunctionalityName = "MaterialsManagement",
                        Category          = "Masters",
                        FormName          = "frmMaterialsManagement"
                    };


                    db.Functionalities.Add(funcUM);
                    db.Functionalities.Add(funcRM);
                    db.Functionalities.Add(funcFM);
                    db.Functionalities.Add(funcMMA);
                    db.SaveChanges();

                    //var queryFunc = from f in db.Functionalities
                    //                orderby f.FunctionalityName
                    //                select f;

                    //foreach (var item in queryFunc)
                    //{
                    //    MessageBox.Show(item.FunctionalityName);
                    //}

                    //***** Functionalities Role *****//
                    var adminRole = db.Roles.FirstOrDefault(r => r.RoleId.Equals("ADMIN"));
                    var opRole    = db.Roles.FirstOrDefault(r => r.RoleId.Equals("OPERATOR"));

                    var funcUserManagement          = db.Functionalities.FirstOrDefault(f => f.FunctionalityName.Equals("UserManagement"));
                    var funcRoleManagement          = db.Functionalities.FirstOrDefault(f => f.FunctionalityName.Equals("RoleManagement"));
                    var funcFunctionalityManagement = db.Functionalities.FirstOrDefault(f => f.FunctionalityName.Equals("FunctionalityManagement"));
                    var funcMaterialsManagement     = db.Functionalities.FirstOrDefault(f => f.FunctionalityName.Equals("MaterialsManagement"));

                    var fr1 = new FunctionalityRole
                    {
                        RoleId          = adminRole.RoleId,
                        FunctionalityId = funcUserManagement.FunctionalityId,
                        Read            = true,
                        New             = true,
                        Modify          = true,
                    };

                    var fr2 = new FunctionalityRole
                    {
                        RoleId          = adminRole.RoleId,
                        FunctionalityId = funcRoleManagement.FunctionalityId,
                        Read            = true,
                        New             = true,
                        Modify          = true,
                    };

                    var fr3 = new FunctionalityRole
                    {
                        RoleId          = adminRole.RoleId,
                        FunctionalityId = funcFunctionalityManagement.FunctionalityId,
                        Read            = true,
                        New             = true,
                        Modify          = true,
                    };

                    var fr4 = new FunctionalityRole
                    {
                        RoleId          = adminRole.RoleId,
                        FunctionalityId = funcMaterialsManagement.FunctionalityId,
                        Read            = true,
                        New             = true,
                        Modify          = true,
                    };

                    var fr5 = new FunctionalityRole
                    {
                        RoleId          = opRole.RoleId,
                        FunctionalityId = funcMaterialsManagement.FunctionalityId,
                        Read            = true,
                        New             = false,
                        Modify          = false,
                    };

                    db.FunctionalitiesRole.Add(fr1);
                    db.FunctionalitiesRole.Add(fr2);
                    db.FunctionalitiesRole.Add(fr3);
                    db.FunctionalitiesRole.Add(fr4);
                    db.FunctionalitiesRole.Add(fr5);
                    db.SaveChanges();
                }
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public EncryptDecryptViewModel(string file, Functionality functionality)
 {
     this.File     = file;
     this.Function = functionality;
 }
    /// <summary>
    /// Tworzy QuestionPopup z dwoma odpowiedziami: "Tak" i "Nie"
    /// </summary>
    /// <param name="question">Pytanie, które ma zostać wyświetlone użytkownikowi</param>
    /// <param name="yesAction">Akcja wywoływana po wciśnięciu przycisku "Tak"</param>
    /// <param name="noAction">Akcja wywoływana po wciśnięciu przycisku "Nie"</param>
    /// <returns>QuestionPopup z odpowiedziami "Tak" "Nie"</returns>
    public static QuestionPopup CreateYesNoDialog(string question, PopupAction yesAction = null, PopupAction noAction = null)
    {
        QuestionPopup popup = new QuestionPopup(question);

        yesAction += delegate(Popup source)
        {
            source.onClose = null;
            Functionality.Destroy().Invoke(source);
        };
        popup.onClose += noAction;
        popup.AddButton(SettingsController.instance.languageController.GetWord("YES"), yesAction);
        popup.AddButton(SettingsController.instance.languageController.GetWord("NO"), Functionality.Destroy());

        return(popup);
    }
Example #7
0
        static void Main(string[] args)
        {
            bool userAllowed = false;

            while (!userAllowed)
            {
                Console.Write("Username: "******"Password: "******"admin" && pwd == "admin") //All ok
                {
                    userAllowed = true;
                }
                else //Wrong un/pwd - try again
                {
                    Console.Clear();
                    Console.WriteLine("Username or password incorrect, try again...");
                }
            }

            ConsoleKey mainKey = new ConsoleKey();

            while (mainKey != ConsoleKey.Escape)
            {
                Console.Clear();
                Console.WriteLine("Press any key to start, Escape to exit...");

                if ((mainKey = Console.ReadKey().Key) != ConsoleKey.Escape)
                {
                    Console.Clear();
                    Console.WriteLine("Sydvest-Bo  - H1 Case\n");

                    //Save the input and make it lowercase
                    string answer = Functionality.Select(new string[] { "Houses", "Owners", "Reservations", "Areas", "Seasons", "Inspectors", "Consultants", "Standards", "Weeks" }).ToLower();
                    Console.Clear();

                    object controlObj;
                    string targetTable;

                    bool validAnswer = true;
                    switch (answer)
                    {
                    case "houses":
                        controlObj  = new House();
                        targetTable = "Houses";
                        break;

                    case "owners":
                        controlObj  = new HouseOwner();
                        targetTable = "HouseOwners";
                        break;

                    case "reservations":
                        controlObj  = new Reservation();
                        targetTable = "Reservations";
                        break;

                    case "areas":
                        controlObj  = new Area();
                        targetTable = "Areas";
                        break;

                    case "seasons":
                        controlObj  = new Season();
                        targetTable = "SeasonPrices";
                        break;

                    case "inspectors":
                        controlObj  = new Inspector();
                        targetTable = "Inspectors";
                        break;

                    case "consultants":
                        controlObj  = new Consultant();
                        targetTable = "Consultants";
                        break;

                    case "standards":
                        controlObj  = new Standard();
                        targetTable = "Standards";
                        break;

                    case "weeks":
                        controlObj  = new Week();
                        targetTable = "Weeks";
                        break;

                    default:
                        controlObj  = new object();
                        targetTable = "";
                        validAnswer = false;
                        break;
                    }

                    if (validAnswer)
                    {
                        //Save the input and make it lowercase
                        string action = Functionality.Select(new string[] { "View", "Create", "Update", "Delete" }).ToLower();
                        Console.Clear();

                        switch (action)
                        {
                        case "view":
                            SqlHandler.View(controlObj, targetTable);
                            break;

                        case "create":
                            SqlHandler.Create(controlObj, targetTable);
                            break;

                        case "update":
                            SqlHandler.Update(controlObj, targetTable, typeof(Area));
                            break;

                        case "delete":
                            SqlHandler.Delete(controlObj, targetTable);
                            break;
                        }
                    }
                    else
                    {
                        Console.WriteLine("No match, try again...");
                    }

                    Console.ReadKey();
                }
            }
        }
Example #8
0
 public void SayHello(string name)
 {
     Functionality.SayHello(name);
 }
 public FunctionnalityGroupField(Functionality data)
 {
 }
Example #10
0
 public double CalculateHypotenuse(double a, double b)
 {
     return(Functionality.CalculateHypotenuse(a, b));
 }
Example #11
0
 public void SolveSquareEquation(double a, double b, double c)
 {
     Functionality.SolveSquareEquation(a, b, c);
 }
Example #12
0
 public RightGroup(Functionality functionality) : this()
 {
     this.RightField.SetFunctionality(functionality);
 }
Example #13
0
        void Run()
        {
            System.Console.WriteLine("Welcome to Reviews! Select an item from the menu:");
            int input = 0;

            Libraries.Classes.ConsoleIO io = new Libraries.Classes.ConsoleIO();
            Functionality func             = new Functionality();

            while (input != 9)
            {
                ////Libraries.Classes.DataHandler  dh = new Libraries.Classes.DataHandler();
                //XmlSerializer serializer = new XmlSerializer(typeof(List<Restaurant>));

                //DataHandler dh = new DataHandler();
                //List<Restaurant> restaurants = dh.Read();

                ////List<Restaurant> restaurants = new List<Restaurant>();
                //var rw = new List<Review>();
                //rw.Add(new Review(0, "Singh", 3));
                //rw.Add(new Review(1, "Ott", 2));
                //rw.Add(new Review(2, "Ash", 4));
                //var r = new Restaurant(0, "WendY", "123 W Main St",  "Tampa", "FL", 12345, rw);
                //restaurants.Add(r);
                //r = new Restaurant(1, "BurgerKing", "122 W Main St", "Tampa", "FL", 12345, rw);
                //restaurants.Add(r);
                //TextWriter writer = new StreamWriter("data.xml");

                //serializer.Serialize(writer, restaurants);
                //writer.Close();

                //restaurants[0].SortReviews("descending");

                System.Console.WriteLine("Select an item from the menu:");
                System.Console.WriteLine(io.MenuOptions());
                input = Convert.ToInt32(System.Console.ReadLine()); // Convert the input from string to an integer

                if (input == 1)
                {
                    // Ask if to display in ascending or descending order
                    System.Console.WriteLine("Ascending or Descending order: (A/D)");
                    var order = System.Console.ReadLine();
                    while (order.ToUpper() != "A" && order.ToUpper() != "D")
                    {
                        System.Console.WriteLine("Please enter A or D");
                        order = System.Console.ReadLine();
                    }

                    List <Libraries.Classes.Restaurant> result = new List <Libraries.Classes.Restaurant>();
                    if (order.ToUpper() == "A")
                    {
                        result = io.GetAll("ascending");
                    }
                    else
                    {
                        result = io.GetAll("descending");
                    }

                    // Output the restaurants
                    int count = 1;
                    foreach (var rest in result)
                    {
                        System.Console.WriteLine(count + ".)\t" + rest.ToString());
                        count++;
                    }

                    System.Console.WriteLine("Select a Restaurant");
                    input = Convert.ToInt32(System.Console.ReadLine());
                    while (input > count || input < 1)
                    {
                        System.Console.WriteLine("Select a Restaurant:");
                        input = Convert.ToInt32(System.Console.ReadLine());
                    }

                    int restID = result[input - 1].RestaurantID;

                    // Display the review options
                    System.Console.WriteLine("Select an option:");
                    System.Console.WriteLine(io.RestaurantOptions());
                    input = Convert.ToInt32(System.Console.ReadLine());

                    if (input != 9)
                    {
                        while (input < 1 || input > 2)
                        {
                            System.Console.WriteLine(io.RestaurantOptions());
                            input = Convert.ToInt32(System.Console.ReadLine());
                            if (input == 9)
                            {
                                break;
                            }
                        }
                        List <Libraries.Classes.Review> reviews = new List <Libraries.Classes.Review>();
                        if (input != 9)
                        {
                            reviews = io.AllReviews(restID, input);
                        }
                        else
                        {
                            break;
                        }

                        // Output all of the reviews
                        foreach (var review in reviews)
                        {
                            System.Console.WriteLine(review.ToString());
                        }
                    }
                }
                else if (input == 2)
                {
                    // Sort the Reviews
                    //AccessHelper ah = new AccessHelper();
                    //ah.UpdateAverageRating();

                    System.Console.WriteLine(func.PrintTopThreeRestaurants());
                }
                else if (input == 3)
                {
                    //AccessHelper ah = new AccessHelper();
                    //var rests = ah.GetAllRestaurants();
                    //var rests = func.AllRestaurants();
                    //int count = 1;
                    //foreach (var r in rests)
                    //{
                    //    System.Console.WriteLine(count + ".)\t" + r.ToString());
                    //    count++;
                    //}
                }

                if (input == 9)
                {
                    Quit();
                }
            }
        }
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if (Category.Expression != null)
            {
                targetCommand.AddParameter("Category", Category.Get(context));
            }

            if (Component.Expression != null)
            {
                targetCommand.AddParameter("Component", Component.Get(context));
            }

            if (Functionality.Expression != null)
            {
                targetCommand.AddParameter("Functionality", Functionality.Get(context));
            }

            if (Role.Expression != null)
            {
                targetCommand.AddParameter("Role", Role.Get(context));
            }

            if (Detailed.Expression != null)
            {
                targetCommand.AddParameter("Detailed", Detailed.Get(context));
            }

            if (Full.Expression != null)
            {
                targetCommand.AddParameter("Full", Full.Get(context));
            }

            if (Examples.Expression != null)
            {
                targetCommand.AddParameter("Examples", Examples.Get(context));
            }

            if (Parameter.Expression != null)
            {
                targetCommand.AddParameter("Parameter", Parameter.Get(context));
            }

            if (Online.Expression != null)
            {
                targetCommand.AddParameter("Online", Online.Get(context));
            }

            if (ShowWindow.Expression != null)
            {
                targetCommand.AddParameter("ShowWindow", ShowWindow.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
        public static int Delete(Functionality Functionality)
        {
            dFunctionality _dFunctionality = new dFunctionality();

            return(_dFunctionality.Delete(Functionality));
        }
Example #16
0
 protected RightField(Functionality functionality) : this()
 {
     SetFunctionality(functionality);
 }
        public static Functionality Create(Functionality Functionality)
        {
            dFunctionality _dFunctionality = new dFunctionality();

            return(_dFunctionality.Create(Functionality));
        }
Example #18
0
        public void AddChild(Functionality functionality)
        {
            RightField field = new RightField(functionality);

            AddChild(field);
        }
        static void Main(string[] args)
        {
            var functionality = new Functionality();

            functionality.Run();
        }
Example #20
0
        /// <summary>
        /// Dar de alta una funcionalidad
        /// </summary>
        /// <param name="newFunctionality"></param>
        /// <returns></returns>
        public Functionality NewFunctionality(Functionality newFunctionality)
        {
            try
            {
                if (newFunctionality == null)
                {
                    throw new ArgumentNullException();
                }

                using (var db = new HKSupplyContext())
                {
                    var functionality = db.Functionalities.FirstOrDefault(f => f.FunctionalityName.Equals(newFunctionality.FunctionalityName));

                    if (functionality != null)
                    {
                        throw new NewExistingFunctionalityException(GlobalSetting.ResManager.GetString("FunctionalityAlreadyExist"));
                    }

                    db.Functionalities.Add(newFunctionality);
                    db.SaveChanges();

                    return(GetFunctionalityByName(newFunctionality.FunctionalityName));
                }
            }
            catch (ArgumentNullException anex)
            {
                _log.Error(anex.Message, anex);
                throw anex;
            }
            catch (NewExistingFunctionalityException afeex)
            {
                _log.Error(afeex.Message, afeex);
                throw afeex;
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    _log.Error("Entity of type \"" + eve.Entry.Entity.GetType().Name + "\" in state \"" + eve.Entry.State + "\" has the following validation errors:");
                    foreach (var ve in eve.ValidationErrors)
                    {
                        _log.Error("- Property: \"" + ve.PropertyName + "\", Error: \"" + ve.ErrorMessage + "\"");
                    }
                }
                throw e;
            }
            catch (SqlException sqlex)
            {
                for (int i = 0; i < sqlex.Errors.Count; i++)
                {
                    _log.Error("Index #" + i + "\n" +
                               "Message: " + sqlex.Errors[i].Message + "\n" +
                               "Error Number: " + sqlex.Errors[i].Number + "\n" +
                               "LineNumber: " + sqlex.Errors[i].LineNumber + "\n" +
                               "Source: " + sqlex.Errors[i].Source + "\n" +
                               "Procedure: " + sqlex.Errors[i].Procedure + "\n");

                    switch (sqlex.Errors[i].Number)
                    {
                    case -1:     //connection broken
                    case -2:     //timeout
                        throw new DBServerConnectionException(GlobalSetting.ResManager.GetString("DBServerConnectionError"));
                    }
                }
                throw sqlex;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                throw ex;
            }
        }