Ejemplo n.º 1
0
        protected void grid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int        id     = Utilerias.StrToInt(grid.DataKeys[e.Row.RowIndex].Values["Id"].ToString());
                string     url    = "EvaluacionPOA_.aspx?ob=0&pd=" + id;
                HtmlButton button = (HtmlButton)e.Row.FindControl("btnEvaluar");
                button.Attributes.Add("data-tipo-operacion", "evaluar");
                button.Attributes.Add("data-url-poa", url);


                HtmlGenericControl spanAvanceP = (HtmlGenericControl)e.Row.FindControl("spanAvanceP");
                HtmlGenericControl progresoP   = (HtmlGenericControl)e.Row.FindControl("progresoP");
                HtmlGenericControl spanAvanceE = (HtmlGenericControl)e.Row.FindControl("spanAvanceE");
                HtmlGenericControl progresoE   = (HtmlGenericControl)e.Row.FindControl("progresoE");

                decimal avance = BuscarPorcentajesAvance(id, 2); //PLANEACION

                progresoP.Style.Add("width", avance.ToString() + "%");
                spanAvanceP.InnerText = avance.ToString() + "%";


                avance = BuscarPorcentajesAvance(id, 3); //EJECUCION

                progresoE.Style.Add("width", avance.ToString() + "%");
                spanAvanceE.InnerText = avance.ToString() + "%";
            }
        }
Ejemplo n.º 2
0
        public static void LoginDA(string userEmail = "", string userPwd = "")
        {
            Logger.log.Info("******  Start LoginDA() ********");

            if (userEmail == "")
            {
                userEmail = ConstantsUtil.defaultUserEmail;
            }
            if (userPwd == "")
            {
                userPwd = ConstantsUtil.defaultUserPwd;
            }

            Logger.log.Debug(" === LoginDA uses user email : " + userEmail.ToString());

            HtmlEdit credentialsEmailEdit = DesktopAppControls.GetCredentialsEmailEdit();

            HtmlEdit credentialsPasswordEdit = DesktopAppControls.GetCredentialsPasswordEdit();

            HtmlButton signInButton = DesktopAppControls.GetSignInButton();


            // Type '*****@*****.**' in 'credentials-email' text box
            credentialsEmailEdit.Text = userEmail;

            // Type '********' in 'credentials-password' text box
            credentialsPasswordEdit.Text = userPwd;

            // Click 'Sign In' button
            Mouse.Click(signInButton, new Point(218, 21));
            Thread.Sleep(10000);

            Logger.log.Info("******  End LoginDA() ********");
        }
Ejemplo n.º 3
0
        public void GivenNewUser()
        {
            window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change4");

            HtmlCustom nav = new HtmlCustom(window);

            nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav");

            HtmlButton registerButton = new HtmlButton(nav);

            registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register");

            Mouse.Click(registerButton);

            RegistrationControlPageObject registrationControl = new RegistrationControlPageObject(window);

            this.newUsername = Guid.NewGuid().ToString("N");
            this.newPassword = "******";
            registrationControl.SetFormValues(this.newUsername, this.newPassword, this.newPassword);
            registrationControl.ClickRegister();

            HtmlButton ordersButton = new HtmlButton(nav);

            ordersButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Orders");

            Mouse.Click(ordersButton);

            this.ordersPageObject = new OrdersPageObject(window);
        }
Ejemplo n.º 4
0
        private static HtmlButton GetHtmlButton(string uiTitle, string uiType)
        {
            dynamic htmlControl = new HtmlButton(Browser.Locate(uiTitle, uiType));

            htmlControl.TechnologyName = TechnologyNameWeb;
            return(htmlControl);
        }
Ejemplo n.º 5
0
        private void setRequestUrl(string targetPage, decimal orderId, HtmlButton sender)
        {
            var requestUrl = string.Format("{0}?id={1}&returnUrl={2}&role=Provide", targetPage, orderId.ToString(), HttpUtility.UrlEncode(Request.Url.PathAndQuery));

            sender.Attributes.Add("onclick", "window.location.href='" + requestUrl + "';return false;");
            sender.Visible = true;
        }
Ejemplo n.º 6
0
 private void AddEditButtonVisible(HtmlGenericControl p, string controlSuffix)
 {
     using (HtmlButton editButton = this.GetInputButton("CTRL + SHIFT + E", "$('#EditButton" + controlSuffix + "').click();return false;", Titles.EditSelected, this.ButtonCssClass, this.EditButtonIconCssClass))
     {
         p.Controls.Add(editButton);
     }
 }
        public void BrowserWindowTest_Alert()
        {
            HtmlButton button = new HtmlButton(BasicTestPage);

            button.SearchProperties.Add(HtmlButton.PropertyNames.Id, "buttonWithAlert");

            foreach (BrowserDialogAction dialogAction in Enum.GetValues(typeof(BrowserDialogAction)))
            {
                Mouse.Click(button);
                Console.WriteLine(dialogAction.ToString());
                switch (dialogAction)
                {
                case BrowserDialogAction.Ok:
                case BrowserDialogAction.Yes:
                    BrowserWindow.PerformDialogAction(dialogAction);
                    AssertResult("buttonWithAlert", "click", "OK!");
                    break;

                case BrowserDialogAction.Cancel:
                case BrowserDialogAction.Ignore:
                case BrowserDialogAction.Close:
                case BrowserDialogAction.No:
                    BrowserWindow.PerformDialogAction(dialogAction);
                    AssertResult("buttonWithAlert", "click", "Cancel!");
                    break;

                default:
                    Action action = () => BrowserWindow.PerformDialogAction(dialogAction);
                    action.ShouldThrow <NotImplementedException>()
                    .WithMessage(string.Format("'{0}' action type is not implemented", dialogAction.ToString()));
                    BrowserWindow.PerformDialogAction(BrowserDialogAction.Ok);
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Performs logout action.
        /// </summary>
        public void Logout()
        {
            HtmlButton logoutBtn = this.EM.Identity.LoginStatusFrontend.LogoutButton.AssertIsPresent("Logout button");

            logoutBtn.Click();
            ActiveBrowser.WaitForAsyncJQueryRequests();
        }
Ejemplo n.º 9
0
        [Ignore] // this test currently fails
        public void HtmlButton_HiddenByStyle_ControlExistsAndCanAssertOnStyle()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <button id=""buttonId"" style=""display: none;"" >Hidden</button>
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                HtmlButton button = browserWindow.Find <HtmlButton>(By.Id("buttonId"));

                //Assert
                Assert.IsTrue(button.Exists);

                Assert.IsTrue(button.SourceControl.ControlDefinition.Contains("style=\"display: none;\""));

                browserWindow.Close();
            }
        }
Ejemplo n.º 10
0
        protected void gridRecetas_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int        idReceta = Utilerias.StrToInt(gridRecetas.DataKeys[e.Row.RowIndex].Values["Id"].ToString());
                HtmlButton btnVer   = (HtmlButton)e.Row.FindControl("btnVer");
                Recetas    obj      = uow.RecetasBusinessLogic.GetByID(idReceta);

                if (obj.Status == 2)
                {
                    ImageButton edit = (ImageButton)e.Row.FindControl("imgBtnEdit");
                    ImageButton del  = (ImageButton)e.Row.FindControl("imgBtnEliminarReceta");

                    if (edit != null)
                    {
                        edit.Enabled = false;
                    }

                    if (del != null)
                    {
                        del.Enabled = false;
                    }
                }


                if (btnVer != null)
                {
                    btnVer.Attributes["onclick"] = "fnc_MostrarReceta(" + idReceta + ")";
                }
            }
        }
        public void PropertyExpressionCollectionTest_Add_ArrayOfPairs_IncompletePair()
        {
            HtmlButton button = new HtmlButton();
            Action     action = () => button.SearchProperties.Add(HtmlButton.PropertyNames.Id, "secondButton", HtmlButton.PropertyNames.Class);

            action.ShouldThrow <ArgumentOutOfRangeException>();
        }
Ejemplo n.º 12
0
        public void Launch_UsingNewInstanceOfABrowserWindow_CanUsePartialWindowTitle()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test 1 2 3</title>
    </head>
    <body>
        <button id=""buttonId"" >Button</button>
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                HtmlButton button = browserWindow.Find <HtmlButton>(By.Id("buttonId"));

                //Assert
                Assert.AreEqual(button.InnerText, "Button");

                Trace.WriteLine(browserWindow.Uri.ToString());

                browserWindow.Close();
            }
        }
Ejemplo n.º 13
0
        public void RegistrationButtonEnabledOnlyWhenFormValid()
        {
            HtmlDiv registerDiv = new HtmlDiv(this.window);

            registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo);

            SetFormValues(registerDiv, "a", "b", String.Empty);
            SetFormValues(registerDiv, String.Empty, String.Empty, null);

            HtmlButton submitRegisterButton = new HtmlButton(registerDiv);

            Assert.IsTrue(submitRegisterButton.TryFind());
            Assert.IsFalse(submitRegisterButton.Enabled);

            // demo: would prefer the password hidden checks looked more like this
            #region Spoiler
            // ... sounds like a job for page objects
            #endregion
            SetFormValues(registerDiv, "mike", null, null);
            Assert.IsFalse(submitRegisterButton.Enabled);

            SetFormValues(registerDiv, null, "password", null);
            Assert.IsFalse(submitRegisterButton.Enabled);

            SetFormValues(registerDiv, null, null, "nomatch");
            Assert.IsFalse(submitRegisterButton.Enabled);

            SetFormValues(registerDiv, null, null, "password");
            Assert.IsTrue(submitRegisterButton.Enabled);
        }
        public void MigratingElementObjectToHtmlControls()
        {
            // If you already have tests written using WebAii that you want to gradually move to
            // you can use the HTML wrapper class's constructor passing in the existing element
            // object from you current code.

            // The first line is a line of code in your existing test case.
            Element myButtonElement1 = Find.ById("htmlbutton");
            // Add this line to your code to start using the HTML element wrapper class instead.
            HtmlButton buttonObj1 = new HtmlButton(myButtonElement1);

            // Or the next feature is to use the AssignElement() method. Using this method you
            // can wrap any existing element object into one of the new HTML wrapper classes.

            // The first line is a line of code in your existing test case.
            Element myHtmlButtonElement2 = Find.ById("htmlbutton");
            // Create a new control instance and assign the existing element to it.
            HtmlButton buttonObj2 = new HtmlButton();

            buttonObj2.AssignElement(myHtmlButtonElement2);

            // The last advanced feature is the .As<TControl> construct. The .As<TControl>
            // construct acts like a typecast converting your plain element object into the
            // typecast HTML element wrapper object.

            // The first line is a line of code in your existing test case.
            Element myHtmlButtonElement3 = Find.ById("htmlbutton");

            // Make a comparison using the .As<TControl> construct.
            Assert.IsTrue(myHtmlButtonElement3.As <HtmlButton>().InnerText.Equals("Html Button", StringComparison.OrdinalIgnoreCase));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Click the login button.
        /// </summary>
        public void PressLoginButton()
        {
            HtmlButton loginBtn = this.EM.Identity.LoginFormFrontend.LoginButton.AssertIsPresent("Login button");

            loginBtn.Click();
            ActiveBrowser.WaitForAsyncJQueryRequests();
        }
        void rptSlideButtons_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                Literal ltlPrev = e.FindControlAs <Literal>("ltlPrev");
                ltlPrev.Text = DictionaryConstants.PrevTipButtonText;
            }

            if (e.IsItem())
            {
                string     buttonNumber = (e.Item.ItemIndex + 1).ToString();
                HtmlButton hgcButton    = e.FindControlAs <HtmlButton>("hgcButton");

                hgcButton.InnerText = buttonNumber;
                hgcButton.Attributes["data-target"] = buttonNumber;
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Literal ltlNext = e.FindControlAs <Literal>("ltlNext");
                Literal ltlLast = e.FindControlAs <Literal>("ltlLast");

                ltlNext.Text = DictionaryConstants.NextTipButtonText;
                ltlLast.Text = DictionaryConstants.LastTipButtonText;
            }
        }
Ejemplo n.º 17
0
        public static HtmlButton GenerateButton(string CssClass)
        {
            HtmlButton Button = new HtmlButton();

            Button.Attributes["class"] = CssClass;
            return(Button);
        }
Ejemplo n.º 18
0
        private void CreateInitializeButton(HtmlGenericControl container)
        {
            using (HtmlButton initializeButton = new HtmlButton())
            {
                initializeButton.ID = "InitializeButton";

                if (this.status.IsInitialized)
                {
                    initializeButton.Attributes.Add("class", "ui blue disabled button");
                }
                else
                {
                    initializeButton.Attributes.Add("class", "ui blue button");
                }

                initializeButton.Attributes.Add("onclick", "return false;");
                initializeButton.Attributes.Add("data-popup", ".initialize");


                using (HtmlGenericControl i = new HtmlGenericControl("i"))
                {
                    i.Attributes.Add("class", "icon alarm");
                    initializeButton.Controls.Add(i);
                }

                using (Literal buttonText = new Literal())
                {
                    buttonText.Text = Titles.InitializeDayEnd;
                    initializeButton.Controls.Add(buttonText);
                }


                container.Controls.Add(initializeButton);
            }
        }
Ejemplo n.º 19
0
        protected void btnCommand_Click(object sender, EventArgs e)
        {
            HtmlButton hb = (HtmlButton)sender;

            action = hb.InnerText.Substring(hb.InnerText.IndexOf(">") + 1);
            if (Convert.ToInt32(Session["nivo"].ToString()) > 1 && (action == "Dodaj" || action == "Izmijeni" || action == "Obriši"))
            {
                action = "";
            }
            ViewState["action"] = action;
            if (action == "Izmijeni" && hdnID.Value != "")
            {
                string          query = "select broj, naziv from poste where id = " + hdnID.Value;
                OleDbConnection con   = new OleDbConnection(ConfigurationManager.ConnectionStrings["connstr"].ConnectionString);
                OleDbCommand    cmd   = new OleDbCommand();
                cmd.CommandText = query;
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = con;
                con.Open();
                OleDbDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    txtBroj.Text  = (dr[0] as string);
                    txtNaziv.Text = (dr[1] as string);
                }
                con.Close();
            }
            if ((action == "Dodaj") || (action == "Izmijeni") || (action == "Traži") || (action == "Filtriraj"))
            {
                txtBroj.Focus();
            }
        }
        public void SavedSettingsAreRestoredAfterLogin()
        {
            const string firstName = "Mike";
            const string lastName  = "Pav";

            this.accountSettingsPageObject.FirstName = firstName;
            this.accountSettingsPageObject.LastName  = lastName;
            this.accountSettingsPageObject.ClickSave();

            this.accountSettingsPageObject.FirstName = "";
            this.accountSettingsPageObject.LastName  = "";

            // duplicate nav definition
            HtmlCustom nav = new HtmlCustom(window);

            nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav");

            HtmlButton loginButton = new HtmlButton(nav);

            loginButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Login");

            Mouse.Click(loginButton);

            // need access to the login page in account settings tests!
            // Yuck, how to deal with this?
            var loginPage = new LoginPageObject(this.window);

            loginPage.Username = this.newUsername;
            loginPage.Password = this.newPassword;

            var newReferenceToAccountSettings = loginPage.ClickLoginButton();

            Assert.IsTrue(StringComparer.Ordinal.Equals(firstName, newReferenceToAccountSettings.FirstName));
            Assert.IsTrue(StringComparer.Ordinal.Equals(lastName, newReferenceToAccountSettings.LastName));
        }
Ejemplo n.º 21
0
        public void Login()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.

            // IWebDriver driver = new ope();
            BrowserWindow.CurrentBrowser = "chrome";
            browserWindow = BrowserWindow.Launch(applink);
            HtmlEdit   username = new HtmlEdit(browserWindow);
            HtmlEdit   password = new HtmlEdit(browserWindow);
            HtmlButton btnlogin = new HtmlButton(browserWindow);

            username.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "username");
            password.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "password");
            btnlogin.SearchProperties.Add(HtmlButton.PropertyNames.Id, "btn_login");

            //enter username and password in fields1405726200
            Keyboard.SendKeys(username, "*****@*****.**");
            Playback.PlaybackSettings.DelayBetweenActions = 200;
            Keyboard.SendKeys(password, "Fgx1234!");
            Playback.PlaybackSettings.DelayBetweenActions = 200;
            Mouse.Click(btnlogin);


            OpenCashHouse();
        }
