public void Dashboard_Setting_AllAttributeGroups()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);

                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList allAttributeGroupsInSql = test.SQL.Dashboard_AttributeGroup_GetAllAttributeGroups(churchId);
                ArrayList allWidgetsOnPage        = settings.getAllWidgetsNamesOnPage(settings.getWidgetsTotalOnPage());

                TestLog.WriteLine(allAttributeGroupsInSql.Count);
                Assert.IsTrue(allWidgetsOnPage.Count >= allAttributeGroupsInSql.Count + 1);

                foreach (string widget in allWidgetsOnPage)
                {
                    bool flag = false;
                    TestLog.WriteLine(widget.ToString());
                    foreach (string wedgetInDb in allAttributeGroupsInSql)
                    {
                        if (widget.Contains("Giving") || widget.Contains("Attendance") || widget.Replace(" ", "").Contains(wedgetInDb.Replace(" ", "")))
                        {
                            flag = true;
                            TestLog.WriteLine(widget.ToString() + "|" + wedgetInDb.ToString());
                        }
                    }
                    Assert.IsTrue(flag);
                }
            }
            finally
            {
                //clear test data
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (this.Session["admin"] == null)
         {
             base.Response.Redirect("/account/Login.aspx");
         }
         if (GeneralMethods.GetPermissions(HttpContext.Current.Request.Url.ToString(), this.Session["admin"].ToString()))
         {
             base.Response.Redirect("/Index.aspx");
         }
         if ((base.Request.QueryString["id"].ToString() != null) && (base.Request.QueryString["id"].ToString().Trim().Length > 0))
         {
             id = base.Request.QueryString["id"].ToString();
         }
         Model.SelectRecord selectRecord = new Model.SelectRecord("Organizational", "", "*", "where ID=" + id);
         DataSet            set          = BLL.SelectRecord.SelectRecordData(selectRecord);
         this.txtClassName.Text = set.Tables[0].Rows[0]["Name"].ToString();
         BLL.Organizational.BindToDropDownList(this.ddlRootID, set.Tables[0].Rows[0]["PID"].ToString());
     }
 }
Esempio n. 3
0
        public NodeChain(NodeTree nodeTree, Node startingNode)
        {
            Variables = nodeTree.Variables;

            nodeTree = GeneralMethods.CopyObject(nodeTree);

            NodeTreeName = nodeTree.Name;
            CurrentNode  = nodeTree.Nodes.FirstOrDefault(n => n.ID == startingNode.ID);
            if (CurrentNode == null)
            {
                throw new Exception("Error: Node chain could not find starting node.");
            }

            Name        = CurrentNode.NodeChainName;
            Nodes       = NodeHelper.GetChainAsNodes(CurrentNode, nodeTree);
            ReturnType  = ((StartNode)CurrentNode).ReturnType;
            IntValue    = 0;
            ObjectValue = null;
            Done        = false;
            InitRefs();
            Variables.ForEach(v => v.ResetValue());
        }
Esempio n. 4
0
        private void btnPartsDoNotExist_Click(object sender, RoutedEventArgs e)
        {
            Button    btnRemovedMediaItem = sender as Button;
            MediaItem mediaItem           = btnRemovedMediaItem.DataContext as MediaItem;

            IntelligentString message = "The following parts belonging to " + mediaItem.Name + " do not exist:" + Environment.NewLine + Environment.NewLine;

            foreach (MediaItemPart part in mediaItem.Parts)
            {
                if (!File.Exists(part.Location.Value))
                {
                    message += part.IndexString + ": " + part.Location + Environment.NewLine;
                }
            }

            message += Environment.NewLine + "Delete " + mediaItem.Name + "?";

            if (GeneralMethods.MessageBox(message.Value, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                mivSongs.RemoveMediaItems(mediaItem);
            }
        }
Esempio n. 5
0
    /// <summary>
    /// Sets move speed based on current character data.
    /// </summary>
    private void RefreshMoveSpeed()
    {
        // get current surface-level character data
        CharacterData frontFacingCharData = GeneralMethods.
                                            GetFrontFacingCharacterDataFromCharMaster(_charMaster);

        // if char data found
        if (frontFacingCharData != null)
        {
            // set move speed to the char's movement stat
            moveSpeed = frontFacingCharData.characterStats.statMovementSpeed;
        }
        // else no data found
        else
        {
            // set move speed to some default value
            moveSpeed = 1f;
        }

        // set navigation speed based on current movement properties
        RefreshNavigationSpeed();
    }
Esempio n. 6
0
        public void Dashboard_Login_GetAccessToken()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                DashboardAPIBase api      = new DashboardAPIBase();
                HttpWebResponse  response = api.getAccessTokenObject(api.ConsumerKey, api.ConsumerSecret, api.Username, api.Password, api.ChurchCode);
                AccessToken      token    = api.JsonToObject <AccessToken>(response);

                TestLog.WriteLine(string.Format("{0}|{1}|{2}|{3}", token.user.firstName, token.user.lastName, token.accessToken, token.tokenType));
                Assert.AreEqual("FT", token.user.firstName);

                test.Dashboard.LoginWebDriver();
                Assert.IsTrue(utility.IsElementExist(By.Id("settings")));
            }
            finally
            {
                //clear test data
            }
        }