Ejemplo n.º 22
0
 private void AddPrintButton(HtmlGenericControl p)
 {
     using (HtmlButton printButton = this.GetInputButton("CTRL + SHIFT + P", "scrudPrintGridView();", Titles.Print, this.ButtonCssClass, this.PrintButtonIconCssClass))
     {
         p.Controls.Add(printButton);
     }
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Opens the toggle navigation menu
        /// </summary>
        public void OpenNavigationToggleMenu()
        {
            HtmlButton toggleButton = this.EM.Navigation.NavigationWidgetFrontend.ToggleButton
                                      .AssertIsPresent <HtmlButton>("Toggle Button");

            toggleButton.Click();
        }
        /// <summary>
        /// Clicks to remove first choice link.
        /// </summary>
        public void ClickToRemoveFirstChoiceLink()
        {
            HtmlDiv    firstChoice       = ActiveBrowser.Find.AllByExpression <HtmlDiv>("class=col-md-1 text-right").FirstOrDefault();
            HtmlButton removeFirstChoice = firstChoice.Find.ByExpression <HtmlButton>("class=~close");

            removeFirstChoice.Click();
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Changes the media file.
        /// </summary>
        public void ChangeMediaFile()
        {
            HtmlButton changeBtn = this.EM.Media.MediaPropertiesBaseScreen.ChangeButton.AssertIsPresent("Change button");

            changeBtn.Click();
            ActiveBrowser.WaitForAsyncRequests();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Verifies that the save button is present in the designer.
        /// </summary>
        public void VerifyWidgetSaveButton()
        {
            HtmlButton saveButton = this.EM.Widgets.FeatherWidget.SaveButton
                                    .AssertIsPresent("save button");

            Assert.IsTrue(saveButton.InnerText.Equals("Save"), "Save button text is not correct");
        }
Ejemplo n.º 27
0
 private void AddShowCompactButton(HtmlGenericControl p)
 {
     using (HtmlButton showCompactButton = this.GetInputButton("CTRL + SHIFT + C", "scrudShowCompact();", Titles.ShowCompact, this.ButtonCssClass, this.CompactButtonIconCssClass))
     {
         p.Controls.Add(showCompactButton);
     }
 }
Ejemplo n.º 28
0
 private void AddAddButton(HtmlGenericControl p)
 {
     using (HtmlButton addButton = this.GetInputButton("CTRL + SHIFT + A", "return(scrudAddNew());", Titles.AddNew, this.ButtonCssClass, this.AddButtonIconCssClass))
     {
         p.Controls.Add(addButton);
     }
 }
    protected void racepost_ServerClick(object sender, EventArgs e)
    {
        HtmlButton button = sender as HtmlButton;

        string race_id          = button.Attributes[("Value")];
        string title            = button.Attributes[("Title")];
        string connectionString =
            ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
        string insertSql = "INSERT INTO RacePoints(RaceId, MyId, Activity, SubCategory,Iweu) VALUES(@RaceId, @MyId, @Activity, @SubCategory,@Iweu)";

        using (SqlConnection myConnection = new SqlConnection(connectionString))
        {
            myConnection.Open();
            SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
            myCommand.Parameters.AddWithValue("@RaceId", new Guid(race_id));
            myCommand.Parameters.AddWithValue("@MyId", currentUserId);
            myCommand.Parameters.AddWithValue("@Activity", "View");
            myCommand.Parameters.AddWithValue("@SubCategory", title);
            myCommand.Parameters.AddWithValue("@Iweu", 2);


            myCommand.ExecuteNonQuery();
            myConnection.Close();
        }
        //UpdatePanel1.Update();
        this.DataBind();
    }
Ejemplo n.º 30
0
        public void Usun_Etap(Object sender, EventArgs e)
        {
            Response.Write("<script>alert('Usuwanie!');</script>");
            HtmlButton b = (HtmlButton)sender;

            System.Diagnostics.Debug.WriteLine("B Id=" + b.ID.ToString());
            int n = int.Parse(b.ID.ToString().Replace("Etap", ""));

            labelProcesProdukcyjny.Visible = true;
            DataRow proces = getProcesById(int.Parse(selectedProcesValue));

            SqlDataSource_ProcesyProdukcyjne.UpdateParameters.Add("original_Id", proces["Id"].ToString());
            SqlDataSource_ProcesyProdukcyjne.UpdateParameters.Add("Nazwa", proces["Nazwa"].ToString());
            SqlDataSource_ProcesyProdukcyjne.UpdateParameters.Add("Opis", proces["Opis"].ToString());
            int i = 1;

            while ((i != n) && (i < 20))
            {
                SqlDataSource_ProcesyProdukcyjne.UpdateParameters.RemoveAt(0);
                SqlDataSource_ProcesyProdukcyjne.UpdateParameters.Add("Etap" + i, proces["Etap" + i].ToString());
                i++;
            }
            while ((proces["Etap" + i].ToString() != "") && (i < 20))
            {
                SqlDataSource_ProcesyProdukcyjne.UpdateParameters.RemoveAt(0);
                SqlDataSource_ProcesyProdukcyjne.UpdateParameters.Add("Etap" + i, proces["Etap" + (i + 1)].ToString());
                i++;
            }
            SqlDataSource_ProcesyProdukcyjne.Update();
            Proces_Changed(null, null);
        }
Ejemplo n.º 31
0
        public static void ClickButton(string btnName, string btnType)
        {
            HtmlButton Btn = new HtmlButton(browserWindow);
            Btn.SearchProperties.Add(HtmlEdit.PropertyNames.Type, btnType, PropertyExpressionOperator.EqualTo);
            Btn.SearchProperties.Add(HtmlEdit.PropertyNames.InnerText, btnName, PropertyExpressionOperator.EqualTo);

            Btn.WaitForControlExist();

            Mouse.Click(Btn);
        }
Ejemplo n.º 32
0
 public HtmlButton goNextPage()
 {
     HtmlButton button = new HtmlButton(RootDiv);
     button.SearchProperties["id"] = "ctl00_centreContentPlaceHolder_ctlSignUp_submitButton";
     return button;
 }
Ejemplo n.º 33
0
 public HtmlButton toSignUp()
 {
     HtmlButton button = new HtmlButton(RootDiv);
     button.SearchProperties["id"] = "ctl00_centreContentPlaceHolder_ctlCreateProfile_submitButton";
     return button;
 }
Ejemplo n.º 34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlMeta hm = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        HtmlLink lk = new HtmlLink();
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/Message.aspx";
        head.Controls.AddAt(0, lk);

        Encryption decrypt = new Encryption();
        Label MessageLabel = new Label();

        if (Session["Message"] != null || Request.QueryString["message"] != null)
        {
            string message = "";
            if (Request.QueryString["message"] != null)
                message = "<label>" + decrypt.decrypt(Request.QueryString["message"].ToString()) + "</label>";
            else
                message = "<label>" + Session["Message"].ToString() + "</label>";

            //if (Session["str"] != null)
            //    message += "<div style=\"color: red;\">" + Session["str"].ToString() + "</div>";

            if (message.Contains("<savedadsearch>"))
            {
                string[] delim = { "<savedadsearch>ID:" };
                string[] tokens = message.Split(delim, StringSplitOptions.None);
                string ID2 = "";
                int i = 0;
                while (tokens[1][i] != '<')
                {
                    ID2 += tokens[1][i];
                    i++;
                }

                MessageLabel.Text = tokens[0]+"<label>Your search is now live. You will receive periodic emails with new featured ads matching your criteria. Click the button to disable this feature. You can also modify it in the Searches page later on.<br/>";
                MessageLabel.ID = "Label1";
                Label newLabel = new Label();
                newLabel.Text = "<br/>" + tokens[1].Replace(ID2 + "</savedadsearch>", "") + "</label>";

                HtmlButton button = new HtmlButton();
                button.Style.Value = " cursor: pointer;font-weight: bold;padding:0;padding-bottom: 4px; font-size: 11px;height: 30px; width: 112px;background-color: transparent; color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat:no-repeat; border: 0;";
                button.ServerClick += new EventHandler(button_ServerClick);
                button.Attributes.Add("value", ID2);
                button.Attributes.Add("onmouseover", "this.style.backgroundImage='url(image/PostButtonNoPostHover.png)'");
                button.Attributes.Add("onmouseout", "this.style.backgroundImage='url(image/PostButtonNoPost.png)'");
                button.InnerText = "Disable";

                MessagePanel.Controls.Add(MessageLabel);
                MessagePanel.Controls.Add(button);
                MessagePanel.Controls.Add(newLabel);
            }
            else
            {
                MessageLabel.Text = message;
                MessagePanel.Controls.Add(MessageLabel);
            }

        }
    }
Ejemplo n.º 35
0
    protected void AddCategory(object sender, EventArgs e)
    {
        //MessagesLabel.Text += "got here";
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            HtmlButton theButt = (HtmlButton)sender;

            string[] delim = { "category" };
            string[] tokens = theButt.Attributes["commandargument"].Split(delim, StringSplitOptions.None);
            string CatID = tokens[2];
            string venueOrEvent = tokens[1];
            string contentID = tokens[0];
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            //MessagesLabel.Text += "tok 1: " + tokens[0] + ", tok2: " + tokens[1] + ", tok3: " + tokens[2];

            Literal lab = new Literal();
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
            conn.Open();
            SqlCommand cmd;
            if (venueOrEvent == "venue")
            {
                cmd = new SqlCommand("INSERT INTO Venue_Category (VENUE_ID, CATEGORY_ID) VALUES(@vID, @cID)", conn);
                cmd.Parameters.Add("@vID", SqlDbType.Int).Value = contentID;
                cmd.Parameters.Add("@cID", SqlDbType.Int).Value = CatID;
                cmd.ExecuteNonQuery();

                dat.Execute("UPDATE VenueCategoryRevisions SET Approved='True' WHERE ID=" + tokens[3]);

                #region Send Email
                //send email
                string rowID = tokens[3];

                string venueName = dat.GetData("SELECT * FROM Venues V, VenueCategoryRevisions VCR WHERE V.ID=VCR.VenueID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                string categoryName = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, VenueCategories VC " +
                    "WHERE VC.ID=VCR.CatID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                DataSet dsRevision = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                string emailBody = "The addition of category '" + categoryName + "' has been approved for the venue '" + venueName +
                    "' by the venue's author. <br/><br/> " +
                    "To view these changes, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(venueName)+"_" +
                    dsRevision.Tables[0].Rows[0]["VenueID"].ToString() + "_Venue\">" + venueName + "</a>";

                if (!Request.IsLocal)
                {
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been approved for venue: '" +
                    venueName + "'");
                }
                #endregion
            }
            else
            {
                cmd = new SqlCommand("INSERT INTO Event_Category_Mapping (EventID, CategoryID) VALUES(@vID, @cID)",
                    conn);
                cmd.Parameters.Add("@vID", SqlDbType.Int).Value = contentID;
                cmd.Parameters.Add("@cID", SqlDbType.Int).Value = CatID;
                cmd.ExecuteNonQuery();

                dat.Execute("UPDATE EventCategoryRevisions SET Approved='True' WHERE ID=" + tokens[3]);

                #region Send Email
                //send email
                string rowID = tokens[3];

                string eventName = dat.GetData("SELECT * FROM Events V, EventCategoryRevisions VCR WHERE V.ID=VCR.EventID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Header"].ToString();

                string categoryName = dat.GetData("SELECT * FROM EventCategoryRevisions VCR, EventCategories VC " +
                    "WHERE VC.ID=VCR.CatID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                DataSet dsRevision = dat.GetData("SELECT * FROM EventCategoryRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                string emailBody = "The addition of category '" + categoryName + "' has been approved for the event '" + eventName +
                    "' by the event's author. <br/><br/> " +
                    "To view these changes, please visit <a href=\"http://HippoHappenings.com/" +dat.MakeNiceName(eventName)+"_"+
                    dsRevision.Tables[0].Rows[0]["EventID"].ToString() + "_Event\">" + eventName + "</a>";

                if (!Request.IsLocal)
                {
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been approved for event: '" +
                    eventName + "'");
                }
                #endregion
            }

            conn.Close();
            lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Added</label>";
            Label lab2 = new Label();
            Literal theLit =
                (Literal)theButt.Parent.Controls[theButt.Parent.Controls.IndexOf(theButt) - 1];
            theLit.Text = theLit.Text.Replace("<br/>", "");
            theLit.Text = theLit.Text.Replace("<div style=\"padding-bottom: 4px;\">",
                "<div align=\"right\" style=\"padding-bottom: 4px;\">");

            HtmlButton but2 = new HtmlButton();
            but2 = (HtmlButton)theButt.Parent.Controls[theButt.Parent.Controls.IndexOf(theButt) + 1];

            but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
            but2.Parent.Controls.Remove(but2);
            //Put the label in place of the button
            theButt.Parent.Controls.AddAt(theButt.Parent.Controls.IndexOf(theButt), lab);
            //Then remove the button
            theButt.Parent.Controls.Remove(theButt);
        }
        catch (Exception ex)
        {
            MessagesLabel.Text = ex.ToString();
        }
    }
Ejemplo n.º 36
0
    //protected void LoadControls_OLD()
    //{
    //    Telerik.Web.UI.RadPanelBar MessagePanelBar = new Telerik.Web.UI.RadPanelBar();
    //    MessagePanelBar.CausesValidation = false;
    //    MessagePanelBar.Width = 560;
    //    MessagePanelBar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.MultipleExpandedItems;
    //    MessagePanelBar.EnableEmbeddedSkins = false;
    //    MessagePanelBar.ID = "MessagePanelBar1";
    //    MessagePanelBar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(MarkAsRead);
    //    ClearMessage();
    //    Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
    //    DataSet ds = dat.GetData("SELECT * FROM UserMessages WHERE Live='True' AND To_UserID="+
    //        Session["User"].ToString()+" ORDER BY Date DESC");
    //    System.Drawing.Color greyText = System.Drawing.Color.FromArgb(102, 102, 102);
    //    System.Drawing.Color greyBack = System.Drawing.Color.FromArgb(51, 51, 51);
    //    ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
    //    pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
    //    ArrayList a = new ArrayList(ds.Tables[0].Rows.Count);
    //    int unreadCount = 0;
    //    int count = 0;
    //    int times = 1;
    //    if (ds.Tables.Count > 0)
    //        if (ds.Tables[0].Rows.Count > 0)
    //        {
    //            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //            {
    //                if (count == 10*times)
    //                {
    //                    a.Add(MessagePanelBar);
    //                    times++;
    //                    MessagePanelBar = new Telerik.Web.UI.RadPanelBar();
    //                    MessagePanelBar.CausesValidation = false;
    //                    MessagePanelBar.Width = 560;
    //                    MessagePanelBar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.MultipleExpandedItems;
    //                    MessagePanelBar.EnableEmbeddedSkins = false;
    //                    MessagePanelBar.ID = "MessagePanelBar"+times.ToString();
    //                    MessagePanelBar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(MarkAsRead);
    //                }
    //                count++;
    //                DataSet dsUsers = dat.GetData("SELECT * FROM Users WHERE User_ID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString());
    //                if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
    //                    unreadCount++;
    //                Telerik.Web.UI.RadPanelItem messageItem = new Telerik.Web.UI.RadPanelItem();
    //                messageItem.Expanded = false;
    //                messageItem.Height = 45;
    //                messageItem.BorderColor = greyBack;
    //                messageItem.BorderWidth = 1;
    //                messageItem.Attributes.Add("CommandArgument", ds.Tables[0].Rows[i]["ID"].ToString());
    //                messageItem.Attributes.Add("Read", ds.Tables[0].Rows[i]["Read"].ToString());
    //                messageItem.BorderStyle = BorderStyle.Solid;
    //                messageItem.BackColor = greyBack;
    //                string theUser = dsUsers.Tables[0].Rows[0]["UserName"].ToString();
    //                if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1")
    //                {
    //                    theUser = "******";
    //                }
    //                string boldOrNot = "font-size: 12px;";
    //                if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
    //                    boldOrNot = "font-weight:bold;font-size: 14px;";
    //                messageItem.Text = "<table  width=\"560px\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><span style=\"padding-left:5px;font-family:Arial;color: #cccccc; " +
    //                    boldOrNot + "\">From: </span><span style=\"" + boldOrNot + "color: #1fb6e7; font-family: Arial;\">" + theUser
    //                    + "</span></td><td><span style=\"padding-top:10px;font-family:Arial;" +
    //                    boldOrNot + "color: #cccccc;float:right;padding-right:5px;\">" +
    //                    ds.Tables[0].Rows[i]["Date"].ToString() + "</span></td></tr><tr><td colspan=\"3\"><span style=\"font-family:Arial;" + boldOrNot + "color: #cccccc;padding-left: 5px;\">Subject: "
    //                    + ds.Tables[0].Rows[i]["MessageSubject"].ToString() +
    //                    "</span></td></tr></table>";
    //                messageItem.ForeColor = greyText;
    //                ASP.controls_usermessage_ascx message = new ASP.controls_usermessage_ascx();
    //                message.myEvent += new ASP.controls_usermessage_ascx.EventDelegate(this_OnProgress);
    //                message.ID = "message" + i.ToString();
    //                message.MESSAGE_TEXT = ds.Tables[0].Rows[i]["MessageContent"].ToString();
    //                message.SUBJECT_TEXT = ds.Tables[0].Rows[i]["MessageSubject"].ToString();
    //                message.TO_ID = int.Parse(ds.Tables[0].Rows[i]["To_UserID"].ToString());
    //                message.FROM_ID = int.Parse(ds.Tables[0].Rows[i]["From_UserID"].ToString());
    //                message.DATE = ds.Tables[0].Rows[i]["Date"].ToString();
    //                message.MESSAGE_ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString());
    //                message.CONTROL_ID = i;
    //                if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1")
    //                    message.MODE = Controls_UserMessage.Mode.HippoRequest;
    //                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2")
    //                    message.MODE = Controls_UserMessage.Mode.HippoReply;
    //                Telerik.Web.UI.RadPanelItem subItem = new Telerik.Web.UI.RadPanelItem();
    //                subItem.Controls.Add(message);
    //                messageItem.Items.Add(subItem);
    //                MessagePanelBar.Items.Add(messageItem);
    //                //message.DATE = ds.Tables[0].Rows[i]["Date"].ToString();
    //                //MessagePanel.Controls.Add(message);
    //            }
    //            if (ds.Tables[0].Rows.Count % 10 != 0 || ds.Tables[0].Rows.Count == 10)
    //            {
    //                 a.Add(MessagePanelBar);
    //            }
    //        }
    //    pagerPanel.DATA = a;
    //    pagerPanel.DataBind2();
    //    Label label = new Label();
    //    string temp = "messages";
    //    if (ds.Tables[0].Rows.Count == 1)
    //        temp = "message";
    //    label.Text = "<span style=\"font-family: Arial; font-size: 20px; color: White;\">My Messages</span>"
    //        + "<span style=\"font-family: Arial; font-size: 12px; color: #cccccc; padding-left: 5px;\">(" + unreadCount.ToString()
    //        + " new " + temp + ")</span>";
    //    MessagesPanel.Controls.Clear();
    //    MessagesPanel.Controls.Add(label);
    //    MessagesPanel.Controls.Add(pagerPanel);
    //}
    protected int AddMessages(DataSet ds, ref ArrayList a, bool areSent)
    {
        //Mode 4,5: venue,event changes request
        //Mode 2: Friend request
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string message = "";
        try
        {
            int itemCount = 0;
            int times = 1;
            int unreadCount = 0;

            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            Telerik.Web.UI.RadPanelBar bar = new Telerik.Web.UI.RadPanelBar();
            bar.BorderColor = greyBorder;
            bar.BorderWidth = 3;
            bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.Linear;
            bar.ExpandAnimation.Duration = 50;
            bar.AllowCollapseAllItems = true;
            bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem;
            bar.Width = 570;

            int replyMessagesCount = 0;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                message = ds.Tables[0].Rows[i]["ID"].ToString();
                if (itemCount == 20 * times)
                {
                    if (!areSent)
                    {
                        bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead);
                    }
                    a.Add(bar);
                    bar = new Telerik.Web.UI.RadPanelBar();

                    bar.BorderColor = greyBorder;
                    bar.BorderWidth = 3;
                    bar.ExpandAnimation.Type = Telerik.Web.UI.AnimationType.Linear;
                    bar.ExpandAnimation.Duration = 50;
                    bar.AllowCollapseAllItems = true;
                    bar.ExpandMode = Telerik.Web.UI.PanelBarExpandMode.SingleExpandedItem;
                    bar.Width = 570;

                    times++;
                }
                itemCount++;
                Telerik.Web.UI.RadPanelItem item = new Telerik.Web.UI.RadPanelItem();

                item.BackColor = greyDark;
                item.CssClass = "OneMessage";
                item.SelectedCssClass = "OneMessageSelected";

                #region Mark If Read
                if (!areSent)
                {
                    if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
                    {
                        item.Text = "<div id=\"divID" + i.ToString() + "\" style=\"font-weight: bold; color: White;\"><div style=\"float: left;\">From: <span class=\"AddLinkNotBold\">" +
                            ds.Tables[0].Rows[i]["UserName"].ToString() +
                            "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subject:&nbsp;&nbsp;</div><div style=\"" +
                        "width: 200px; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() +
                            "</div><div style=\"float: right; margin-right: 8px;\">" +
                                ds.Tables[0].Rows[i]["Date"].ToString() + "</div></div>";
                        item.Value = ds.Tables[0].Rows[i]["ID"].ToString();
                    }
                    else
                    {
                        item.Text = "<div style=\"float: left; color: #cccccc;\">From: <span class=\"AddLinkNotBold\">" +
                            ds.Tables[0].Rows[i]["UserName"].ToString() +
                            "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subject:&nbsp;&nbsp;</div><div style=\"" +
                        "width: 200px; color: #cccccc; text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() +
                            "</div><div style=\"float: right; margin-right: 8px; color: #cccccc;\">" +
                                ds.Tables[0].Rows[i]["Date"].ToString() + "</div>";
                        item.Value = ds.Tables[0].Rows[i]["ID"].ToString();
                    }
                }
                else
                {
                    item.Text = "<div style=\"float: left; color: #cccccc;\">To: <span class=\"AddLinkNotBold\">" + ds.Tables[0].Rows[i]["UserName"].ToString() +
                        "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subject:&nbsp;&nbsp;</div><div style=\"width: 200px;  color: #cccccc;text-wrap: true; float: left;\">" + ds.Tables[0].Rows[i]["MessageSubject"].ToString() +
                        "</div><div style=\"float: right; margin-right: 8px; color: #cccccc;\">" + ds.Tables[0].Rows[i]["Date"].ToString() + "</div>";
                    item.Value = ds.Tables[0].Rows[i]["ID"].ToString();
                }

                #endregion

                #region Create Delete Button
                item.Expanded = false;

                Telerik.Web.UI.RadPanelItem item2 = new Telerik.Web.UI.RadPanelItem();
                item2.BackColor = greyDark;
                item2.CssClass = "OneMessageContent";

                Literal wrapLit = new Literal();
                wrapLit.Text = "<div class=\"topDiv\" style=\"min-height: 200px; overflow:hidden;\">" +
                    "<div style=\"width: 100%;\"><div align=\"right\" style=\" padding-bottom: 10px;padding-right: 22px; display: block;\">";
                item2.Controls.Add(wrapLit);

                ImageButton xIt = new ImageButton();

                xIt.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "X" + i.ToString();
                xIt.Width = 16;
                xIt.Height = 16;
                xIt.ImageUrl = "~/image/X.png";
                xIt.AlternateText = "Delete Message";
                xIt.ToolTip = "Delete Message";
                xIt.CommandArgument = ds.Tables[0].Rows[i]["ID"].ToString();
                xIt.Click += new ImageClickEventHandler(ServerDeleteMessage);
                //xIt.Attributes.Add("onserverclick", "ServerDeleteMessage");
                xIt.Attributes.Add("onmouseover", "this.src = 'image/XSelected.png';");
                xIt.Attributes.Add("onmouseout", "this.src = 'image/X.png';");
                xIt.OnClientClick = "return confirm('Do you want to delete this message?');";

                item2.Controls.Add(xIt);

                #endregion

                #region Construct Message Content

                wrapLit = new Literal();
                wrapLit.Text = "</div></div><div style=\"width: 100%; display: block;\"><div style=\"float: left;\"> ";

                item2.Controls.Add(wrapLit);

                Label theMessage = new Label();
                theMessage.BackColor = greyDark;
                theMessage.CssClass = "OneMessageContent";
                theMessage.Width = 300;
                theMessage.Text = ds.Tables[0].Rows[i]["MessageContent"].ToString();

                string groupID = "";

                DataSet dsEvent = new DataSet();
                DataSet dsSentUser = new DataSet();
                if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                {
                   string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString();
                    string [] delimeter = {",UserID:"};
                    string[] thetokens = abc.Replace("EventID:", "").Split(delimeter, StringSplitOptions.None);

                    string[] delimeter2 = { ",RevisionID:" };
                    string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None);

                    dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID="+thetokens2[0]);
                    dsEvent = dat.GetData("SELECT * FROM Events WHERE ID="+thetokens[0]);

                    theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(dsSentUser.Tables[0].Rows[0]["UserName"].ToString()) + "_Friend\" class=\"AddGreenLink\">" +
                        dsSentUser.Tables[0].Rows[0]["UserName"].ToString() + "</a> has requested to make a " +
                        "change to the event '" + dsEvent.Tables[0].Rows[0]["Header"].ToString() +
                        "'.<br/>Click <a class=\"AddLink\" href=\"" + dat.MakeNiceName(dsEvent.Tables[0].Rows[0]["Header"].ToString()) +
                        "_" + thetokens[0] + "_Event\">here</a> to view this event. <br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " +
                        "within <span style=\"color: #ff7704; font-weight: bold;\">4 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." +
                        "<br/>For each one of the changes which you accept, please select 'Accept Changes' on the right. If no changes are listed on the right, this means " +
                        "the user chose to only add media (songs/videos/pictues) or add new categories which have been automatically added to the event.";
                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5")
                {
                    //VenueID:90,UserID:40,RevisionID:90
                    string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString();
                    string[] delimeter = { ",UserID:" };
                    string[] thetokens = abc.Replace("VenueID:", "").Split(delimeter, StringSplitOptions.None);

                    string[] delimeter2 = { ",RevisionID:" };
                    string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None);

                    dsSentUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + thetokens2[0]);
                    string fromUserName = dsSentUser.Tables[0].Rows[0]["UserName"].ToString();
                    dsEvent = dat.GetData("SELECT * FROM Venues WHERE ID=" + thetokens[0]);
                    string eventName = dsEvent.Tables[0].Rows[0]["Name"].ToString();
                    theMessage.Text = "Hello from HippoHappenings,<br/><br/> The user <a href=\"" + dat.MakeNiceName(fromUserName) + "_Friend\" class=\"AddGreenLink\">" +
                        fromUserName + "</a> has requested to make a " +
                        "change to the venue '" + eventName +
                        "'.<br/>Click <a class=\"AddLink\" href=\"" + dat.MakeNiceName(eventName) + "_" + thetokens[0] + "_Venue\">here</a> to view this venue.<br/> <br/> We must fully stress that if you do not either accept or reject ALL the requested chanes " +
                        "within <span style=\"color: #ff7704; font-weight: bold;\">7 days</span>, your ownership of this event will be waived and taken over by someone else willing to be the moderator for this event." +
                        "<br/>For each one of the changes, please select 'Accept' or 'Reject'. If no changes are listed on the right, this means " +
                        "the user chose to only add media (videos/pictues) which have been automatically added to the venue.";

                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "7" ||
               ds.Tables[0].Rows[i]["Mode"].ToString() == "9")
                {
                    string usethis = ds.Tables[0].Rows[i]["MessageContent"].ToString();
                    char ab = usethis[0];
                    groupID = ab.ToString();
                    int next = 1;
                    ab = usethis[next];
                    groupID += ab.ToString();
                    while(ab != ' ')
                    {
                        ab = usethis[++next];
                        groupID += ab.ToString();
                    }
                    theMessage.Text = usethis.Substring(next);
                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "8")
                {
                    string usethis = ds.Tables[0].Rows[i]["MessageContent"].ToString();
                    char ab = usethis[0];
                    groupID = ab.ToString();
                    int next = 1;
                    ab = usethis[next];
                    groupID += ab.ToString();
                    while (ab != ' ')
                    {
                        ab = usethis[++next];
                        groupID += ab.ToString();
                    }
                    DataView dvU = dat.GetDataDV("SELECT * FROM Users WHERE User_ID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString());
                    DataView dvG = dat.GetDataDV("SELECT * FROM Groups WHERE ID=" + groupID);
                    theMessage.Text = "The user <a class=\"AddLink\" href=\"" +
                        dvU[0]["UserName"].ToString() + "_Friend\">" + dvU[0]["UserName"].ToString() + "</a> has requested to join the group '" +
                        dvG[0]["Header"].ToString() + "'. Here is their message: <br/>" + usethis.Substring(next);
                }

                if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString() && theMessage.Text.Contains("My Preferences"))
                {
                    theMessage.Text = theMessage.Text.Replace("<a class=\"AddLink\" href=\"UserPreferences.aspx\">My Preferences</a>.", "");
                    Literal theLit = new Literal();
                    theLit.Text = "<div class=\"OneMessageContent\">" + theMessage.Text +
                        "<div style=\"cursor: pointer;\" onclick=\"SelectPreferences();\" class=\"AddLink\">My Preferences</div></div>";
                    item2.Controls.Add(theLit);
                }
                else
                {
                    item2.Controls.Add(theMessage);
                }

                wrapLit = new Literal();
                wrapLit.Text = "</div>";

                item2.Controls.Add(wrapLit);

                if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
                    unreadCount++;

                if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2")
                {
                    DataSet ds3 = dat.GetData("SELECT * FROM User_Friends WHERE UserID=" + Session["User"].ToString() +
                    " AND FriendID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString());

                    bool hasFriend = false;

                    if (ds3.Tables.Count > 0)
                        if (ds3.Tables[0].Rows.Count > 0)
                            hasFriend = true;
                        else
                            hasFriend = false;
                    else
                        hasFriend = false;

                    if (!areSent)
                    {
                        if (!hasFriend)
                        {

                            HtmlButton img = new HtmlButton();

                            img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "accept" + i.ToString();
                            img.Style.Value = "margin-top: 20px; margin-left: 50px;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                            "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                            "no-repeat; border: 0;";
                            img.ServerClick += new EventHandler(ServerAcceptFriend);
                            img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                            img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                            img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                            img.InnerText = "Accept Friend";

                            item2.Controls.Add(img);
                        }
                        else
                        {
                            Literal lit = new Literal();
                            lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">You have accepted this gal/guy as a friend! Good luck, you two!</div>";
                            item2.Controls.Add(lit);
                        }
                    }
                    else
                    {
                        if (!hasFriend)
                        {
                            Literal lit = new Literal();
                            lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">You are still waiting for a response from this user!</div>";
                            item2.Controls.Add(lit);
                        }
                        else
                        {
                            Literal lit = new Literal();
                            lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" class=\"AddGreenLink\">Your friend has already accepted your invitation!</div>";
                            item2.Controls.Add(lit);
                        }
                    }
                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4" ||
                    ds.Tables[0].Rows[i]["Mode"].ToString() == "5")
                {
                    string abc = ds.Tables[0].Rows[i]["MessageContent"].ToString();
                    string [] delimeter = {",UserID:"};

                    string temp = "VenueID:";
                    if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                        temp = "EventID:";
                    string [] thetokens = abc.Replace(temp, "").Split(delimeter, StringSplitOptions.None);

                    string[] delimeter2 = { ",RevisionID:" };
                    string[] thetokens2 = thetokens[1].Split(delimeter2, StringSplitOptions.None);

                    string temp2 = "";
                    if (thetokens2[1].Trim() != "")
                    {
                        temp = "VenueRevisions";
                        if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                            temp = "EventRevisions";

                        DataSet dsChanges = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + thetokens2[1]);

                        if (dsChanges.Tables[0].Rows.Count > 0)
                        {
                            temp = "Venues";
                            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                                temp = "Events";

                            temp2 = "VenueID";
                            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                                temp2 = "EventID";

                            DataSet dsEvent2 = dat.GetData("SELECT * FROM " + temp + " WHERE ID=" + dsChanges.Tables[0].Rows[0][temp2].ToString());

                            Literal theLit = new Literal();
                            theLit.Text = "<table style=\"margin-right: 10px;margin-bottom: 20px;color: #cccccc;border: solid 1px #1fb6e7;\"><tr><td>";
                            item2.Controls.Add(theLit);

                            int count = 1;
                            string tempstr = "<div class=\"topDiv\"><hr color=\"#1fb6e7\" size=\"1\" width=\"100%\"/></div></td></tr><tr><td>";

                            int tempInt = 9;
                            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                                tempInt = 12;

                            for (int n = 0; n < tempInt; n++)
                            {
                                InsertRevision(ref item2, dsChanges, n, tempstr, ref count, ds, i);
                            }
                            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "5")
                            {
                                CategoryChanges(ref item2, thetokens2, ref count, tempstr, true);
                            }

                            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                            {
                                EventOccuranceChanges(ref item2, ref count, thetokens2, tempstr);
                                CategoryChanges(ref item2, thetokens2, ref count, tempstr, false);
                            }
                            theLit = new Literal();
                            theLit.Text = "</td></tr></table>";
                            item2.Controls.Add(theLit);
                        }
                    }
                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "7")
                {
                    Literal lit = new Literal();
                    lit.Text = "<div style=\"width: 220px; float: right;\" >";
                    item2.Controls.Add(lit);
                    message = "SELECT * FROM Group_Members WHERE MemberID=" +
                        Session["User"].ToString() + " AND GroupID=" + groupID;
                    DataView dvMember = dat.GetDataDV(message);
                    if (dvMember.Count > 0)
                    {
                        if (bool.Parse(dvMember[0]["Accepted"].ToString()))
                        {
                            lit = new Literal();
                            lit.Text = "<label class=\"AddGreenLink\">You have accepted this membership.</label>";
                            item2.Controls.Add(lit);
                        }
                        else
                        {
                            HtmlButton img = new HtmlButton();
                            img.ID = "acceptMembership" + groupID;
                            img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                            "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                            "no-repeat; border: 0;";
                            img.ServerClick += new EventHandler(AcceptMembership);
                            img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                            img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                            img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';");

                            img.InnerText = "Accept";

                            item2.Controls.Add(img);
                        }

                    }
                    else
                    {
                        lit = new Literal();
                        lit.Text = "<label class=\"AddGreenLink\">The invitation no longer stands.</label>";
                        item2.Controls.Add(lit);
                    }
                    lit = new Literal();
                    lit.Text = "</div>";
                    item2.Controls.Add(lit);

                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "8")
                {
                    Literal lit = new Literal();
                    lit.Text = "<div style=\"width: 220px; float: right;\" >";
                    item2.Controls.Add(lit);

                    DataView dvMember = dat.GetDataDV("SELECT * FROM Group_Members WHERE MemberID=" + ds.Tables[0].Rows[i]["From_UserID"].ToString() +
                        " AND GroupID=" + groupID);

                    bool getIt = false;
                    if (dvMember.Count > 0)
                    {
                        if (bool.Parse(dvMember[0]["Accepted"].ToString()))
                        {
                            lit = new Literal();
                            lit.Text = "<label class=\"AddGreenLink\">You have approved this membership.</label>";
                            item2.Controls.Add(lit);
                        }
                        else
                        {
                            getIt = true;
                        }
                    }
                    else
                        getIt = true;

                    if(getIt)
                    {
                        HtmlButton img = new HtmlButton();
                        img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "acceptMembership" + groupID;
                        img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                        "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                        "no-repeat; border: 0;";
                        img.ServerClick += new EventHandler(ApproveMembership);
                        img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                        img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                        img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';");

                        img.InnerText = "Approve";

                        item2.Controls.Add(img);
                    }
                    lit = new Literal();
                    lit.Text = "</div>";

                    item2.Controls.Add(lit);

                }
                else if (ds.Tables[0].Rows[i]["Mode"].ToString() == "9")
                {
                    Literal lit = new Literal();
                    lit.Text = "<div style=\"width: 220px; float: right;\" >";
                    item2.Controls.Add(lit);

                    DataView dvReoccurr = dat.GetDataDV("SELECT * FROM GroupEvent_Occurance WHERE GroupEventID=" +
                        groupID);
                    string reoccurrID = dvReoccurr[0]["ID"].ToString();

                    DataView dvMember = dat.GetDataDV("SELECT * FROM GroupEvent_Members WHERE UserID=" +
                        Session["User"].ToString() +
                        " AND GroupEventID=" + groupID + " AND ReoccurrID=" + reoccurrID);
                    bool getIt = false;
                    if (dvMember.Count > 0)
                    {
                        if (dvMember[0]["Accepted"] != null)
                        {
                            if (dvMember[0]["Accepted"].ToString() != "")
                            {
                                if (bool.Parse(dvMember[0]["Accepted"].ToString()))
                                {
                                    lit = new Literal();
                                    lit.Text = "<label class=\"AddGreenLink\">You have accepted this invitation.</label>";
                                    item2.Controls.Add(lit);
                                }
                                else
                                {
                                    getIt = true;
                                }
                            }
                            else
                                getIt = true;
                        }
                        else
                            getIt = true;
                    }
                    else
                    getIt = true;
                bool regEnded = HasRegistrationEnded(groupID, reoccurrID);
                    if(getIt)
                    {
                        if (regEnded)
                        {
                            lit = new Literal();
                            lit.Text = "<label class=\"AddGreenLink\">Registration for this events has ended.</label>";
                            item2.Controls.Add(lit);
                        }
                        else
                        {
                            HtmlButton img = new HtmlButton();
                            img.ID = groupID + "acceptInvitation" + reoccurrID;
                            img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                            "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                            "no-repeat; border: 0;";
                            img.ServerClick += new EventHandler(AcceptInvitation);
                            img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                            img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                            img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';");

                            img.InnerText = "Accept";

                            item2.Controls.Add(img);
                        }
                    }
                    lit = new Literal();
                    lit.Text = "</div>";

                    item2.Controls.Add(lit);

                }
                else
                {
                    if (!areSent)
                    {

                        if (ds.Tables[0].Rows[i]["From_UserID"].ToString() == dat.HIPPOHAPP_USERID.ToString())
                        {

                        }
                        else
                        {
                            //Insert ability to reply to message
                            Literal lit = new Literal();
                            lit.Text = "<div style=\"width: 220px; float: right;\" >";

                            item2.Controls.Add(lit);

                            TextBox textbox = new TextBox();
                            textbox.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "textbox" + ds.Tables[0].Rows[i]["ID"].ToString();
                            textbox.Width = 200;
                            textbox.Height = 100;
                            textbox.TextMode = TextBoxMode.MultiLine;

                            item2.Controls.Add(textbox);

                            lit = new Literal();
                            lit.Text = "<br/><br/><br/>";

                            item2.Controls.Add(lit);

                            HtmlButton img = new HtmlButton();
                            img.ID = ds.Tables[0].Rows[i]["From_UserID"].ToString() + "reply" + ds.Tables[0].Rows[i]["ID"].ToString();
                            img.Style.Value = "cursor: pointer;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                            "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                            "no-repeat; border: 0;";
                            img.ServerClick += new EventHandler(ServerReply);
                            img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                            img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                            img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage='url(image/PostButtonNoPostHover.png)';");

                            img.InnerText = "Reply";

                            item2.Controls.Add(img);

                            lit = new Literal();
                            lit.Text = "</div>";

                            item2.Controls.Add(lit);

                            replyMessagesCount++;
                        }
                    }
                }

                wrapLit = new Literal();

                wrapLit.Text = "</div></div>";
                item2.Controls.Add(wrapLit);

                item.Items.Add(item2);
                bar.Items.Add(item);
                #endregion
            }

            if (ds.Tables[0].Rows.Count % 20 != 0 || ds.Tables[0].Rows.Count == 20)
            {
                if (!areSent)
                {
                    bar.ItemClick += new Telerik.Web.UI.RadPanelBarEventHandler(ServerMarkRead);
                }
                a.Add(bar);
            }

            return unreadCount;
        }
        catch (Exception ex)
        {
            UserErrorLabel.Text = ex.ToString() + "<br/>" + message;
            return 0;
        }
    }