Esempio n. 7
0
 public override void AI()
 {
     if (Phase == (int)ExtraStates.Death)
     {
         npc.damage         = 0;
         npc.ai[2]         += 1f; // increase our death timer.
         npc.netUpdate      = true;
         npc.velocity.X     = 0;
         npc.velocity.Y    += 1.5f;
         npc.dontTakeDamage = true;
         npc.rotation       = GeneralMethods.ManualMobRotation(npc.rotation, MathHelper.ToRadians(90f), 8f);
         if (npc.ai[2] >= 110f)
         {
             for (int i = 0; i < 20; i++)
             {
                 int dustIndex = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustType <Dusts.Poof>(), 0f, 0f, 100, default(Color), 1f); //spawns ender dust
                 Main.dust[dustIndex].noGravity = true;
             }
             npc.life = 0;
         }
     }
 }
Esempio n. 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         if (this.Session["admin"] == null)
         {
             base.Response.Redirect("/account/Login.aspx");
         }
         if (GeneralMethods.GetPermissions(HttpContext.Current.Request.Url.ToString(), this.Session["admin"].ToString()))
         {
             base.Response.Redirect("/Index.aspx");
         }
         if ((base.Request.QueryString["pid"] != null) && (base.Request.QueryString["pid"].Trim() != ""))
         {
             this.pid = base.Request.QueryString["pid"].Trim();
         }
         Model.SelectRecord selectRecord = new Model.SelectRecord("Organizational", "", "ID,Name,PID", "where pid = '" + pid + "'");
         DataTable          dt           = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0];
         this.gvClass.DataSource = dt;
         this.gvClass.DataBind();
     }
 }
        /// <summary>
        /// Adds a new root folder to the system
        /// </summary>
        private void AddRootFolder()
        {
            try
            {
                if (IsOrganising)
                {
                    GeneralMethods.MessageBoxApplicationError("Please wait for the library to finish organising before adding any root folders");
                    return;
                }

                RootFolderDialog rootFolderDialog = new RootFolderDialog(GetTags(), AssociatedType);
                rootFolderDialog.Owner        = Application.Current.MainWindow;
                rootFolderDialog.PathChanged += rootFolderDialog_PathChanged;

                if (GeneralMethods.GetNullableBoolValue(rootFolderDialog.ShowDialog()))
                {
                    List <RootFolder> rootFolders = new List <RootFolder>(RootFolders);
                    rootFolders.Add(rootFolderDialog.SelectedRootFolder);
                    rootFolders.Sort();

                    List <SortDescription> sortDescriptions = new List <SortDescription>(SortDescriptions);

                    RootFolders = rootFolders.ToArray();

                    SortDescriptions.Clear();

                    foreach (SortDescription sortDescription in sortDescriptions)
                    {
                        SortDescriptions.Add(sortDescription);
                    }

                    dgRootFolders.SelectedItem = rootFolderDialog.SelectedRootFolder;
                }
            }
            catch (System.Exception e)
            {
                GeneralMethods.MessageBoxException(e, "Could not add root folder: ");
            }
        }