Ejemplo n.º 37
0
    protected void FillGroups()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        DataView dvUsersGroups = dat.GetDataDV("SELECT * FROM Group_Members GM, Groups G WHERE "+
            "GM.GroupID=G.ID AND GM.Accepted='True' AND GM.MemberID=" + Session["User"].ToString() +" ORDER BY GM.ID");

        Literal lit;
        CheckBox check;
        string sharedHost = "";

        if (dvUsersGroups.Count > 0)
        {
            //Check for New Group Messages Since last Sign on
            //GetGroupMessages();

            foreach (DataRowView row in dvUsersGroups)
            {
                lit = new Literal();

                sharedHost = "";
                if (bool.Parse(row["SharedHosting"].ToString()))
                    sharedHost = "<label> | Shared Host</label>";
                if (row["Host"].ToString() == Session["User"].ToString())
                    sharedHost = "<label> | Primary Host</label>";

                if (sharedHost == "")
                    sharedHost = "<label> | Member</label>";

                lit.Text = "<div style=\"padding-top: 10px;\"><a href=\"" + dat.MakeNiceName(row["Header"].ToString()) +
                    "_" + row["GroupID"].ToString() + "_Group\" class=\"AddGreenLink\">" + row["Header"].ToString() +
                    "</a><label> | </label><a class=\"AddLink\" onclick=\"OpenRevoke('" + row["GroupID"].ToString() +
                    "')\">Revoke group membership</a>" + sharedHost + "</div><div style=\"padding-left: 20px;\">";
                GroupsPanel.Controls.Add(lit);

                check = new CheckBox();
                check.Text = "Receive emails when new group thread is posted.";
                check.ID = "thread" + row["GroupID"].ToString();
                if (row["Prefs"] != null)
                {
                    if (row["Prefs"].ToString().Trim() != "")
                    {
                        if (row["Prefs"].ToString().Trim().Contains("1"))
                            check.Checked = true;
                    }
                }
                GroupsPanel.Controls.Add(check);

                lit = new Literal();
                lit.Text = "<br/>";
                GroupsPanel.Controls.Add(lit);

                check = new CheckBox();
                check.Text = "Receive emails if new events have been posted in the group.";
                check.ID = "newevent" + row["GroupID"].ToString();
                GroupsPanel.Controls.Add(check);

                if (row["Prefs"] != null)
                {
                    if (row["Prefs"].ToString().Trim() != "")
                    {

                        if (row["Prefs"].ToString().Trim().Contains("2"))
                            check.Checked = true;
                    }
                }

                if (row["Host"].ToString() == Session["User"].ToString())
                {
                    lit = new Literal();
                    lit.Text = "<br/>";
                    GroupsPanel.Controls.Add(lit);

                    check = new CheckBox();
                    check.Text = "Receive emails when users request to be part of the group.";
                    check.ID = "joinButton" + row["GroupID"].ToString();
                    GroupsPanel.Controls.Add(check);

                    if (row["Prefs"] != null)
                    {
                        if (row["Prefs"].ToString().Trim() != "")
                        {

                            if (row["Prefs"].ToString().Trim().Contains("3"))
                                check.Checked = true;
                        }
                    }
                }

                lit = new Literal();
                lit.Text = "<br/>";
                GroupsPanel.Controls.Add(lit);

                check = new CheckBox();
                check.Text = "Receive emails if new messages have been posted on the group board.";
                check.ID = "board" + row["GroupID"].ToString();
                GroupsPanel.Controls.Add(check);

                if (row["Prefs"] != null)
                {
                    if (row["Prefs"].ToString().Trim() != "")
                    {

                        if (row["Prefs"].ToString().Trim().Contains("4"))
                            check.Checked = true;
                    }
                }

                lit = new Literal();
                lit.Text = "</div>";

                GroupsPanel.Controls.Add(lit);
            }

            lit = new Literal();
            lit.Text = "<div style=\"float: right;\">";
            GroupsPanel.Controls.Add(lit);

            HtmlButton img = new HtmlButton();
            img.ID = "groupButton" + Session["User"].ToString();
            img.Style.Value = "cursor: pointer;margin-top: 20px; margin-left: 50px;padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
            "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
            "no-repeat; border: 0;";
            img.ServerClick += new EventHandler(SaveGroupsPrefs);
            img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
            img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
            img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
            img.InnerHtml = "Save";

            GroupsPanel.Controls.Add(img);

            lit = new Literal();
            lit.Text = "</div>";
            GroupsPanel.Controls.Add(lit);
        }
        else
        {
            lit = new Literal();
            lit.Text = "<label>You are not a member of any groups.</label>";
            GroupsPanel.Controls.Add(lit);
        }
    }