Esempio n. 10
0
        public ActionResult VehiclePrice()
        {
            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("NewLogin", "Home"));
            }
            dealerCode = Session["DealerCode"].ToString();

            //List<SelectListItem> ddlVehicle = new List<SelectListItem>();
            //ddlVehicle = GeneralMethods.GetDataFromSPWithDealerCode("SP_Vehicles", dealerCode,"Y");
            //ViewBag.Vehicle = ddlVehicle;

            List <VehicleVM> lstVehicle = VehicleMethods.GetVehicleModal(dealerCode);

            ViewBag.Vehicles      = lstVehicle;
            Session["lstVehicle"] = lstVehicle;

            List <SelectListItem> ddlBrand = new List <SelectListItem>();

            ddlBrand     = GeneralMethods.GetDataFromSPWithDealerCode("Select_Brand", dealerCode, "Y");
            ViewBag.Made = ddlBrand;

            List <SelectListItem> ddlVehicleType = new List <SelectListItem>();

            ddlVehicleType      = GeneralMethods.GetDataFromSPWithDealerCode("Select_VehicleType", dealerCode);
            ViewBag.VehicleType = ddlVehicleType;

            List <SelectListItem> ddlColor = new List <SelectListItem>();

            ddlColor      = GeneralMethods.GetColor();
            ViewBag.Color = ddlColor;
            List <VehicleVM> Get_AccDesc = new List <VehicleVM>();

            Get_AccDesc         = VehicleMethods.Get_AccDesc(dealerCode);
            ViewBag.Get_AccDesc = Get_AccDesc;


            return(View());
        }
        // GET: SalesQuotation
        public ActionResult SQMain()
        {
            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("NewLogin", "Home"));
            }
            dealerCode = Session["DealerCode"].ToString();

            List <SelectListItem> ddlCusType = new List <SelectListItem>();

            ddlCusType      = BookingOrderMethods.GetDataFromSPWithDealerCode("SP_SelectCustomerType", dealerCode);
            ViewBag.CusType = ddlCusType;

            List <SelectListItem> ddlBrandCode = new List <SelectListItem>();

            ddlBrandCode      = GeneralMethods.GetDataFromSPWithDealerCode("Select_Brand", dealerCode, "Y");
            ViewBag.BrandCode = ddlBrandCode;

            List <SelectListItem> ddlProdCode = new List <SelectListItem>();

            //ddlProdCode = GeneralMethods.GetProduct();
            ViewBag.ProdCode = ddlProdCode;
            List <SelectListItem> ddlVersion = new List <SelectListItem>();

            ddlVersion         = GeneralMethods.GetDataFromSp("Select_Version");
            ViewBag.ddlVersion = ddlVersion;
            List <SelectListItem> ddlColor = new List <SelectListItem>();

            ddlColor      = GeneralMethods.GetColor(Session["VehicleCategory"].ToString());
            ViewBag.Color = ddlColor;

            List <SelectListItem> ddlChassisNo = new List <SelectListItem>();

            ddlChassisNo      = BookingOrderMethods.GetDataFromSPWithDealerCode("SP_SelectChassisNo", dealerCode);
            ViewBag.ChassisNo = ddlChassisNo;


            return(View());
        }
Esempio n. 12
0
    void Start()
    {
        if (TargetLockObject.name == "TargetLock")
        {
            TargetLockObject.SetActive(false);
        }

        if (!Rm_RPGHandler.Instance.Combat.ShowSelected)
        {
            return;
        }


        ShowWithTexture = Rm_RPGHandler.Instance.Combat.ShowSelectedWithTexture;
        if (ShowWithTexture)
        {
            _material = TargetLockObject.GetComponent <MeshRenderer>().materials[0];
            TargetLockObject.SetActive(false);
            TargetLockObject.transform.SetY(Rm_RPGHandler.Instance.Combat.SelectedYOffSet);
            var radius = GetComponent <NavMeshAgent>().radius;
            TargetLockObject.transform.localScale  = new Vector3(BasePlaneScale, 0.001f, BasePlaneScale);
            TargetLockObject.transform.localScale *= (radius * 2);
        }
        else
        {
            var t = transform.Find("TargetLockPrefab");
            if (t == null)
            {
                t      = GeneralMethods.SpawnPrefab(Rm_RPGHandler.Instance.Combat.SelectedPrefabPath, transform.position, transform.rotation, transform).transform;
                t.name = "TargetLockPrefab";
            }

            TargetLockObject = t.gameObject;
            TargetLockPrefab = TargetLockObject.GetComponent <TargetLockPrefab>();
            TargetLockPrefab.Set(TargetLockState.Unselected);
        }

        State = TargetLockState.Unselected;
    }