Ejemplo n.º 38
0
 public static void ClickButton()
 {
     var btn = new HtmlButton(browserWindow) { TechnologyName = "Web" };
     try
     {
         btn.SearchProperties.Add(CSVReader.ControlType+".PropertyNames." + CSVReader.LocatorType, CSVReader.LocatorValue);
         btn.WaitForControlEnabled();
         btn.WaitForControlReady();
     }
     catch (Exception)
     {
         Assert.Fail("Failed to find " + CSVReader.ControlType + " Element - Element not Found");
     }
     Mouse.Click(btn);
 }
Ejemplo n.º 39
0
        public void MOPAddWellStatusWin(string ComboBox, string CBValue, string WellName)
        {
            WinWindow MOPAddWellStatWin = new WinWindow();
            MOPAddWellStatWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770");
            MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Add Well Status/MOP/Type History to Selected Well");

            #region CB
            switch (ComboBox)
            {
                case "NewStatus":
                    {
                        WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin);
                        NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo");
                        NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "3"); // New Status CB
                        NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");
                        WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First();

                        WinWindow ComboBoxWindow = new WinWindow();
                        ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox";
                        ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
                        ComboBoxWindow.WindowTitles.Add("ComboBox");

                        WinWindow UIListWin = new WinWindow(ComboBoxWindow);
                        UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list";
                        UIListWin.WindowTitles.Add("ComboBox");
                        if (NewStatusComboBox.SelectedItem != CBValue)
                        {

                            //Mouse.Click(NewStatusComboBox);
                            // NewStatusComboBox.Expanded = true;

                            //WinList List = new WinList(UIListWin);
                            //List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                            //List.WindowTitles.Add("ComboBox");
                            //string[] Items = List.SelectedItems;
                            //foreach (string item in Items)
                            //{
                            //    if (item == CBValue)
                            //    {
                            //        WinListItem ItemToClick = new WinListItem(UIListWin);
                            //        ItemToClick.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                            //        ItemToClick.SearchProperties.Add(WinListItem.PropertyNames.Name, item);
                            //        Mouse.Click(ItemToClick);
                            //    }
                            //}
                            while (NewStatusComboBox.SelectedItem != CBValue)
                            {

                                Mouse.Click(NewStatusComboBox);
                                Trace.WriteLine("Clicked Status Combo Box");
                                //NewStatusComboBox.Expanded = true;
                                //Trace.WriteLine("Expanded Status Combo Box");
                                System.Threading.Thread.Sleep(5000);
                                WinList List = new WinList(UIListWin);
                                List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                List.WindowTitles.Add("ComboBox");

                                WinListItem Item = new WinListItem(UIListWin);
                                Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue);

                                if (UIListWin.Exists && Item.Exists)
                                {
                                    // List.SelectedItemsAsString = CBValue;
                                    Mouse.Hover(Item);
                                    Trace.WriteLine("Mouse Hover on item " + Item);
                                    //System.Threading.Thread.Sleep(3000);
                                    Mouse.DoubleClick(Item);
                                    Trace.WriteLine("Double Click " + Item);
                                }

                            }
                        }
                        Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL  " + CBValue + " the correct item was not set");
                        break;
                    }

                case "MOP":
                    {
                        WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin);
                        NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo");
                        NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // MOP CB
                        NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First();

                        WinWindow ComboBoxWindow = new WinWindow();
                        ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox";
                        ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
                        ComboBoxWindow.WindowTitles.Add("ComboBox");

                        WinWindow UIListWin = new WinWindow(ComboBoxWindow);
                        UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list";
                        UIListWin.WindowTitles.Add("ComboBox");
                        if (NewStatusComboBox.SelectedItem != CBValue)
                        {
                            while (NewStatusComboBox.SelectedItem != CBValue)
                            {

                                Mouse.Click(NewStatusComboBox);
                                Trace.WriteLine("Clicked MOP combobox");
                                //NewStatusComboBox.Expanded = true;
                                //Trace.WriteLine("Expanded MOP combobox");
                                System.Threading.Thread.Sleep(5000);
                                WinList List = new WinList(UIListWin);
                                List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                List.WindowTitles.Add("ComboBox");

                                WinListItem Item = new WinListItem(UIListWin);
                                Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue);

                                if (UIListWin.Exists && Item.Exists)
                                {
                                    // List.SelectedItemsAsString = CBValue;
                                    Mouse.Hover(Item);
                                    Trace.WriteLine("Mouse Hover on item " + Item);
                                    //System.Threading.Thread.Sleep(3000);
                                    Mouse.DoubleClick(Item);
                                    Trace.WriteLine("Double Click " + Item);
                                }

                            }
                        }
                        Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL  " + CBValue + " the correct item was not set");
                        break;
                    }

                case "WellType":
                    {
                        WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin);
                        NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo");
                        //NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); //
                        NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");
                        WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First();

                        WinWindow ComboBoxWindow = new WinWindow();
                        ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox";
                        ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
                        ComboBoxWindow.WindowTitles.Add("ComboBox");

                        WinWindow UIListWin = new WinWindow(ComboBoxWindow);
                        UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list";
                        UIListWin.WindowTitles.Add("ComboBox");

                        if (NewStatusComboBox.SelectedItem != CBValue)
                        {
                            while (NewStatusComboBox.SelectedItem != CBValue)
                            {

                                Mouse.Click(NewStatusComboBox);
                                Trace.WriteLine("Clicked WellType combobox");
                                //NewStatusComboBox.Expanded = true;
                                //Trace.WriteLine("Expanded WellType combobox");
                                System.Threading.Thread.Sleep(5000);
                                WinList List = new WinList(UIListWin);
                                List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                List.WindowTitles.Add("ComboBox");

                                WinListItem Item = new WinListItem(UIListWin);
                                Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                                Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue);

                                if (UIListWin.Exists && Item.Exists)
                                {
                                    // List.SelectedItemsAsString = CBValue;
                                    Mouse.Hover(Item);
                                    Trace.WriteLine("Mouse Hover on item " + Item);
                                    //System.Threading.Thread.Sleep(3000);
                                    Mouse.DoubleClick(Item);
                                    Trace.WriteLine("Mouse DoubleClick on item " + Item);
                                }

                            }
                        }
                        Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL  " + CBValue + " the correct item was not set");
                        break;
                    }
                case "StatusComment":
                    {
                        WinClient CommentClient = new WinClient(MOPAddWellStatWin);
                        CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
                        CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient);
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null;
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
                        EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well";
                        EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        HtmlTextArea CommentTB = new HtmlTextArea(EventDocument);
                        CommentTB.SearchProperties[HtmlEdit.PropertyNames.Id] = "5";
                        CommentTB.SearchProperties[HtmlEdit.PropertyNames.Name] = null;
                        CommentTB.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null;
                        CommentTB.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                        CommentTB.FilterProperties[HtmlEdit.PropertyNames.Class] = "csTextArea";
                        CommentTB.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "tabIndex=0 id=5 title=\"\" class=csTextAre";
                        CommentTB.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "1";
                        CommentTB.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Mouse.Click(CommentTB);
                        Trace.WriteLine("Mouse Clicked inside comment textbox");
                        Keyboard.SendKeys(CommentTB, "A", ModifierKeys.Control);
                        Trace.WriteLine("Control + A sent to textbox");
                        Keyboard.SendKeys(CBValue);
                        Trace.WriteLine("Textbox comment set to " + CBValue);
                        break;
                    }

                case "OKGreenCheck":
                    {
                        WinClient CommentClient = new WinClient(MOPAddWellStatWin);
                        CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
                        CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient);
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null;
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
                        EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well";
                        EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        HtmlButton OkGreenCheck = new HtmlButton(EventDocument);
                        OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Id] = "savebtn";
                        OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        OkGreenCheck.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Title] = "Add Well Status Comment";
                        OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=addwlstatevnt() id=savebtn title";
                        OkGreenCheck.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "1";
                        OkGreenCheck.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Mouse.Click(OkGreenCheck);
                        Trace.WriteLine("Clicked Green OK Check");

                        WinButton WarningOKButton = new WinButton();
                        WarningOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK";
                        WarningOKButton.WindowTitles.Add("VBScript: Warning");

                        WinButton ChangedOKButton = new WinButton();
                        ChangedOKButton.SearchProperties[WinButton.PropertyNames.Name] = "OK";
                        ChangedOKButton.WindowTitles.Add("VBScript: Message");

                        Rectangle WarningOKButtonRect = WarningOKButton.BoundingRectangle;
                        int WarningOKButtonRectx = (WarningOKButtonRect.X + (WarningOKButtonRect.Width / 2));
                        int WarningOKButtonRecty = (WarningOKButtonRect.Y + (WarningOKButtonRect.Height / 2));
                        Mouse.Click(new Point(WarningOKButtonRectx, WarningOKButtonRecty));
                        Trace.WriteLine("Clicked  OK on warning OK button");

                        if (WellName.Contains("GVFD"))
                        {
                            System.Threading.Thread.Sleep(20000); // ESP to Beam takes an extraordinary amount of time to change the MOP
                        }
                        Rectangle ChangedOKButtonRect = ChangedOKButton.BoundingRectangle;
                        int ChangedOKButtonRectx = (ChangedOKButtonRect.X + (ChangedOKButtonRect.Width / 2));
                        int ChangedOKButtonRecty = (ChangedOKButtonRect.Y + (ChangedOKButtonRect.Height / 2));
                        Mouse.Click(new Point(ChangedOKButtonRectx, ChangedOKButtonRecty));
                        Trace.WriteLine("Clicked  OK on MOPChanged OK button");
                        //Mouse.Click(WarningOKButton);

                        break;
                    }

                case "RedXButton":
                    {
                        WinClient CommentClient = new WinClient(MOPAddWellStatWin);
                        CommentClient.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
                        CommentClient.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument EventDocument = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(CommentClient);
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null;
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
                        EventDocument.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
                        EventDocument.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Adding Well Status Event to Selected Well";
                        EventDocument.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        HtmlButton RedXButton = new HtmlButton(EventDocument);
                        RedXButton.SearchProperties[HtmlButton.PropertyNames.Id] = "first";
                        RedXButton.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        RedXButton.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        RedXButton.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        RedXButton.FilterProperties[HtmlButton.PropertyNames.Title] = "Cancel Add";
                        RedXButton.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        RedXButton.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "onclick=canceladd() id=first title=\"Canc";
                        RedXButton.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "2";
                        RedXButton.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");

                        Mouse.Click(RedXButton);
                        Trace.WriteLine("Clicked Red X Check button");

                        break;
                    }

            }
            #endregion
        }