Esempio n. 13
0
        public ActionResult LoginRequest(string user, string pass)
        {
            SysFunction myFunc = new SysFunction();

            List <DealerInfoVM> result;

            string msg = "Invalid Login..";

            //  result = GeneralMethods.LoginRequest(user,pass,ref msg);
            result = GeneralMethods.LoginRequestSecurity(user, pass, ref msg);

            if (result.Count > 0)
            {
                this.Session["UserID"]     = result.FirstOrDefault().UserID;
                this.Session["DealerCode"] = result.FirstOrDefault().DealerCode;
                this.Session["UserName"]   = result.FirstOrDefault().UserName;
                //this.Session["UserName"] = myFunc.ActiveUserName(this.Session["UserID"].ToString(), this.Session["DealerCode"].ToString());
                this.Session["EmpName"] = result.FirstOrDefault().EmpName;
                this.Session["EmpCode"] = result.FirstOrDefault().EmpCode;
                Session["userId"]       = result.FirstOrDefault().EmpCode;

                this.Session["DealerDesc"]      = result.FirstOrDefault().DealerDesc;
                this.Session["DealerAddress"]   = result.FirstOrDefault().Address1 + ", " + result.FirstOrDefault().Address2 + ", " + result.FirstOrDefault().Address3;
                this.Session["DealerEmail"]     = result.FirstOrDefault().Email;
                this.Session["DealerFax"]       = result.FirstOrDefault().Fax;
                this.Session["DealerPhone"]     = result.FirstOrDefault().Phone1 + "," + result.FirstOrDefault().Phone2;
                this.Session["Image"]           = result.FirstOrDefault().Logo;
                this.Session["Logo"]            = result.FirstOrDefault().Logo;
                this.Session["DealerNTN"]       = result.FirstOrDefault().NTN;
                this.Session["DealerSaleTaxNo"] = result.FirstOrDefault().SaleTaxNo;
                this.Session["VehicleCategory"] = result.FirstOrDefault().VehicleCategory;
                Authenticate(user, pass);
                GlobalVar.mDealerCode = result.FirstOrDefault().DealerCode;
                // Authenticate(user, pass);

                return(Json(new { result = "Redirect", url = Url.Action("Dashboard", "Home") }));
            }
            return(Json(new { result = msg }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        void AssociatedObject_Tap(object sender, GestureEventArgs e)
        {
            Storyboard s = new Storyboard();

            Image  rect = GeneralMethods.FindChild <Image>(this.AssociatedObject, "ImageMask");
            Border b    = (Border)sender;
            Photo  item = b.DataContext as Photo;

            DoubleAnimation doubleAnimation = new DoubleAnimation();

            doubleAnimation.From     = item.IsSelected ? 0 : 1;
            doubleAnimation.To       = item.IsSelected ? 1 : 0;
            doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5));

            s.Children.Add(doubleAnimation);
            s.Duration = new Duration(TimeSpan.FromSeconds(1));

            Storyboard.SetTarget(doubleAnimation, rect);
            Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(Rectangle.OpacityProperty));

            s.Begin();
        }
Esempio n. 15
0
        private void cmMediaItems_Opened(object sender, RoutedEventArgs e)
        {
            int     selectedItemCount  = SelectedMediaItems.Length;
            Boolean singleTypeSelected = Convert.ToBoolean(selectedItemCount);

            if (selectedItemCount > 1)
            {
                singleTypeSelected = !SelectedMediaItems.Any(p => p.Type != SelectedMediaItems[0].Type);
            }

            Visibility playOptionsVisibility = GeneralMethods.ConvertBooleanToVisibility(EnablePlayOptions);

            miPlay.Visibility               = playOptionsVisibility;
            miPlay.IsEnabled                = selectedItemCount >= 1;
            miPlayFromHere.Visibility       = playOptionsVisibility;
            miPlayFromHere.IsEnabled        = selectedItemCount == 1;
            miAddToNowPlaying.Visibility    = playOptionsVisibility;
            miAddToNowPlaying.IsEnabled     = selectedItemCount >= 1;
            sepPlay.Visibility              = playOptionsVisibility;
            miShowInExplorer.IsEnabled      = selectedItemCount >= 1;
            miEdit.IsEnabled                = selectedItemCount >= 1;
            miModify.IsEnabled              = (singleTypeSelected && (selectedItemCount >= 1));
            miDelete.IsEnabled              = selectedItemCount >= 1;
            miMergeParts.Visibility         = GeneralMethods.ConvertBooleanToVisibility(AllowMergeExtract);
            miMergeParts.IsEnabled          = (singleTypeSelected && (selectedItemCount > 1));
            miSetNameFromFilename.IsEnabled = (selectedItemCount > 0);
            miSetEpisodeNumber.Visibility   = GeneralMethods.ConvertBooleanToVisibility((selectedItemCount > 0) && (singleTypeSelected) && (SelectedMediaItems[0].Type == MediaItemTypeEnum.Video));
            miSetEpisodeNumber.IsEnabled    = selectedItemCount >= 1;
            miSetNumberOfEpisodesToSelectionCount.Visibility = GeneralMethods.ConvertBooleanToVisibility((selectedItemCount > 0) && (singleTypeSelected) && (SelectedMediaItems[0].Type == MediaItemTypeEnum.Video));
            miSetNumberOfEpisodesToSelectionCount.IsEnabled  = selectedItemCount >= 1;
            miSetTrackNumber.Visibility = GeneralMethods.ConvertBooleanToVisibility((selectedItemCount > 0) && (singleTypeSelected) && (SelectedMediaItems[0].Type == MediaItemTypeEnum.Song));
            miSetTrackNumber.IsEnabled  = selectedItemCount >= 1;
            miSetNumberOfTracksToSelectionCount.Visibility = GeneralMethods.ConvertBooleanToVisibility((selectedItemCount > 0) && (singleTypeSelected) && (SelectedMediaItems[0].Type == MediaItemTypeEnum.Song));
            miSetNumberOfTracksToSelectionCount.IsEnabled  = selectedItemCount >= 1;
            miTags.IsEnabled     = (selectedItemCount == 1) && (SelectedMediaItem.Tags.Count > 0);
            miTags.ItemsSource   = (SelectedMediaItem == null ? null : SelectedMediaItem.Tags);
            miExport.IsEnabled   = (selectedItemCount > 0) && (ExportDirectories != null) && (ExportDirectories.Count > 0);
            miExport.ItemsSource = ExportDirectories;
        }
        /// <summary>
        /// Deletes the selected file types from the system
        /// </summary>
        private void DeleteSelectedFileTypes()
        {
            try
            {
                List <FileType> selectedFileTypes = new List <FileType>();

                foreach (FileType fileType in dgFileTypes.SelectedItems)
                {
                    selectedFileTypes.Add(fileType);
                }

                MessageBoxResult result;

                switch (selectedFileTypes.Count)
                {
                case 0:
                    GeneralMethods.MessageBoxApplicationError("Please select 1 or more file types to delete");
                    return;

                case 1:
                    result = GeneralMethods.MessageBox("Are you sure you want to delete " + selectedFileTypes[0].Name + "?", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    break;

                default:
                    result = GeneralMethods.MessageBox("Are you sure you want to delete these file types?", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    break;
                }

                if (result == MessageBoxResult.Yes)
                {
                    DeleteFileTypes(selectedFileTypes.ToArray());
                }
            }
            catch (System.Exception e)
            {
                GeneralMethods.MessageBoxException(e, "Could not delete file types: ");
            }
        }
Esempio n. 17
0
        public static GameObject SpawnPet(PetData data, Vector3 position)
        {
            var pet = data;

            if (pet != null)
            {
                CombatCharacter petChar = null;
                if (pet.IsNpc)
                {
                    var npc = Rm_RPGHandler.Instance.Repositories.Interactable.GetNPC(pet.CharacterID);
                    petChar = GeneralMethods.CopyObject((CombatCharacter)npc);
                }
                else
                {
                    var enemy = Rm_RPGHandler.Instance.Repositories.Enemies.Get(pet.CharacterID);
                    petChar = GeneralMethods.CopyObject(enemy);
                }

                if (GetObject.PlayerCharacter.CurrentPet != null)
                {
                    GetObject.PlayerCharacter.CurrentPet.Remove();
                }

                var petGo   = (GameObject)Instantiate(Resources.Load(petChar.CharPrefabPath), position + Vector3.back, Quaternion.identity);
                var petMono = petGo.AddComponent <PetMono>();
                var follow  = petGo.GetComponent <RPGFollow>();
                follow.FollowTarget   = true;
                follow.TargetToFollow = GetObject.PlayerMono;
                petMono.PetData       = data;

                //Update current pet
                GetObject.PlayerCharacter.CurrentPet = petMono;
                GetObject.PlayerSave.CurrentPet      = data;
                return(petGo);
            }

            return(null);
        }
Esempio n. 18
0
        public void Dashboard_Setting_NewFund_Refresh()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            string fund_name_1 = utility.GetUniqueName("fund1");
            string fund_name_2 = utility.GetUniqueName("fund2");
            int    church_id   = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);

            try
            {
                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList fundsOnPage = settings.getWidgetSubItemsOnPage(1);

                TestLog.WriteLine(fundsOnPage.Count);

                test.SQL.Giving_Funds_Create(church_id, fund_name_1, true, null, 1, true, "Auto Testing");
                test.SQL.Giving_Funds_Create(church_id, fund_name_2, true, null, 2, true, "Auto Testing");

                test.Driver.Navigate().Refresh();
                utility.WaitForPageIsLoaded();

                ArrayList fundsOnPageNew = settings.getWidgetSubItemsOnPage(1);

                //verify newly added fund has been shown on the page
                Assert.AreEqual(fundsOnPageNew.Count, fundsOnPage.Count + 1);
                Assert.IsTrue(fundsOnPageNew.Contains((object)fund_name_1));
            }
            finally
            {
                //clear test data
                test.SQL.Giving_Funds_Delete(church_id, fund_name_1);
                test.SQL.Giving_Funds_Delete(church_id, fund_name_2);
            }
        }
        /// <summary>
        /// Removes the specified root folders from the system
        /// </summary>
        /// <param name="rootFolder">Root folders being removed from the system</param>
        private void DeleteRootFolders(RootFolder[] toDelete)
        {
            try
            {
                List <RootFolder> rootFolders = new List <RootFolder>(RootFolders);
                List <RootFolder> lstToDelete = new List <RootFolder>(toDelete);

                while (lstToDelete.Count > 0)
                {
                    RootFolder rootFolder = lstToDelete[0];
                    rootFolder.Delete();

                    rootFolders.Remove(rootFolder);
                    lstToDelete.Remove(rootFolder);

                    //must update priority each time to reflect automatic database change
                    for (Int16 priority = 0; priority < rootFolders.Count; priority++)
                    {
                        rootFolders[priority].Priority = priority;
                    }
                }

                List <SortDescription> sortDescriptions = new List <SortDescription>(SortDescriptions);

                RootFolders = rootFolders.ToArray();

                SortDescriptions.Clear();

                foreach (SortDescription sortDescription in sortDescriptions)
                {
                    SortDescriptions.Add(sortDescription);
                }
            }
            catch (System.Exception e)
            {
                GeneralMethods.MessageBoxException(e, "Could not delete root folders: ");
            }
        }