Ejemplo n.º 40
0
    protected void InsertRevision(ref Telerik.Web.UI.RadPanelItem item2, DataSet dsChanges, int n, 
        string tempstr, ref int count, DataSet ds, int i)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        if (dsChanges.Tables[0].Rows[0][n + 3].ToString().Trim() != "")
        {

            Label theLab = new Label();
            if (count != 1)
                theLab.Text = tempstr;

            string content = "";

            string str = "venue";
            if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
                str = "event";

            bool isVenue = false;
            if (str == "venue")
                isVenue = true;

            string colName = dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower();

            if (!isVenue && (colName == "zip" || colName == "state" || colName == "city" || colName == "country"))
            {

            }
            else
            {
                if (dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower() == "address")
                {
                    DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" +
                        dsChanges.Tables[0].Rows[0]["VenueID"].ToString());
                    if (dvV[0]["Country"].ToString() == "223")
                        content = dat.GetAddress(dsChanges.Tables[0].Rows[0][n + 3].ToString(), false);
                    else
                        content = dat.GetAddress(dsChanges.Tables[0].Rows[0][n + 3].ToString(), true);
                }
                else if (dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower() == "venue")
                {
                    DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dsChanges.Tables[0].Rows[0][n + 3].ToString());
                    content = "<a class=\"AddLink\" target=\"_blank\" href=\"" +
                        dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" +
                        dsChanges.Tables[0].Rows[0][n + 3].ToString() +
                        "_Venue\">" + dvV[0]["Name"].ToString() + "</a>";
                }
                else
                {
                    content = dsChanges.Tables[0].Rows[0][n + 3].ToString();
                }

                theLab.Text += count + ". " + dsChanges.Tables[0].Columns[n + 3].ColumnName + " Change Request To: <br/><br/>" +
                    dat.BreakUpString(content, 30) + "<br/>";
                count++;
                item2.Controls.Add(theLab);

                bool notSeen = dat.isNotSeen(dsChanges, n);
                bool isApproved = dat.isApproved(dsChanges, n);

                bool changeHasBeenMade = true;

                if (notSeen && changeHasBeenMade)
                {
                    HtmlButton img = new HtmlButton();
                    img.Attributes.Add("commArg", str);
                    img.Attributes.Add("commandargument", dsChanges.Tables[0].Rows[0]["ID"].ToString() +
                        "accept" + (n + 3).ToString());
                    img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "accept" + (n + 3).ToString();
                    img.Style.Value = "cursor: pointer;float: right;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                    "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                    "no-repeat; border: 0;";
                    img.ServerClick += new EventHandler(ServerAcceptChange);
                    img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                    img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                    img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                    img.InnerText = "Accept";

                    item2.Controls.Add(img);

                    img = new HtmlButton();
                    img.Attributes.Add("commArg", str);
                    img.Attributes.Add("commandargument", dsChanges.Tables[0].Rows[0]["ID"].ToString() + "reject" +
                        (n + 3).ToString());
                    img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "reject" + (n + 3).ToString();
                    img.Style.Value = "cursor: pointer;float: right;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                    "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                    "no-repeat; border: 0;";
                    img.ServerClick += new EventHandler(ServerRejectChange);
                    img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                    img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                    img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                    img.InnerText = "Reject";

                    item2.Controls.Add(img);
                }
                else
                {

                    theLab = new Label();
                    Label lab2 = new Label();
                    if (isApproved)
                    {

                        theLab.Text = "<br/><br/><span  class=\"AddGreenLink FloatRight\">You have accepted this change.</span>";

                    }
                    else
                    {
                        theLab.Text = "<br/><br/><span  class=\"AddGreenLink FloatRight\">You have rejected this change.</span>";
                    }

                    item2.Controls.Add(lab2);
                    item2.Controls.Add(theLab);
                }
                Literal theLit = new Literal();
                theLit.Text = "</td></tr><tr><td>";

                item2.Controls.Add(theLit);

            }
        }
    }
Ejemplo n.º 41
0
    protected void ServerRejectChange(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            HtmlButton thebutton = (HtmlButton)sender;

            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            string theRow = "";
            bool isVenue = false;

            if (thebutton.Attributes["commArg"].ToString().ToLower() == "venue")
                isVenue = true;

            string rowID = "";

            if (isVenue)
            {
                if (thebutton.Attributes["commandargument"].Contains("category"))
                {
                    //THIS PART NOW TAKEN CARE OF BY REJECTCATEGORY METHOD
                    //rowID = thebutton.Attributes["commandargument"].Replace("category", "");
                    //theRow = rowID;

                    //string venueName = dat.GetData("SELECT * FROM Venues V, VenueCategoryRevisions VCR WHERE V.ID=VCR.VenueID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                    //string categoryName = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, VenueCategories VC " +
                    //    "WHERE VC.CategoryID=VCR.CategoryID AND VCR.ID=" + rowID).Tables[0].Rows[0]["CategoryName"].ToString();
                    //dat.Execute("UPDATE VenueCategoryRevisions SET Approved='False' WHERE ID=" + rowID);

                    //DataSet dsRevision = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                    //DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    //string emailBody = "The category suggestion '" + categoryName + "' has been rejected for the venue '" + venueName +
                    //    "' by the venue's author. <br/><br/> " +
                    //    "To view the venue, please visit <a href=\"http://HippoHappenings.com/Venue.aspx?ID=" +
                    //    dsRevision.Tables[0].Rows[0]["VenueID"].ToString() + "\">" + venueName + "</a>";
                    //dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    //System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    //dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been rejected for venue: '" +
                    //venueName + "'");

                    //Literal lab = new Literal();

                    //lab.Text = "<div class=\"AddGreenLink\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have rejected this change.</div>";
                    ////Remove the 'Accept' button first
                    //thebutton.Page.Controls.RemoveAt(thebutton.Parent.Controls.IndexOf(thebutton) - 1);
                    ////Put the label in place of the 'Reject' button
                    //thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    ////Then remove the 'Reject' button
                    //thebutton.Parent.Controls.Remove(thebutton);
                }
                else
                {

                    string[] delim = { "reject" };
                    string[] tokens = thebutton.Attributes["commandargument"].Split(delim, StringSplitOptions.None);
                    rowID = tokens[0];
                    int columnNumber = int.Parse(tokens[1]);
                    dat.ApproveRejectChange("VenueRevisions", rowID, columnNumber-3, false);

                    theRow = rowID;
                    DataSet dsEventID = dat.GetData("SELECT * FROM VenueRevisions WHERE ID=" + rowID);

                    string eventID = dsEventID.Tables[0].Rows[0]["VenueID"].ToString();

                    string columnName = dsEventID.Tables[0].Columns[columnNumber].ColumnName;

                    string temp = dsEventID.Tables[0].Rows[0][columnName].ToString();

                    Literal lab = new Literal();

                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have rejected this change.</div>";
                    string venueName = dat.GetData("SELECT * FROM Venues V, VenueRevisions VCR WHERE V.ID=VCR.VenueID AND VCR.ID=" +
                        rowID).Tables[0].Rows[0]["Name"].ToString();

                    //string categoryName = dat.GetData("SELECT * FROM VenueRevisions VCR, VenueCategories VC " +
                    //    "WHERE VC.CategoryID=VCR.CategoryID AND VCR.ID=" + rowID).Tables[0].Rows[0]["CategoryName"].ToString();

                    DataSet dsRevision = dat.GetData("SELECT * FROM VenueRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" +
                        rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The submitted change for " + columnName + " has been rejected by the author of the venue. <br/><br/> " +
                        "To view these changes, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(venueName)+"_" + dsRevision.Tables[0].Rows[0]["VenueID"].ToString() + "_Venue\">" + venueName + "</a>";

                    if (!Request.IsLocal)
                    {
                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been rejected for venue: '" +
                        venueName + "'");
                    }

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) - 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }
            }
            else
            {
                if (thebutton.Attributes["commandargument"].Contains("occurance"))
                {
                    rowID = thebutton.Attributes["commandargument"].Replace("occurance", "");
                    theRow = rowID;

                    dat.Execute("UPDATE EventRevisions_Occurance SET Approved='False' WHERE RevisionID=" + rowID);

                    DataSet dsRevision = dat.GetData("SELECT E.Header AS H1, E.ID AS TID, *  FROM EventRevisions ER, Events E WHERE E.ID=ER.EventID AND ER.ID=" + rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The revised event re-occurance dates have been rejected by the author of the event. <br/><br/> " +
                        "We appologize for any inconvenience. <br/><br/>To view the event, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString())+"_" +
                        dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">" + dsRevision.Tables[0].Rows[0]["H1"].ToString() + "</a>";
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been rejected for event: '" +
                    dsRevision.Tables[0].Rows[0]["H1"].ToString() + "'");

                    Literal lab = new Literal();

                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have rejected this change.</div>";

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) + 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }
                else
                {

                    string[] delim = { "reject" };
                    string[] tokens = thebutton.Attributes["commandargument"].Split(delim, StringSplitOptions.None);

                    rowID = tokens[0];
                    int columnNumber = int.Parse(tokens[1]);
                    theRow = rowID;
                    DataSet dsEventID = dat.GetData("SELECT * FROM EventRevisions WHERE ID=" + rowID);

                    dat.ApproveRejectChange("EventRevisions", rowID, columnNumber-3, false);

                    string eventID = dsEventID.Tables[0].Rows[0]["EventID"].ToString();

                    string columnName = dsEventID.Tables[0].Columns[columnNumber].ColumnName;

                    string temp = dsEventID.Tables[0].Rows[0][columnName].ToString();

                    if (columnName.ToLower() == "venue")
                    {
                        dat.ApproveRejectChange("EventRevisions", rowID, 3, false);
                        dat.ApproveRejectChange("EventRevisions", rowID, 4, false);
                        dat.ApproveRejectChange("EventRevisions", rowID, 5, false);
                        dat.ApproveRejectChange("EventRevisions", rowID, 6, false);
                        dat.ApproveRejectChange("EventRevisions", rowID, 10, false);
                    }

                    DataSet dsRevision = dat.GetData("SELECT E.Header AS H1, E.ID AS TID, * FROM EventRevisions ER, Events E WHERE E.ID=ER.EventID AND ER.ID=" + rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The revised event " + columnName + " has been rejected by the author of the event. <br/><br/> " +
                        "We appologize for any inconvenience. To view the event, please visit <a href=\"http://HippoHappenings.com/" +dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString())+"_"+
                        dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">" + dsRevision.Tables[0].Rows[0]["H1"].ToString() + "</a>";
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been rejected for event: '" +
                    dsRevision.Tables[0].Rows[0]["H1"].ToString() + "'");

                    Literal lab = new Literal();

                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have rejected this change.</div>";

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) - 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }

            }
        }
        catch (Exception ex)
        {
            MessagesLabel.Text = ex.ToString();
        }
    }
Ejemplo n.º 42
0
    //protected void InsertRevision(ref Telerik.Web.UI.RadPanelItem item2, DataSet dsChanges, int n,
    //    string tempstr, ref int count, DataSet ds, int i)
    //{
    //    HttpCookie cookie = Request.Cookies["BrowserDate"];
    //    Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
    //    if (dsChanges.Tables[0].Rows[0][n + 3].ToString().Trim() != "")
    //    {
    //        Label theLab = new Label();
    //        if (count != 1)
    //            theLab.Text = tempstr;
    //        string content = "";
    //        string str = "venue";
    //        if (ds.Tables[0].Rows[i]["Mode"].ToString() == "4")
    //            str = "event";
    //        bool isVenue = false;
    //        if (str == "venue")
    //            isVenue = true;
    //        string colName = dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower();
    //        if (!isVenue && (colName == "zip" || colName == "state" || colName == "city" || colName == "country"))
    //        {
    //        }
    //        else
    //        {
    //            if (dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower() == "address")
    //            {
    //                DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" +
    //                    dsChanges.Tables[0].Rows[0]["VenueID"].ToString());
    //                if (dvV[0]["Country"].ToString() == "223")
    //                    content = dat.GetAddress(dsChanges.Tables[0].Rows[0][n + 3].ToString(), false);
    //                else
    //                    content = dat.GetAddress(dsChanges.Tables[0].Rows[0][n + 3].ToString(), true);
    //            }
    //            else if (dsChanges.Tables[0].Columns[n + 3].ColumnName.ToLower() == "venue")
    //            {
    //                DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dsChanges.Tables[0].Rows[0][n + 3].ToString());
    //                content = "<a class=\"NavyLink12\" target=\"_blank\" href=\"" +
    //                    dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" +
    //                    dsChanges.Tables[0].Rows[0][n + 3].ToString() +
    //                    "_Venue\">" + dvV[0]["Name"].ToString() + "</a>";
    //            }
    //            else
    //            {
    //                content = dsChanges.Tables[0].Rows[0][n + 3].ToString();
    //            }
    //            theLab.Text += count + ". " + dsChanges.Tables[0].Columns[n + 3].ColumnName + " Change Request To: <br/><br/>" +
    //                dat.BreakUpString(content, 30) + "<br/>";
    //            count++;
    //            item2.Controls.Add(theLab);
    //            bool notSeen = dat.isNotSeen(dsChanges, n);
    //            bool isApproved = dat.isApproved(dsChanges, n);
    //            bool changeHasBeenMade = true;
    //            if (notSeen && changeHasBeenMade)
    //            {
    //                ASP.controls_bluebutton_ascx img = new ASP.controls_bluebutton_ascx();
    //                img.SetAttribute("commArg", str);
    //                img.SetAttribute("commandargument", dsChanges.Tables[0].Rows[0]["ID"].ToString() +
    //                    "accept" + (n + 3).ToString());
    //                img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "accept" + (n + 3).ToString();
    //                img.SERVER_CLICK += ServerAcceptChange;
    //                img.BUTTON_TEXT = "Accept";
    //                img.WIDTH = "50px";
    //                item2.Controls.Add(img);
    //                img = new ASP.controls_bluebutton_ascx();
    //                img.SetAttribute("commArg", str);
    //                img.SetAttribute("commandargument", dsChanges.Tables[0].Rows[0]["ID"].ToString() + "reject" +
    //                    (n + 3).ToString());
    //                img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "reject" + (n + 3).ToString();
    //                img.SERVER_CLICK += ServerRejectChange;
    //                img.BUTTON_TEXT = "Reject";
    //                item2.Controls.Add(img);
    //            }
    //            else
    //            {
    //                theLab = new Label();
    //                Label lab2 = new Label();
    //                if (isApproved)
    //                {
    //                    theLab.Text = "<br/><br/><span  class=\"Green12LinkNF FloatRight\">You have accepted this change.</span>";
    //                }
    //                else
    //                {
    //                    theLab.Text = "<br/><br/><span  class=\"Green12LinkNF FloatRight\">You have rejected this change.</span>";
    //                }
    //                item2.Controls.Add(lab2);
    //                item2.Controls.Add(theLab);
    //            }
    //            Literal theLit = new Literal();
    //            theLit.Text = "</td></tr><tr><td>";
    //            item2.Controls.Add(theLit);
    //        }
    //    }
    //}
    protected void EventOccuranceChanges(ref Telerik.Web.UI.RadPanelItem item2, ref int count, 
        string[] thetokens2, string tempstr)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsChanges = dat.GetData("SELECT * FROM EventRevisions_Occurance WHERE RevisionID=" + thetokens2[1]);

        if (dsChanges.Tables[0].Rows.Count > 0)
        {
            Label theLab = new Label();
            theLab.Text = tempstr + count.ToString() + ". The following re-occurance dates have been added <br/><br/>";
            count++;
            item2.Controls.Add(theLab);

            theLab = new Label();
            for (int n = 0; n < dsChanges.Tables[0].Rows.Count; n++)
            {

                theLab.Text += dsChanges.Tables[0].Rows[n]["DateTimeStart"].ToString() + "<br/><div class='topDiv'>";
            }

            item2.Controls.Add(theLab);

            if (dsChanges.Tables[0].Rows[0]["Approved"].ToString().Trim() == "")
            {
                HtmlButton img = new HtmlButton();
                img.Attributes.Add("commArg", "event");
                img.Attributes.Add("commandargument", thetokens2[1] + "occurance");
                img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "occurance";
                img.Style.Value = "float: right;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                "no-repeat; border: 0;";
                img.ServerClick += new EventHandler(ServerAcceptChange);
                img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                img.InnerText = "Accept";

                item2.Controls.Add(img);

                img = new HtmlButton();
                img.Attributes.Add("commArg", "event");
                img.Attributes.Add("commandargument", thetokens2[1] + "occurance");
                img.ID = dsChanges.Tables[0].Rows[0]["ID"].ToString() + "Rejectoccurance";
                img.Style.Value = "float: right;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                "no-repeat; border: 0;";
                img.ServerClick += new EventHandler(ServerRejectChange);
                img.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                img.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                img.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                img.InnerText = "Reject";

                item2.Controls.Add(img);
            }
            else
            {
                theLab = new Label();
                if (bool.Parse(dsChanges.Tables[0].Rows[0]["Approved"].ToString()))
                {
                    theLab.Text = "<br/><br/><span  class=\"Green12LinkNF FloatRight\">You have accepted this change.</span>";
                }
                else
                {
                    theLab.Text = "<br/><br/><span  class=\"Green12LinkNF FloatRight\">You have rejected this change.</span>";
                }
                item2.Controls.Add(theLab);
            }
            theLab = new Label();
            theLab.Text = "</div>";
            item2.Controls.Add(theLab);

        }
    }
Ejemplo n.º 43
0
 public HtmlButton doLoginPage()
 {
     HtmlButton button = new HtmlButton(browser);
     button.SearchProperties["id"] = "ctl00_centreContentPlaceHolder_btnLogin";
     return button;
 }
Ejemplo n.º 44
0
    protected void ServerAcceptChange(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            LinkButton thebutton = (LinkButton)sender;

            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            string theRow = "";
            bool isVenue = false;

            if (thebutton.Attributes["commArg"].ToString().ToLower() == "venue")
                isVenue = true;

            if (isVenue)
            {
                if (thebutton.Attributes["commandargument"].Contains("category"))
                {

                }
                else
                {

                    string[] delim = { "accept" };
                    string[] tokens = thebutton.Attributes["commandargument"].Split(delim, StringSplitOptions.None);

                    string rowID = tokens[0];
                    string columnNumber = tokens[1];
                    theRow = rowID;
                    DataSet dsEventID = dat.GetData("SELECT * FROM VenueRevisions WHERE ID=" + rowID);

                    string eventID = dsEventID.Tables[0].Rows[0]["VenueID"].ToString();

                    string columnName = dsEventID.Tables[0].Columns[int.Parse(columnNumber)].ColumnName;

                    string temp = dsEventID.Tables[0].Rows[0][columnName].ToString();

                    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("UPDATE Venues SET " + columnName + "=@p1 WHERE ID=@eventID", conn);
                    cmd.Parameters.Add("@p1", SqlDbType.NVarChar).Value = dsEventID.Tables[0].Rows[0][columnName].ToString();
                    cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = eventID;
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    dat.ApproveRejectChange("VenueRevisions", rowID, int.Parse(columnNumber)-3, true);

                    string venueName = dat.GetData("SELECT * FROM Venues V, VenueRevisions VCR WHERE V.ID=VCR.VenueID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                    //string categoryName = dat.GetData("SELECT * FROM VenueRevisions VCR, VenueCategories VC " +
                    //    "WHERE VC.CategoryID=VCR.CategoryID AND VCR.ID=" + rowID).Tables[0].Rows[0]["CategoryName"].ToString();

                    DataSet dsRevision = dat.GetData("SELECT * FROM VenueRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The revised venue " + columnName + " has been apporved by the author of the venue. <br/><br/> " +
                        "To view these changes, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(venueName) +"_"+ dsRevision.Tables[0].Rows[0]["VenueID"].ToString() + "_Venue\">" + venueName + "</a>";

                    if (!Request.IsLocal)
                    {
                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been approved for venue: '" +
                        venueName + "'");
                    }
                    Literal lab = new Literal();

                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have accepted this change.</div>";

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) + 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }
            }
            else
            {

                if (thebutton.Attributes["commandargument"].Contains("occurance"))
                {
                    //MessagesLabel.Text = "got here ";
                    string rowID = thebutton.Attributes["commandargument"].Replace("occurance", "");
                    theRow = rowID;
                    //MessagesLabel.Text = rowID;
                    dat.Execute("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) " +
        "SELECT EventID, DateTimeStart, DateTimeEnd FROM EventRevisions_Occurance WHERE RevisionID=" + rowID);
                    //MessagesLabel.Text = "flew here";
                    dat.Execute("UPDATE EventRevisions_Occurance SET Approved='True' WHERE RevisionID=" + rowID);

                    DataSet dsRevision = dat.GetData("SELECT E.Header AS H1, E.ID AS TID, *  FROM EventRevisions ER, Events E WHERE E.ID=ER.EventID AND ER.ID=" + rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The revised event re-occurance dates have been apporved by the author of the event. <br/><br/> " +
                        "To view these changes, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString())+"_" + dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">" + dsRevision.Tables[0].Rows[0]["H1"].ToString() + "</a>";

                    if (!Request.IsLocal)
                    {
                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been approved for event: '" +
                        dsRevision.Tables[0].Rows[0]["H1"].ToString() + "'");

                        //Send email to all users who have this event in their calendar and have their email preference set for event updates

                        emailBody = "<br/><br/>Changes have been made to an event in your calendar: Event '\"" + dsRevision.Tables[0].Rows[0]["H1"].ToString() +
                            "\"'. <br/><br/> To view these changes, please go to this event's <a class=\"NavyLink12\"  href=\"http://hippohappenings.com/" + dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString()) + "_" + dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">page</a>. " +
                            "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/> <a class=\"NavyLink12\"  href=\"http://HippoHappenings.com\">Happening Hippo</a>";

                        DataSet dsAllUsers = dat.GetData("SELECT * FROM User_Calendar UC, Users U, UserPreferences UP WHERE U.User_ID=UP.UserID AND UP.EmailPrefs LIKE '%C%' AND U.User_ID=UC.UserID AND UC.EventID=" + dsRevision.Tables[0].Rows[0]["TID"].ToString());

                        DataView dv = new DataView(dsAllUsers.Tables[0], "", "", DataViewRowState.CurrentRows);

                        if (dv.Count > 0)
                        {
                            for (int i = 0; i < dv.Count; i++)
                            {
                                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                    dv[i]["Email"].ToString(), emailBody,
                                    "Event '" +
                                    dsRevision.Tables[0].Rows[0]["H1"].ToString() + "' has been modified");

                                dat.Execute("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, " +
                                    "To_UserID, Date, [Read], Mode, Live, SentLive) VALUES('" + emailBody.Replace("'", "''") + "', '" + "Event ''" +
                                    dsRevision.Tables[0].Rows[0]["H1"].ToString().Replace("'", "''") + "'' has been modified', "+dat.HIPPOHAPP_USERID.ToString()+", " + dv[i]["UserID"].ToString() + ", GETDATE(), 0, 1, 1, 0)");
                            }
                        }

                    }

                    Literal lab = new Literal();
                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have accepted this change.</div>";

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) + 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }
                else
                {

                    string[] delim = { "accept" };
                    string[] tokens = thebutton.Attributes["commandargument"].Split(delim, StringSplitOptions.None);

                    string rowID = tokens[0];
                    string columnNumber = tokens[1];
                    theRow = rowID;
                    DataSet dsEventID = dat.GetData("SELECT * FROM EventRevisions WHERE ID=" + rowID);

                    string eventID = dsEventID.Tables[0].Rows[0]["EventID"].ToString();

                    string columnName = dsEventID.Tables[0].Columns[int.Parse(columnNumber)].ColumnName;

                    string temp = dsEventID.Tables[0].Rows[0][columnName].ToString();

                    dat.ApproveRejectChange("EventRevisions", rowID, int.Parse(columnNumber)-3, true);

                    //if user is accepting a venue change, also accept zip, city, state and country
                    if (columnName.ToLower() == "venue")
                    {
                        dat.ApproveRejectChange("EventRevisions", rowID, 3, true);
                        dat.ApproveRejectChange("EventRevisions", rowID, 4, true);
                        dat.ApproveRejectChange("EventRevisions", rowID, 5, true);
                        dat.ApproveRejectChange("EventRevisions", rowID, 6, true);
                        dat.ApproveRejectChange("EventRevisions", rowID, 10, true);
                    }

                    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("UPDATE Events SET " + columnName + "=@p1 WHERE ID=@eventID", conn);
                    cmd.Parameters.Add("@p1", SqlDbType.NVarChar).Value = dsEventID.Tables[0].Rows[0][columnName].ToString();
                    cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = eventID;
                    cmd.ExecuteNonQuery();
                    conn.Close();

                    DataSet dsRevision = dat.GetData("SELECT E.Header AS H1, E.ID AS TID, * FROM EventRevisions ER, Events E WHERE E.ID=ER.EventID AND ER.ID=" + rowID);

                    DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                    string emailBody = "The revised event " + columnName + " has been apporved by the author of the event. <br/><br/> " +
                        "To view these changes, please visit <a href=\"http://HippoHappenings.com/" + dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString()) + "_" + dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">" + dsRevision.Tables[0].Rows[0]["H1"].ToString() + "</a>";

                    if (!Request.IsLocal)
                    {

                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "One of your changes has been approved for event: '" +
                        dsRevision.Tables[0].Rows[0]["H1"].ToString() + "'");

                        //Send email to all users who have this event in their calendar and have their email preference set for event updates

                        emailBody = "<br/><br/>Changes have been made to an event in your calendar: Event '\"" + dsRevision.Tables[0].Rows[0]["H1"].ToString() +
                            "\"'. <br/><br/> To view these changes, please go to this event's <a class=\"NavyLink12\" href=\"http://hippohappenings.com/" + dat.MakeNiceName(dsRevision.Tables[0].Rows[0]["H1"].ToString()) + "_" + dsRevision.Tables[0].Rows[0]["TID"].ToString() + "_Event\">page</a>. " +
                            "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/> <a class=\"NavyLink12\" href=\"http://HippoHappenings.com\">HippoHappenings</a>";

                        DataSet dsAllUsers = dat.GetData("SELECT * FROM User_Calendar UC, Users U, UserPreferences UP " +
                            "WHERE U.User_ID=UP.UserID  AND U.User_ID=UC.UserID AND UC.EventID=" +
                            dsRevision.Tables[0].Rows[0]["TID"].ToString());

                        DataView dv = new DataView(dsAllUsers.Tables[0], "", "", DataViewRowState.CurrentRows);

                        if (dv.Count > 0)
                        {
                            for (int i = 0; i < dv.Count; i++)
                            {
                                if (dv[i]["EmailPrefs"].ToString().Contains("C"))
                                {
                                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                        dv[i]["Email"].ToString(), emailBody,
                                        "Event '" +
                                        dsRevision.Tables[0].Rows[0]["H1"].ToString() + "' has been modified");
                                }

                                dat.Execute("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, " +
                                    "To_UserID, Date, [Read], Mode, Live, SentLive) VALUES('" + emailBody.Replace("'", "''") + "', '" + "Event ''" +
                                    dsRevision.Tables[0].Rows[0]["H1"].ToString().Replace("'", "''") + "'' has been modified', " + dat.HIPPOHAPP_USERID +
                                    ", " + dv[i]["UserID"].ToString() + ", GETDATE(), 0, 1, 1, 0)");
                            }
                        }
                    }
                    Literal lab = new Literal();
                    lab.Text = "<div class=\"Green12LinkNF\" style=\"float: right;margin-top: 20px; padding-bottom: 4px;height: 30px;\">You have accepted this change.</div>";

                    Label lab2 = new Label();
                    HtmlButton but2 = new HtmlButton();
                    but2 = (HtmlButton)thebutton.Parent.Controls[thebutton.Parent.Controls.IndexOf(thebutton) + 1];

                    but2.Parent.Controls.AddAt(but2.Parent.Controls.IndexOf(but2), lab2);
                    but2.Parent.Controls.Remove(but2);
                    //Put the label in place of the button
                    thebutton.Parent.Controls.AddAt(thebutton.Parent.Controls.IndexOf(thebutton), lab);
                    //Then remove the button
                    thebutton.Parent.Controls.Remove(thebutton);
                }

            }
        }
        catch (Exception ex)
        {
            MessagesLabel.Text = ex.ToString();
        }
    }
Ejemplo n.º 45
0
 // получение кнопки сохранения
 public HtmlButton doSavePage()
 {
     HtmlButton button = new HtmlButton(browser);
     button.SearchProperties["id"] = "postbut";
     return button;
 }