Esempio n. 20
0
        public void uncheckAccessRight(int userId, string accessRightName)
        {
            GeneralMethods utility = this._generalMethods;
            string         path    = string.Format("{0}//{1}", this._driver.Url.ToString().Split('/')[0], this._driver.Url.ToString().Split('/')[2]);

            if (!this._driver.Url.ToString().Contains("/admin/security/manageuserroles.aspx?userId="))
            {
                log.Debug("Navigate to manage user roles page");
                this._driver.Navigate().GoToUrl(string.Format("{0}/admin/security/manageuserroles.aspx?userId={1}", path, userId));
            }

            utility.WaitForPageIsLoaded();

            var checkBox = utility.WaitAndGetElement(By.XPath(string.Format("//span[text()='{0}']/parent::div/input", accessRightName)));

            if (bool.Parse(this._driver.ExecuteScript("return arguments[0].checked;", checkBox).ToString()))
            {
                checkBox.Click();
            }

            utility.WaitAndGetElement(By.Id("ctl00_ctl00_MainContent_content_btnSave")).Click();
            utility.WaitForPageIsLoaded();
        }
Esempio n. 21
0
        /// <summary>
        /// Deletes the selected tags from the media item
        /// </summary>
        private void DeleteSelectedTags()
        {
            if (lstTags.SelectedItems.Count == 0)
            {
                GeneralMethods.MessageBoxApplicationError("Please select a tag to delete.");
                return;
            }

            String message;

            if (lstTags.SelectedItems.Count == 1)
                message = "Are you sure you want to delete \"" + (IntelligentString)lstTags.SelectedItem + "\" from " + SelectedMediaItem.Name + "?";
            else
                message = "Are you sure you want to delete these tags from " + SelectedMediaItem.Name + "?";

            if (GeneralMethods.MessageBox(message, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                List<IntelligentString> tags = new List<IntelligentString>(lstTags.SelectedItems.Cast<IntelligentString>());

                foreach (IntelligentString tag in tags)
                    SelectedMediaItem.Tags.Remove(tag);
            }
        }
Esempio n. 22
0
        private void BrowseForPlugin_Button_Click(object sender, EventArgs e)
        {
            FileInfo nkhEXE = new FileInfo(NKHook.nkhEXE);

            if (!Directory.Exists(nkhEXE.FullName.Replace(nkhEXE.Name, "") + "UnloadedPlugins\\"))
            {
                Directory.CreateDirectory(nkhEXE.FullName.Replace(nkhEXE.Name, "") + "UnloadedPlugins\\");
            }

            var files = GeneralMethods.BrowseForFiles("Browse for plugins", "dll", "Dll files (*.dll)|*.dll", Environment.CurrentDirectory);

            if (files == null)
            {
                return;
            }

            foreach (string file in files)
            {
                FileInfo f = new FileInfo(file);
                CopyFile(f.FullName, nkhEXE.FullName.Replace(nkhEXE.Name, "") + "UnloadedPlugins\\" + f.Name);
                UnloadedPlugin_LB.Items.Add(f.Name);
            }
        }
Esempio n. 23
0
    public void OnDrop(PointerEventData eventData)
    {
        var skillBarButtonModel = GetComponent <SkillBarButtonModel>();

        var skillDragHandler = SkillDragHandler.itemBeingDragged != null?SkillDragHandler.itemBeingDragged.GetComponent <SkillDragHandler>() : null;

        if (skillDragHandler != null && skillDragHandler.IsSkill)
        {
            var skill = RPG.GetPlayerCharacter.SkillHandler.AvailableSkills.First(s => s.ID == skillDragHandler.RefId);
            RPG.GetPlayerCharacter.SkillHandler.Slots[skillBarButtonModel.SkillSlot].ChangeSlotTo(skill);

            skillBarButtonModel.SkillImage.sprite = GeneralMethods.CreateSprite(skill.Image.Image);
            skillBarButtonModel.SkillImage.color  = Color.white;
        }
        else
        {
            var inventoryItem = RPG.GetPlayerCharacter.Inventory.GetReferencedItem(skillDragHandler.RefId);
            RPG.GetPlayerCharacter.SkillHandler.Slots[skillBarButtonModel.SkillSlot].ChangeSlotTo(inventoryItem);

            skillBarButtonModel.SkillImage.sprite = GeneralMethods.CreateSprite(inventoryItem.Image);
            skillBarButtonModel.SkillImage.color  = Color.white;
        }
    }
        public void AddNewSubject(SUBJECT newSubject)
        {
            SqlConnection con     = GeneralMethods.ConnectToDatabase();
            SqlCommand    command = new SqlCommand("INSERT INTO [SUBJECT] (Subject_Code, Description, Schedule, Units, SemID, PrelimPercent, MidtermPercent, PrefiPercent, Base, Grade, PrelimLetterGrade, MidtermLetterGrade, PrefiLetterGrade) VALUES (@Subject_Code, @Description, @Schedule, @Units, @SemID, @PrelimPercent, @MidtermPercent, @PrefiPercent, @Base, @Grade, @PrelimLetterGrade, @MidtermLetterGrade, @PrefiLetterGrade)", con);

            command.Parameters.AddWithValue("@Subject_Code", newSubject.SubjectCode);
            command.Parameters.AddWithValue("@Description", newSubject.Description);
            command.Parameters.AddWithValue("@Schedule", newSubject.Schedule);
            command.Parameters.AddWithValue("@Units", newSubject.Units);
            command.Parameters.AddWithValue("@SemID", ViewModelLocator.SemesterSelectViewModel.SelectedSemester.SemID);
            command.Parameters.AddWithValue("@PrelimPercent", 0);
            command.Parameters.AddWithValue("@MidtermPercent", 0);
            command.Parameters.AddWithValue("@PrefiPercent", 0);
            command.Parameters.AddWithValue("@Grade", 0);
            command.Parameters.AddWithValue("@PrelimLetterGrade", "-");
            command.Parameters.AddWithValue("@MidtermLetterGrade", "-");
            command.Parameters.AddWithValue("@PrefiLetterGrade", "-");
            command.Parameters.AddWithValue("@Base", newSubject.Base);
            command.ExecuteNonQuery();
            con.Close();

            GetAndDisplaySubjects();
        }
        private void CharacteristicAbbreviationsListBox_Initialized(object sender, EventArgs e)
        {
            List <string> characteristicKeys = _characteristicDictionary.Keys
                                               .OrderBy(key => key)
                                               .ToList();

            List <string> abbreviationStrings = new List <string>();

            foreach (var key in characteristicKeys)
            {
                string value = _characteristicDictionary[key];

                string originalKey = GeneralMethods.ReturnOriginalRegisterConfiguration(key, _game.GetCharacteristics.Select(ch => ch.Name));

                abbreviationStrings.Add(value + emDash + originalKey);
            }

            List <string> defaultKeys = new List <string> {
                MathOperators, Conjuction, Disjuction
            };

            CharacteristicAbbreviationsListBox.ItemsSource = defaultKeys.Concat(abbreviationStrings);
        }
Esempio n. 26
0
 /// <summary>
 /// 在列表中列出所有基坑区域的Tag值
 /// </summary>
 /// <param name="ProcessRange"></param>
 /// <remarks></remarks>
 private void RefreshComobox_ProcessRange(List <clsData_ProcessRegionData> ProcessRange)
 {
     if (ProcessRange != null)
     {
         try
         {
             // list all the tags of each excavation region in the listbox
             byte count = System.Convert.ToByte(ProcessRange.Count);
             LstbxDisplayAndItem[] arrItems = new LstbxDisplayAndItem[count - 1 + 1];
             byte i = (byte)0;
             foreach (clsData_ProcessRegionData PR in ProcessRange)
             {
                 arrItems[i] = new LstbxDisplayAndItem(DisplayedText: PR.description, Value:
                                                       PR);
                 i++;
             }
             GeneralMethods.RefreshCombobox(this.lstbxChooseRegion, arrItems);
         }
         catch (Exception)
         {
         }
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Complete method. Waits on URL then reads and returns text from it
        /// </summary>
        /// <param name="url">url to read text from</param>
        /// <returns>text read off of website</returns>
        public string WaitOn_URL(string url)   //call this one to read the text from the git url
        {
            WebHandler get = new WebHandler();

            get.startURL = url;
            get.TryReadURL_StartThread();

            for (int i = 0; i <= 100; i++)
            {
                GeneralMethods.checkedForExit();
                Thread.Sleep(100);
                if (get.urlAquired)
                {
                    break;
                }
            }

            if (get.readURL == null)
            {
                get.readURL = "";
            }
            return(get.readURL);
        }
Esempio n. 28
0
        // GET: VSReport
        public ActionResult VSRMain()
        {
            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("NewLogin", "Home"));
            }
            if (common.UserRight("2501", "001"))
            {
                dealerCode = Session["DealerCode"].ToString();

                List <SelectListItem> ddlVehLoc = new List <SelectListItem>();
                ddlVehLoc         = GeneralMethods.GetDataFromSPWithDealerCode("SP_Select_VehLocation", dealerCode);
                ViewBag.ddlVehLoc = ddlVehLoc;
            }
            else
            {
                TempData["TestAccessError"] = MessageAlert.MsgAuthorized();
                return(RedirectToAction("Error", "Definition"));
            }


            return(View());
        }
        private void GetAndDisplaySemesters()
        {
            ListSemesters.Clear();

            SqlConnection  con  = GeneralMethods.ConnectToDatabase();
            SqlDataAdapter sda2 = new SqlDataAdapter("SELECT * From [SEMESTER] WHERE UserID='" + ViewModelLocator.MainWindowViewModel.SelectedUser.UserID + "'", con);
            DataTable      dt   = new DataTable();

            sda2.Fill(dt);
            con.Close();

            for (int x = 0; x < dt.Rows.Count; x++)
            {
                SEMESTER newSemester = new SEMESTER();

                newSemester.SemesterName = dt.Rows[x]["Semester_Name"].ToString();
                newSemester.MaxUnits     = Convert.ToInt16(dt.Rows[x]["Max_Units"]);
                newSemester.Schoolyear   = dt.Rows[x]["Schoolyear"].ToString();
                newSemester.SemID        = Convert.ToInt16(dt.Rows[x]["SemID"]);

                ListSemesters.Add(newSemester);
            }
        }
Esempio n. 30
0
        //When search clicked, get the id from the idTextBox, search if patient with that id exist.
        //If exist creates a new SerchResultForm and show the results, If not, Shows appropriate message
        private void _searchPatientButton_Click(object sender, EventArgs e)
        {
            string patientId = idToLoadTextBox.Text;

            try
            {
                List <Patient> patientList = MainBL.getPatientListById(patientId);
                if (patientList != null)
                {
                    _mainForm.Enabled = false;
                    SearchResultForm srf = new SearchResultForm(patientList, _mainForm);
                    srf.Show();
                }
                else
                {
                    GeneralMethods.showErrorMessageBox("Wrong ID, No patient found.");
                }
            }
            catch (Exception)
            {
                GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
            }
        }