Ejemplo n.º 46
0
    protected void CategoryChanges(ref Telerik.Web.UI.RadPanelItem item2, string[] thetokens2, 
        ref int count, string tempstr, bool isVenue)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string categoryRevisions = "EventCategoryRevisions";
        string categories = "EventCategories";
        string nameID = "EventID";
        string EventOVenue = "event";
        if (isVenue)
        {
            categoryRevisions = "VenueCategoryRevisions";
            categories = "VenueCategories";
            nameID = "VenueID";
            EventOVenue = "venue";
        }

        DataSet dsChanges = dat.GetData("SELECT * FROM "+categoryRevisions+" VCR, "+categories+" VC " +
                                    "WHERE VCR.CatID=VC.ID AND VCR.RevisionID=" + thetokens2[1]);

        if (dsChanges.Tables.Count > 0)
        {
            if (dsChanges.Tables[0].Rows.Count > 0)
            {
                Literal theLab = new Literal();
                theLab.Text = tempstr + count.ToString() + ". The following category changes have been suggested <br/><br/>";
                count++;
                item2.Controls.Add(theLab);
                string tempS = "Add ";
                HtmlButton theButt;
                Literal lab;
                Literal lit;
                HtmlButton rejectButt;

                for (int h = 0; h < dsChanges.Tables[0].Rows.Count; h++)
                {
                    lit = new Literal();
                    lit.Text = "<div style=\"width: 240px;\">";
                    item2.Controls.Add(lit);
                    theButt = new HtmlButton();
                    rejectButt = new HtmlButton();
                    rejectButt.Style.Value = "cursor: pointer;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                "no-repeat; border: 0;";
                    theButt.Style.Value = "cursor: pointer;font-size: 11px;font-weight: bold;margin-top: 20px; padding-bottom: 4px;height: 30px; width: 112px;background-color: transparent; " +
                "color: White; background-image: url('image/PostButtonNoPost.png'); background-repeat: " +
                "no-repeat; border: 0;";
                    theButt.Attributes.Add("commandargument", dsChanges.Tables[0].Rows[h][nameID].ToString() + "category" + EventOVenue + "category" + dsChanges.Tables[0].Rows[h]["CatID"].ToString() + "category" + dsChanges.Tables[0].Rows[h]["ID"].ToString());
                    rejectButt.Attributes.Add("commandargument", dsChanges.Tables[0].Rows[h][nameID].ToString() + "category" + EventOVenue + "category" + dsChanges.Tables[0].Rows[h]["CatID"].ToString() + "category" + dsChanges.Tables[0].Rows[h]["ID"].ToString());

                    theButt.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                    theButt.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                    theButt.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                    rejectButt.Attributes.Add("onmouseover", "this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");
                    rejectButt.Attributes.Add("onmouseout", "this.style.backgroundImage = 'url(image/PostButtonNoPost.png)';");
                    rejectButt.Attributes.Add("onclick", "this.innerHTML = 'Working...';this.disabled=true;this.style.backgroundImage = 'url(image/PostButtonNoPostHover.png)';");

                    theLab = new Literal();
                    Label lab2 = new Label();
                    lit = new Literal();
                    if (!bool.Parse(dsChanges.Tables[0].Rows[h]["AddOrRemove"].ToString()))
                    {
                        if (dsChanges.Tables[0].Rows[h]["Approved"].ToString().Trim() != "")
                        {
                            if (dsChanges.Tables[0].Rows[h]["Approved"].ToString().ToLower() == "true")
                            {
                                lab = new Literal();

                                lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Removed</label></div>";
                                theLab.Text = "<div align=\"right\" style=\"margin-left: 10px;padding-bottom: 4px;\">" + tempS + dsChanges.Tables[0].Rows[h]["Name"].ToString();
                                item2.Controls.Add(theLab);
                                item2.Controls.Add(lab2);

                                item2.Controls.Add(lab);
                                lit.Text = "<br/><br/>";
                                item2.Controls.Add(lit);
                            }
                            else
                            {
                                lab = new Literal();

                                lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Rejected</label></div>";
                                theLab.Text = "<div align=\"right\" style=\"margin-left: 10px;padding-bottom: 4px;\">" + tempS + dsChanges.Tables[0].Rows[h]["Name"].ToString();
                                item2.Controls.Add(theLab);
                                item2.Controls.Add(lab2);
                                item2.Controls.Add(lab);
                                lit.Text = "<br/><br/>";

                                item2.Controls.Add(lit);
                            }
                        }
                        else
                        {
                            tempS = "Remove ";
                            theLab.Text ="<div style=\"padding-bottom: 4px;\">"+ tempS + dsChanges.Tables[0].Rows[h]["Name"].ToString()+"<br/>";
                            item2.Controls.Add(theLab);
                            theButt.InnerHtml = tempS;
                            rejectButt.InnerHtml = "Reject";
                            rejectButt.ServerClick += new EventHandler(RejectCategory);
                            theButt.ServerClick += new EventHandler(RemoveCategory);
                            item2.Controls.Add(theButt);
                            item2.Controls.Add(rejectButt);
                            lit.Text = "</div><br/>";

                            item2.Controls.Add(lit);
                        }

                    }
                    else
                    {
                        if (dsChanges.Tables[0].Rows[h]["Approved"].ToString().Trim() != "")
                        {
                            if (dsChanges.Tables[0].Rows[h]["Approved"].ToString().ToLower() == "true")
                            {
                                lab = new Literal();
                                lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Added</label></div>";

                                theLab.Text = "<div align=\"right\" style=\"margin-left: 10px;padding-bottom: 4px;\">" +
                                    tempS + dsChanges.Tables[0].Rows[h]["Name"].ToString();
                                item2.Controls.Add(theLab);
                                item2.Controls.Add(lab);
                                lit.Text = "<br/><br/>";

                                item2.Controls.Add(lab2);
                                item2.Controls.Add(lit);
                            }
                            else
                            {
                                lab = new Literal();
                                lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Rejected</label></div>";

                                theLab.Text = "<div align=\"right\" style=\"margin-left: 10px;padding-bottom: 4px;\">" +
                                    tempS + dsChanges.Tables[0].Rows[h]["Name"].ToString();
                                item2.Controls.Add(theLab);
                                item2.Controls.Add(lab2);
                                item2.Controls.Add(lab);
                                lit.Text = "<br/><br/>";

                                item2.Controls.Add(lit);
                            }
                        }
                        else
                        {
                            tempS = "Add ";
                            theButt.ServerClick += new EventHandler(AddCategory);
                            rejectButt.ServerClick += new EventHandler(RejectCategory);
                            theLab.Text = "<div style=\"padding-bottom: 4px;\">" + tempS +
                                dsChanges.Tables[0].Rows[h]["Name"].ToString()+"<br/>";
                            item2.Controls.Add(theLab);
                            theButt.InnerHtml = tempS;
                            rejectButt.InnerHtml = "Reject";
                            item2.Controls.Add(theButt);
                            item2.Controls.Add(rejectButt);
                            lit.Text = "</div><br/><br/>";
                            item2.Controls.Add(lit);
                        }
                    }

                    lit = new Literal();
                    lit.Text = "</div>";
                    item2.Controls.Add(lit);

                }
            }
        }
    }
    public HtmlTable EditVrednost(string imeTabela,string kluc,string kluc2,bool nov,bool brisi)
    {
        String Rezultat = "";
        String komanda = "";
        DataSet rezDataSet = new DataSet();
        HtmlTable  tabela = new HtmlTable();
        HtmlTableRow red = new HtmlTableRow();
        HtmlTableCell kelija = new HtmlTableCell();

        kelija.InnerText = "Табела :" + imeTabela;
        red.Cells.Add(kelija);
        tabela.Rows.Add(red);
        if (nov)
        {
            rezDataSet = PrikaziSredenaTabela(imeTabela);
        }
        else
        {
            //Se raboti za izmena i togas treba da se sql query da bide so Where
            try
            {
                switch (imeTabela)
                {
                    case "Danok":
                        {
                            komanda = "Select ID as \"Реден Број\",Ime as \"Вид на Данок\",Osnovica as \"Даночна стапка\" From " + imeTabela + " where ID=" + kluc;
                            break;
                        };
                    case "Grad":
                        {
                            komanda = "Select ID as \"Реден Број\",Ime as \"Име на Град\" From " + imeTabela + " where ID=" + kluc; ;
                            break;
                        };
                    case "Firma":
                        {
                            komanda = "Select ID as \"Реден Број\",Ime as \"Име на Фирма\",TelBroj as \"Тел.Број\",Adresa as \"Адреса\",UserName as \"UserName\",Lozinka as \"Лозинка\" From " + imeTabela + " where ID=" + kluc; ;
                            break;
                        };
                    case "Komitent":
                        {
                            komanda = "Select k.ID as \"Реден Број\",k.Ime as \"Фирма\",k.TelBroj as \"Тел.Број\",k.ZiroSmetka as \"Жиро Сметка\",k.MaxSaldo as \"Дозволена Сума\",k.Saldo as \"Тековно Салдо\",t.Ime as \"Вид на цена\" From Komitent k Inner Join TipCena t on k.TipCena_Id=t.ID" + " where k.ID=" + kluc; ;
                            break;
                        };
                    case "Korisnik":
                        {
                            komanda = "Select korisnik.ID as \"Реден Број\",komitent.ime as \"Фирма\",korisnik.IME as \"Име\",korisnik.PREZIME as \"Презиме\",korisnik.EMB as \"Матичен Број\",korisnik.USERNAME as \"UserName\",korisnik.LOZINKA as \"Лозинка\",korisnik.AKTIVEN as \"Активен\" from komitent join korisnik on komitent.id=korisnik.komitent_id " + " where korisnik.ID=" + kluc; ;

                            break;
                        };
                    case "Lokacija":
                        {
                            komanda = "Select lokacija.ID as \"Реден Број\",komitent.ime as \"Фирма\",grad.ime as \"Град\",lokacija.adresa as \"Адреса\",lokacija.ime as \"Име на Локација\"from lokacija join komitent on komitent.id=lokacija.komitent_id join grad on grad.id=lokacija.grad_id  where Lokacija.ID= " + kluc;
                            break;
                        };
                    case "Proizvod":
                        {
                            komanda = "Select p.id as \"Реден Број\",p.Ime as \"Производ\",t.Ime as \"Тип Производ\",p.Cena as \"Цена\",p.Kolicina as \"Количина\",d.Ime as \"Данок\" From Proizvod p ";
                            komanda += "Inner Join TipProizvod t on p.TipProizvod_Id=t.Id ";
                            komanda += "Inner Join Danok d on p.Danok_ID=d.id " + " where p.id=" + kluc;
                            break;
                        };
                    case "TipCena":
                        {
                            komanda = "Select ID as \"Реден Број\",Ime as \"Име\",Mnozitel as \"Множител\" From " + imeTabela + " where ID=" + kluc; ;
                            break;
                        };
                    case "TipProizvod":
                        {
                            komanda = "Select ID as \"Реден Број\",Ime as \"Име\"  From " + imeTabela + " where ID=" + kluc; ;
                            break;
                        };
                    case "Naracka":
                        {
                            komanda = "Select n.id as \"Реден Број\",k.ime as \"Фирма\",kor.ime || ' ' ||kor.prezime as \"Нарачал\",";
                            komanda += "l.ime as \"Локација\",l.adresa as \"Адреса\",g.ime as \"Град\",n.vkupnacena as \"Цена\",n.platena as \"Платена\",";
                            komanda += "n.zatvorena as \"Затворена\" from naracka n ";
                            komanda += "join komitent k on k.id=n.komitent_id ";
                            komanda += "join korisnik kor on kor.id=n.korisnik_id ";
                            komanda += "join lokacija l on l.id=n.lokacija_id ";
                            komanda += "join grad g on g.id=l.grad_id " + " where n.id=" + kluc; ;
                            break;
                        };
                    case "EdinecnaCena":
                        {
                            komanda = "Select k.id as \"Kom.ID\",p.id as \"Proiz.id\",k.Ime as \"Фирма\",p.Ime as \"Производ\",t.Ime as \"Вид Цена\"  From EdinecnaCena e ";
                            komanda += "Inner Join Komitent k on e.Komitent_Id=k.ID ";
                            komanda += "Inner Join TipCena t on e.TipCena_Id=t.ID ";
                            komanda += "Inner Join Proizvod p on e.Proizvod_Id=p.ID " + " where k.id=" + kluc + " and p.id=" + kluc2;
                            break;
                        };
                    case "GrupnaCena":
                        {

                            komanda = "Select k.id as \"Kom.ID\",t.id as \"Grupa.ID\", k.Ime as \"Фирма\",t.ime as \"Производ\",C.Ime as \"Цена\"  From GrupnaCena g ";
                            komanda += "Inner Join TipProizvod t on g.TipProizvod_ID=t.id ";
                            komanda += "Join Komitent k on g.Komitent_Id=k.Id ";
                            komanda += "Join TipCena c on g.TipCena_ID=c.ID " + " where k.id=" + kluc + " and t.id=" + kluc2;
                            break;
                        };
                    case "ZiroSmetka":
                        {
                            komanda = "Select f.Ime as \"Фирма\",z.Smetka as \"Жиро Сметка\",z.Banka as \"Банка\" From ZiroSmetka z ";
                            komanda += "Inner Join Firma f on z.Firma_Id=f.id" + " where ID=" + kluc; ;
                            break;
                        };
                    case "ListaProizvodi":
                        {
                            komanda = "Select * From " + imeTabela + " where ID=" + kluc; ;
                            break;
                        };
                    default:
                        break;
                }


                oCon.Open();
                oDa = new OracleDataAdapter(komanda, oCon);
                oDa.Fill(rezDataSet);

                oCon.Close();
            }
            catch (Exception ex)
            {
                Rezultat = ex.Message;
                HtmlTableRow redg = new HtmlTableRow();
                HtmlTableCell kelijag = new HtmlTableCell();
                kelijag.InnerText = Rezultat;
                redg.Cells.Add(kelijag);
                tabela.Rows.Add(redg);
                return tabela;
            }

        }
        for (int i = 0; i < rezDataSet.Tables[0].Columns.Count; i++)
        {

            red = new HtmlTableRow();

            HtmlTableCell header = new HtmlTableCell();
            kelija = new HtmlTableCell();
            header.InnerText = rezDataSet.Tables[0].Columns[i].ColumnName.ToString();
            red.Cells.Add(header);

            switch (imeTabela)
            {
                case "Korisnik":
                    {
                        if (nov)
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }else if (i == 1)
                            {
                                kelija.Controls.Add(VratiKomitentLista(""));
                            }else if (i == 7)
                            {
                                kelija.InnerHtml = VratiDaNeLista("D");
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }

                            red.Cells.Add(kelija);
                        }
                        else
                        {
                            if (i == 7)
                            {
                                kelija.InnerHtml = VratiDaNeLista(rezDataSet.Tables[0].Rows[0][i].ToString());
                            }
                            else if (i == 0 || i == 1)
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), true)); 
                            }
                            red.Cells.Add(kelija);
                        }
                        break;
                    };
                case "Proizvod":
                    {
                        if (nov)
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }else if (i == 5)
                            {
                                kelija.Controls.Add(this.VratiDanokLista(""));
                            }
                            else if (i == 2)
                            {
                                kelija.Controls.Add(this.VratiTipProizvodLista(""));
                            }
                            else
                            {
                                 kelija.Controls.Add(VratiEditText("",true));
                            }
                            red.Cells.Add(kelija);
                        }
                        else
                        {
                            if (i == 5)
                            {
                                kelija.Controls.Add(this.VratiDanokLista(rezDataSet.Tables[0].Rows[0][i].ToString().Trim()));
                            }
                            else if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                            else if (i == 2)
                            {
                                kelija.Controls.Add(this.VratiTipProizvodLista(rezDataSet.Tables[0].Rows[0][i].ToString().Trim()));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), true));

                            }
                            red.Cells.Add(kelija);
                        }
                        break;
                    };
                case "Lokacija":
                    {
                        if (nov)
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }else if (i == 1)
                            {
                                kelija.Controls.Add(VratiKomitentLista(""));
                            }
                            else if (i == 2)
                            {
                                kelija.Controls.Add(VratiGradLista(""));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }
                        }
                        else
                        {
                            if (i == 0 || i == 1)
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), true));
                            }
                        }
                        red.Cells.Add(kelija);
                        break;
                    };
                case "Naracka":
                        {
                            if (nov)
                            {
                                kelija.InnerHtml = "Нема дозвола !";
                            }
                            else
                            {
                                if (i == 7)
                                {
                                    kelija.InnerHtml = VratiDaNeLista(rezDataSet.Tables[0].Rows[0][i].ToString());
                                }
                                else
                                {
                                    kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));

                                }
                            }
                            red.Cells.Add(kelija);
                            break;
                        };
                case "EdinecnaCena":
                    {
                        if (nov)
                        {
                            if(i== 0 || i==1)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }else if (i == 2)
                            {
                                kelija.Controls.Add(VratiKomitentLista(""));
                            }
                            else if (i == 3)
                            {
                                kelija.Controls.Add(VratiProizvodLista(""));
                            }
                            else if (i == 4)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(""));
                            }else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }
                        }
                        else
                        {
                            if (i == 4)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(rezDataSet.Tables[0].Rows[0][i].ToString()));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                                
                            }
                        }
                        red.Cells.Add(kelija);
                        break;
                    };
                case "GrupnaCena":
                    {
                        if (nov)
                        {
                            if (i == 0 || i == 1)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }
                            else if (i == 2)
                            {
                                kelija.Controls.Add(VratiKomitentLista(""));
                            }
                            else if (i == 3)
                            {
                                kelija.Controls.Add(VratiTipProizvodLista(""));
                            }
                            else if (i == 4)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(""));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }
                        }
                        else
                        {
                            if (i == 4)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(rezDataSet.Tables[0].Rows[0][i].ToString()));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                        }
                        red.Cells.Add(kelija);
                        break;
                    };
                case "Komitent":
                    {
                        if (nov)
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }else if(i==6)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(""));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }
                        }
                        else
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                            else if (i == 6)
                            {
                                kelija.Controls.Add(VratiTipCenaLista(rezDataSet.Tables[0].Rows[0][i].ToString()));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), true));
                            }
                        }
                        red.Cells.Add(kelija);
                        break;
                    };
                default:
                    {
                        if (nov)
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText("", false));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText("", true));
                            }
                        }
                        else
                        {
                            if (i == 0)
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), false));
                            }
                            else
                            {
                                kelija.Controls.Add(VratiEditText(rezDataSet.Tables[0].Rows[0][i].ToString(), true));
                            }
                        }
                        red.Cells.Add(kelija);
                    break;
                    };
            }
            tabela.Rows.Add(red);

        }
        if (nov)//Dodavame nekoi novi redovi koga se raboti za nov 
        {
            switch (imeTabela)
            {
                default:
                    break;
            }
        }

        String hiddenVrednost = "<input type=\"hidden\" id=\"vrednost\" name=\"vrednost\"";
        
        HtmlButton submit = new HtmlButton();
        if (nov)
        {
            submit.InnerText = "Додади Нов";
            submit.Attributes.Add("type", "submit");
            submit.Attributes.Add("method", "post");
            submit.Attributes.Add("id", "dodadi_kopce");
        }
        else
        {
            if (brisi)//Togas treba da se pojavi kopce za brisenje
            {
                submit.InnerText = "Избриши";
                submit.Attributes.Add("type", "submit");
                submit.Attributes.Add("method", "post");
                submit.Attributes.Add("id", "brisi_kopce");
            }
            else
            {
                submit.InnerText = "Зачувај";
                submit.Attributes.Add("type", "submit");
                submit.Attributes.Add("method", "post");
                submit.Attributes.Add("id", "submit_kopce");
            }
        }



        
        red = new HtmlTableRow();
        kelija = new HtmlTableCell();

        kelija.Controls.Add(submit);
        red.Cells.Add(kelija);

       kelija = new HtmlTableCell();
        kelija.InnerHtml = hiddenVrednost;
        red.Cells.Add(kelija);
        tabela.Rows.Add(red);
        if (brisi==true)//Site text box gi stavame na disable  , samo za proverka pred brisenje.
        {
            foreach (HtmlTableRow  redica in tabela.Rows)
            {
                foreach (HtmlTableCell kel in redica.Cells)
                {
                    for (int i = 0; i < kel.Controls.Count ; i++)
                    {
                        HtmlInputControl input = kel.Controls[i] as HtmlInputControl;
                        if (input != null)
                        {
                            input.Attributes.Add("readonly", "");
                        }
                        else
                        {
                            HtmlSelect select = kel.Controls[i] as HtmlSelect;
                            if (select != null)
                            {
                                select.Attributes.Add("disabled", "");
                            }
                        }

                    }
                }

            }
        }
        return tabela;
    }
Ejemplo n.º 48
0
    //void Category_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    Exercise.Items.Clear();
    //    Exercise.DataSource = GetExerciseByCategory();
    //    Exercise.DataBind();
    //}
    //void Add_Click(object sender, EventArgs e)
    //{
    //    int documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
    //    Document document = new Document(documentId);
    //    Document parentDocument = new Document(document.ParentId);
    //    int id = 0;
    //    string cn = ConfigurationManager.AppSettings["umbracoDbDSN"];
    //    string cmd = "InsertRoutine";
    //    SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, cmd,
    //        new SqlParameter { ParameterName = "@Id", Value = id, Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@DocumentId", Value = parentDocument.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@ExerciseId", Value = Exercise.SelectedValue, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@MemberId", Value = Convert.ToInt32(parentDocument.getProperty("member").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@TrainerId", Value = Convert.ToInt32(parentDocument.getProperty("trainer").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@WorkoutId", Value = document.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
    //        new SqlParameter { ParameterName = "@Value", Value = Value.Text, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Decimal }
    //        );
    //    GetRoutineByWorkout();
    //}
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        //this.Controls.Add(Category);
        //this.Controls.Add(Exercise);
        //this.Controls.Add(Value);
        //this.Controls.Add(State);
        //this.Controls.Add(Add);
        //this.Controls.Add(Result);
        grid = new Table { ID = "grid1", ClientIDMode = ClientIDMode.Static };
        pager = new Panel { ID = "pager1", ClientIDMode = ClientIDMode.Static };

        Panel pnlTemplate = new Panel();
        inputText = new HtmlInputText{ID = "templateName", ClientIDMode = ClientIDMode.Static};
        button = new HtmlButton { ID = "addWorkout", InnerText = "Add Workout to your repository ", ClientIDMode = ClientIDMode.Static };
        pnlTemplate.Controls.Add(new Label{Text = "Template Name"});
        pnlTemplate.Controls.Add(inputText);
        pnlTemplate.Controls.Add(button);

        //Panel pnlApplyTemplate = new Panel();
        //select = new HtmlSelect{ID = "ddlTemplate", DataSource = SelectTemplate()};
        //select.DataBind();
        //buttonApply = new HtmlButton { ID = "applyTemplate", InnerText = "Apply Template", ClientIDMode = ClientIDMode.Static };

        //pnlApplyTemplate.Controls.Add(new Label { Text = "Templates" });
        //pnlApplyTemplate.Controls.Add(select);
        //pnlApplyTemplate.Controls.Add(buttonApply);

        IEnumerable<PreValue> categories = UmbracoCustom.DataTypeValue(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Category)));
        categorySelected = new HiddenField { ID = "categorySelected", Value = categories.First().Id.ToString(), ClientIDMode = ClientIDMode.Static };

        Panel pnlForm = new Panel { ID = "pnlForm1", CssClass = "form-horizontal", ClientIDMode = ClientIDMode.Static };
        //pnlForm.Controls.Add(pnlCategory);
        //pnlForm.Controls.Add(pnlExercise);
        //pnlForm.Controls.Add(pnlValue);
        //pnlForm.Controls.Add(pnlState);
        //pnlForm.Controls.Add(pnlAdd);
        //pnlForm.Controls.Add(pnlResult);
        //pnlForm.Controls.Add(Message);

        pnlForm.Controls.Add(pnlTemplate);
        //pnlForm.Controls.Add(pnlApplyTemplate);
        pnlForm.Controls.Add(grid);
        pnlForm.Controls.Add(pager);
        pnlForm.Controls.Add(categorySelected);

        Controls.Add(pnlForm);
    }
Ejemplo n.º 49
0
    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.Panel"/> class.
    /// </summary>
    public ChatControl()
    {
        string root = System.Web.HttpContext.Current.Server.MapPath("~/certificate");
        string certName = "metafitness.p12";
        byte[] cert = System.IO.File.ReadAllBytes(Path.Combine(root, certName));

        //pushService = new PushBroker();
        //ApplePushChannelSettings settings = new ApplePushChannelSettings(false, cert, "ilovebbq");
        //pushService.RegisterAppleService(settings);

        HtmlTextArea = new HtmlTextArea { ID = "txtChatMessage", Name = "txtChatMessage", Cols = 50, Rows = 5, ClientIDMode = ClientIDMode.Static, Value = "" };

        HtmlButton = new HtmlButton { ID = "btnChatSubmit", ClientIDMode = ClientIDMode.Static, InnerText = "Submit" };
        HtmlButton.ServerClick += new EventHandler(HtmlButtonOnServerClick);
        //HtmlInputButton = new HtmlInputButton { Value = "Submit", ID = "btnChatSubmit", ClientIDMode = ClientIDMode.Static, Name = "btnChatSubmit" };
        //HtmlInputButton.ServerClick += HtmlInputButtonOnServerClick;

        Literal = new Literal();

        Panel = new Panel { ID = "pnlChatContent", ClientIDMode = ClientIDMode.Static };

        Panel pnlChatInsert = new Panel();
        pnlChatInsert.Controls.Add(HtmlTextArea);
        pnlChatInsert.Controls.Add(HtmlButton);

        Panel.Controls.Add(Literal);
        Panel.Controls.Add(pnlChatInsert);
    }
Ejemplo n.º 50
0
        public UITestControl SurfaceParameterControl(string SurfaceParameterControl)
        {
            WinClient Client = new WinClient(GetMainWindow());
            Client.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
            Client.SearchProperties[WinControl.PropertyNames.Instance] = "3";
            Client.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Documento = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(Client);
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = "awb_surfaceparams.htm";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
            Documento.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
            Documento.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = null;
            Documento.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            UITestControl ReturnThis= new UITestControl();

            switch (SurfaceParameterControl)
            {
                case "RecalculateCBT":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnRecalcCBT";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Recalculate CBT";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "5";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage CBTImageBut = new HtmlImage(Button);
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        CBTImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        CBTImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        CBTImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTImageBut;
                        break;
                    }
                case "SaveChanges":
                    {
                        HtmlButton Button = new HtmlButton(Documento);
                        Button.SearchProperties[HtmlButton.PropertyNames.Id] = "btnSave";
                        Button.SearchProperties[HtmlButton.PropertyNames.Name] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.DisplayText] = null;
                        Button.SearchProperties[HtmlButton.PropertyNames.Type] = "button";
                        Button.FilterProperties[HtmlButton.PropertyNames.Title] = "Save changes";
                        Button.FilterProperties[HtmlButton.PropertyNames.Class] = null;
                        Button.FilterProperties[HtmlButton.PropertyNames.ControlDefinition] = "style=\"WIDTH: 30px; HEIGHT: 30px\" id=btn";
                        Button.FilterProperties[HtmlButton.PropertyNames.TagInstance] = "11";
                        Button.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

                        HtmlImage SaveImageBut = new HtmlImage(Button);
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Id] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Name] = null;
                        SaveImageBut.SearchProperties[HtmlImage.PropertyNames.Alt] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.Class] = null;
                        SaveImageBut.FilterProperties[HtmlImage.PropertyNames.TagInstance] = "1";
                        SaveImageBut.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = SaveImageBut;
                        break;
                    }
                case "CBTTxt":
                    {
                        HtmlEdit CBTBox = new HtmlEdit(Documento);
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Id] = "eCCBTRQ";
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Name] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null;
                        CBTBox.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Title] = null;
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.Class] = "clsFloatEdit";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.ControlDefinition] = "id=eCCBTRQ dataSrc=#eXml class=clsFloatE";
                        CBTBox.FilterProperties[HtmlEdit.PropertyNames.TagInstance] = "6";
                        CBTBox.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
                        ReturnThis = CBTBox;
                        break;
                    }
            }
            return ReturnThis;
        }
Ejemplo n.º 51
0
    //create access key button
    void CreateAccessKeyButton(string ak, string url)
    {
        HtmlButton inputBtn = new HtmlButton();
        inputBtn.Style.Add("width", "1px");
        inputBtn.Style.Add("height", "1px");
        inputBtn.Style.Add("position", "absolute");
        inputBtn.Style.Add("left", "-2555px");
        inputBtn.Style.Add("z-index", "-1");
        inputBtn.Attributes.Add("type", "button");
        inputBtn.Attributes.Add("value", "");
        inputBtn.Attributes.Add("accesskey", ak);
        inputBtn.Attributes.Add("onclick", "navigateTo('" + url + "');");

        AccessKeyPanel.Controls.Add(inputBtn);
    }
Ejemplo n.º 52
0
 /// <summary>
 /// Gets the button on the screen based on the ID provided
 /// </summary>
 private HtmlButton SelectButtonOnPage(string innerText)
 {
     HtmlButton button = new HtmlButton(this.UIXeroSalesWindowsInteWindow.UIXeroNewRepeatingInvoDocument);
     button.SearchProperties.Add(HtmlButton.PropertyNames.InnerText, innerText, PropertyExpressionOperator.Contains);
     return button;
 }
        public void AddData(string filename, string testcase)
        {
            DataTable dt1 = hlp.dtFromExcelFile(filename, "Template");
            DataTable dt2 = hlp.dtFromExcelFile(filename, "ExpectedData", "TestCase", testcase);
            UITestControl UIcurrentparent = null;
            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                string controlValue = "";
                string parentType = dt1.Rows[i]["ParentType"].ToString();
                string parentSearchBy = dt1.Rows[i]["parentSearchBy"].ToString();
                string parentSearchValue = dt1.Rows[i]["parentSearchValue"].ToString();
                string pTechnology = dt1.Rows[i]["Technology"].ToString();
                string controlType = dt1.Rows[i]["ControlType"].ToString();
                string technologyControl = dt1.Rows[i]["TechnologyControl"].ToString();
                string field = dt1.Rows[i]["Field"].ToString();
                string index = dt1.Rows[i]["Index"].ToString();
                string searchBy = dt1.Rows[i]["SearchBy"].ToString();
                string searchValue = dt1.Rows[i]["SearchValue"].ToString();
                string pOperator = dt1.Rows[i]["pOperator"].ToString();
                string cOperator = dt1.Rows[i]["cOperator"].ToString();
                if (field.Length > 0)
                {
                    controlValue = dt2.Rows[0][field].ToString();
                }

                if (parentType.Length > 0)
                {
                    switch (parentType.ToLower())
                    {

                        #region Window
                        case "window":
                            {
                                if (pTechnology.ToLower() == "msaa")
                                {
                                    WinWindow uiwindow = new WinWindow();
                                    if (pOperator == "=")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uiwindow;
                                }
                                else if (pTechnology == "uia")
                                {
                                    WpfWindow uiwindow = new WpfWindow();
                                    if (pOperator == "=")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uiwindow.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uiwindow;

                                }
                                break;
                            }
                        #endregion

                        #region client
                        case "client":
                            {
                                if (pTechnology.ToLower() == "msaa")
                                {
                                    WinClient uicleint = new WinClient(UIcurrentparent);
                                    if (pOperator == "=")
                                    {
                                        uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uicleint.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uicleint;
                                }
                                else if (pTechnology.ToLower() == "uia")
                                {
                                    // to do
                                }
                                break;
                            }
                        #endregion

                        #region docuemnt
                        case "document":
                            {
                                if (pTechnology.ToLower() == "web")
                                {
                                    HtmlDocument uidoc = new HtmlDocument(UIcurrentparent);
                                    if (pOperator == "=")
                                    {
                                        uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue);
                                    }
                                    else if (pOperator == "~")
                                    {
                                        uidoc.SearchProperties.Add(parentSearchBy, parentSearchValue, PropertyExpressionOperator.Contains);
                                    }
                                    UIcurrentparent = uidoc;
                                }
                                else if (pTechnology.ToLower() == "uia")
                                {

                                    // to do
                                }
                                break;
                            }

            #endregion

                    }
                }
                if (controlType.Length > 0)
                {
                    switch (controlType.ToLower())
                    {
                        #region edit
                        case "edit":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlEdit uiedit = new HtmlEdit(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        uiedit.SearchProperties.Add(searchBy, searchValue);
                                    }
                                    else if (cOperator == "~")
                                    {
                                        uiedit.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        uiedit.Text = controlValue;
                                    }
                                }

                                break;
                            }
                        #endregion
                        #region button
                        case "button":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlButton ucntl= new HtmlButton(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue);
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        Mouse.Click(ucntl);
                                    }
                                }
                                break;
                            }
                        #endregion
                        #region image
                        case "image":
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlImage ucntl = new HtmlImage(UIcurrentparent);
                                    if (cOperator == "=")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue);
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        Mouse.Click(ucntl);
                                    }
                                }
                                break;
                            }
                        #endregion
                        #region Dropdown
                        case "dropdown" :
                            {
                                if (technologyControl == "MSAA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "UIA")
                                {
                                    // to do
                                }
                                else if (technologyControl == "Web")
                                {
                                    HtmlComboBox ucntl = new HtmlComboBox(UIcurrentparent);
                                    if (cOperator == "=" )
                                    {
                                        if (searchValue.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add(searchBy, searchValue);
                                        }
                                        if (index.Length > 0)
                                        {
                                            ucntl.SearchProperties.Add("TagInstance", index);
                                        }
                                    }
                                    else if (cOperator == "~")
                                    {
                                        ucntl.SearchProperties.Add(searchBy, searchValue, PropertyExpressionOperator.Contains);
                                    }

                                    if (controlValue.Length > 0)
                                    {

                                        ucntl.SelectedItem = controlValue;
                                        hlp.LogtoTextFile("Entered Value in ComboBox");
                                    }
                                }
                                break;
                            }
                        #endregion
                    }
                }

            }
        }