internal void EnterShareSkill()
        {
            Commondriver.Excellib.PopulateInCollection(Base.Excelpath, "Shareskills");
            Title.SendKeys(Commondriver.Excellib.ReadData(2, "Title"));
            Description.SendKeys(Commondriver.Excellib.ReadData(2, "Description"));
            Commondriver.Wait(10);
            SelectElement catobj = new SelectElement(Category);

            catobj.SelectByText(Commondriver.Excellib.ReadData(2, "Category"));
            Commondriver.Wait(10);
            SelectElement Subcatobj = new SelectElement(Subcategory);

            Subcatobj.SelectByText(Commondriver.Excellib.ReadData(2, "Subcategory"));
            Tagname.SendKeys(Commondriver.Excellib.ReadData(2, "Tagname"));
            Tagname.SendKeys(Keys.Return);
            Servicetype.Click();
            Locationtype.Click();
            Startdate.SendKeys(Commondriver.Excellib.ReadData(2, "Start date"));
            Enddate.SendKeys(Commondriver.Excellib.ReadData(2, "End date"));
            Availabledays.Click();
            Starttime.SendKeys(Commondriver.Excellib.ReadData(2, "Starttime"));
            Endtime.SendKeys(Commondriver.Excellib.ReadData(2, "End time"));
            Skilltrade.Click();
            Credit.SendKeys(Commondriver.Excellib.ReadData(2, "Credit"));
            System.Threading.Thread.Sleep(3000);
            AutoItX3 autoit = new AutoItX3();

            autoit.WinActivate("Open");
            autoit.Send(@"D:\\Mars\\MarsPageF\\file.txt");
            System.Threading.Thread.Sleep(3000);
            autoit.Send("{ENTER}");
            Active.Click();
            Save.Click();
        }
Esempio n. 2
0
        internal void AddNewSkill(string title, string description, string category, string subcategory, string tags, string credit)
        {
            // Click on the Share Skill button on Home page
            Shareskill.Click();
            Thread.Sleep(1000);

            // Wait for fields to load
            Thread.Sleep(1000);

            // Input information into the Title field
            Title.SendKeys(title);

            // Input information into the Description field
            Description.SendKeys(description);

            // Choose Category
            Category.SendKeys(category);

            // Choose Subcategory
            Subcategory.SendKeys(subcategory);

            // Input information into the Tags field and press Enter key
            Tags.SendKeys(tags);
            Tags.SendKeys(Keys.Enter);

            // Tick One-off service option of Service Type
            ServiceType.Click();

            // Tick On-site option of Location Type
            LocationType.Click();

            // Set Start date and End date of Available days
            Startdate.SendKeys("01-06-2019");
            Enddate.SendKeys("30-06-2019");

            // Tick all weekdays, set Start time as 9:00 and End time as 17:00

            for (int i = 1; i <= 5; i++)
            {
                GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='fields']//input[@name='Available'][@index='" + i + "']")).Click();
                GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='StartTime'][@index='" + i + "']")).SendKeys("0900");
                GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='EndTime'][@index='" + i + "']")).SendKeys("1700");
            }

            // Tick Credit option of Skill Trade
            SkillTrade.Click();

            // Input number into price field
            Credit.SendKeys(credit);

            // Tick Hidden option of Active
            Active.Click();

            // Click on the Save button
            Save.Click();
            Thread.Sleep(500);
        }
Esempio n. 3
0
        public string GenHash()
        {
            string opthash = "";

            opthash += Mode;
            opthash += Build;
            opthash += Duration;
            opthash += Leaver + Army + Kills + Income;
            opthash += Startdate.ToString("yyyyMMdd");
            opthash += Enddate.ToString("yyyyMMdd");
            opthash += Interest;
            opthash += Vs;
            opthash += Player;
            opthash += String.Join("", Dataset.OrderBy(o => o));
            opthash += String.Join("", Gamemodes.Where(x => x.Value == true).OrderBy(o => o.Key).Select(s => s.Key));
            opthash += String.Join("", Players.Where(x => x.Value == true).OrderBy(o => o.Key).Select(s => s.Key));
            opthash += Breakpoint;
            opthash += MengskPreviewFilter;
            Hash     = opthash;
            return(opthash);
        }
Esempio n. 4
0
        internal void Addingdate()
        {
            Actions actions = new Actions(Global.GlobalDefinitions.driver);



            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Share_Skill");

            //click on share skill
            SSbutton.Click();
            Thread.Sleep(2000);

            //Click on title
            Title.Click();
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            //clic on description
            Description.Click();
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Click on Category
            actions.MoveToElement(Category).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_Cat = Category.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_Cat);
            int categorycount = Select_Cat.Count;

            for (int i = 0; i < categorycount; i++)
            {
                if (Select_Cat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category"))
                {
                    Select_Cat[i].Click();
                    Console.WriteLine("Category is" + Select_Cat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Click on Sub Category
            actions.MoveToElement(SubCategory).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_SubCat = SubCategory.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_SubCat);
            int Scategorycount = Select_SubCat.Count;

            for (int i = 0; i < Scategorycount; i++)
            {
                if (Select_SubCat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Sub-Category"))
                {
                    Select_SubCat[i].Click();
                    Console.WriteLine("Category is" + Select_SubCat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Add tags
            actions.MoveToElement(Tags).Build().Perform();
            string tag1 = GlobalDefinitions.ExcelLib.ReadData(2, "Tags");
            string tag2 = GlobalDefinitions.ExcelLib.ReadData(3, "Tags");
            string tag3 = GlobalDefinitions.ExcelLib.ReadData(4, "Tags");

            Tags.SendKeys(tag1);
            Tags.SendKeys(Keys.Enter);

            Thread.Sleep(2000);
            Tags2.Click();
            // actions.MoveToElement(Tags2).Build().Perform();
            Tags2.SendKeys(tag2);

            Thread.Sleep(1000);
            //actions.MoveToElement(Tags).Build().Perform();
            //Tags.SendKeys(tag3);



            //Select service type
            actions.MoveToElement(ServiceType).Build().Perform();
            IList <IWebElement> ST = ServiceType.FindElements(By.XPath("//div/input[@name='serviceType']/following-sibling :: label"));

            for (int i = 0; i < ST.Count; i++)
            {
                Console.WriteLine("service from web" + ST[i].Text);
                if (ST[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"))
                {
                    HourlyService.Click();
                }
                else
                {
                    One_off_service.Click();
                }
                break;
            }

            //Select Location type
            actions.MoveToElement(LocationType).Build().Perform();
            IList <IWebElement> LT = ServiceType.FindElements(By.XPath("//div/input[@name='locationType']/following-sibling :: label"));

            for (int i = 0; i < LT.Count; i++)
            {
                Console.WriteLine("service from web" + LT[i].Text);
                if (LT[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"))
                {
                    Onsite.Click();
                }
                else
                {
                    Online.Click();
                }
                break;
            }


            //Click on start date
            Startdate.Click();

            Thread.Sleep(1000);
            //Enter start date
            string s1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartDate");

            string[] s = s1.Split(' ');
            Console.WriteLine("1st part of string:" + s[0]);
            Console.WriteLine("2nd part of string:" + s[1]);
            string SD = s[0];

            Startdate.SendKeys(SD);

            //click on enddate
            Enddate.Click();
            //Enter End date
            string E1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndDate");

            string[] E = E1.Split(' ');
            Console.WriteLine("Enddate 1st part is:" + E[0]);
            Console.WriteLine("End date second part is:" + E[1]);
            string ED = E[0];

            Enddate.SendKeys(ED);

            Thread.Sleep(1000);
            //Enter day
            actions.MoveToElement(Days).Build().Perform();
            IList <IWebElement> Day_Name = Days.FindElements(By.XPath("//div[@class='ui checkbox']/input/following-sibling :: label"));

            Console.WriteLine("Days are" + Day_Name);
            IList <IWebElement> Day_check = Days.FindElements(By.XPath("//input[@tabindex='0' and @type='checkbox']"));

            Console.WriteLine("Day checkbox" + Day_check);
            Thread.Sleep(1000);
            int Day_Count      = Day_Name.Count;
            int DayCheck_Count = Day_check.Count;

            for (int i = 0; i < Day_Count; i++)
            {
                if (Day_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Day"))
                {
                    int j = i;
                    Day_check[j].Click();
                    Console.WriteLine("selected day is" + Day_Name[i]);
                }
            }

            //Enter starttime
            Start_Time.Click();
            string t1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartTime");

            Console.WriteLine("Starttime is:" + t1);
            Start_Time.SendKeys(t1);

            //Enter Endtime
            End_Time.Click();
            string ET = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndTime");

            Console.WriteLine("Endtime is:" + ET);
            End_Time.SendKeys(ET);

            //Select SkillExchange
            actions.MoveToElement(Skill_trade).Build().Perform();
            IList <IWebElement> Skill_E = Skill_trade.FindElements(By.XPath("//div/input[@name='skillTrades']/following-sibling :: label"));
            int SkillCount = Skill_E.Count;

            Console.WriteLine("count of radio buttons:" + SkillCount);
            for (int i = 0; i < SkillCount; i++)
            {
                if (Skill_E[i].Text == GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade"))
                {
                    Console.WriteLine("Skil is" + Skill_E[i].Text);
                    Skill_Exchange.Click();
                    actions.MoveToElement(Add_tags).Build().Perform();
                    string Tag = GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange");
                    Add_tags.SendKeys(Tag);
                    Base.test.Log(LogStatus.Info, "Selected skill");
                }

                else
                {
                    Credit.Click();
                    actions.MoveToElement(Add_credit).Build().Perform();
                    string Cr = GlobalDefinitions.ExcelLib.ReadData(2, "Credit");
                    Add_credit.SendKeys(Cr);
                }
                break;
            }


            //Click on Worksample
            PlusIcon.Click();

            //Performing the upload file operation using AutoIT

            AutoItX3 autoIT = new AutoItX3();

            autoIT.WinActivate("Open");
            Thread.Sleep(3000);
            string sample1 = GlobalDefinitions.ExcelLib.ReadData(2, "WorkSample");

            Console.WriteLine("file path is" + sample1);
            Thread.Sleep(2000);
            autoIT.Send(@sample1);
            Thread.Sleep(3000);
            autoIT.Send("{Enter}");
            Thread.Sleep(2000);

            //Downloading the file
            Download.Click();

            //Deleting a file
            Delete.Click();
            Thread.Sleep(500);

            actions.MoveToElement(Active).Build().Perform();
            IList <IWebElement> Active_Name = Active.FindElements(By.XPath("//div[@class='ui radio checkbox']/input[@name='isActive']/following-sibling :: label"));

            Console.WriteLine("Days are" + Active_Name);
            IList <IWebElement> Active_radio = Active.FindElements(By.XPath("//input[@name='isActive' and @type='radio']"));

            Console.WriteLine("Day checkbox" + Active_radio);
            Thread.Sleep(1000);
            int Active_Count = Active_Name.Count;

            for (int i = 0; i < Active_Count; i++)
            {
                if (Active_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active"))
                {
                    int j = i;
                    Active_radio[j].Click();
                }
            }

            //click on save
            actions.MoveToElement(Buttons).Build().Perform();
            IList <IWebElement> BT = ServiceType.FindElements(By.XPath("//input[@type='button']"));

            for (int i = 0; i < BT.Count; i++)
            {
                Console.WriteLine("Button from web" + BT.Count);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Buttons") == "Save")
                {
                    Save.Click();
                }
                else
                {
                    Cancel.Click();
                }
                break;
            }


            string text = Global.GlobalDefinitions.driver.Title;

            if (text == "ServiceListing")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Share skill page");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Not valid page");
            }
        }
Esempio n. 5
0
        public static ExctractionDetails ExtractData(AccountDetails details, string CBAConstr, string ClirecConstr, string CBAType, bool isNIP, string NIPsession)
        {
            string    uuid     = Guid.NewGuid().ToString();
            DataTable data     = new DataTable();
            var       Edetails = new ExctractionDetails();

            Edetails.Data = new DataTable();
            try
            {
                var db = new DBConnector(CBAConstr, ClirecConstr);

                Utils.Log("Beginging Data Etraction for (" + details.AccountCode + ") using Interface definition ID (" + details.DefinitionID + ")");

                InterfaceDefinition def = db.getDefinition(details.DefinitionID);

                string mappedAccts = ""; var map = new StringBuilder(); int ct = 1;

                foreach (string cba in details.CBAccount)
                {
                    map.Append("'").Append(cba).Append("'");

                    if (ct < details.CBAccount.Count)
                    {
                        map.Append(",");
                    }
                    ct++;
                }
                mappedAccts = map.ToString();

                //string sql = def.script.Replace("startdate", getDate(details.LastLedgerDate)).
                //    Replace("enddate", details.Endate).Replace("acctid", mappedAccts).
                //    Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);

                Utils.Log("Connecting to transaction Database");


                var sql = "";

                string Startdate, Enddate;

                if (isNIP)
                {
                    switch (NIPsession.toInt())
                    {
                    case 1:
                        Startdate = details.LastLedgerDate.ToString("dd-MMM-yy") + " 2.00.00 PM";
                        Enddate   = details.Endate.toDateTime().ToString("dd-MMM-yy") + " 11.59.59 PM";

                        break;

                    default:
                        Startdate = details.LastLedgerDate.ToString("dd-MMM-yy") + " 12.00.00 AM";
                        Enddate   = details.Endate.toDateTime().ToString("dd-MMM-yy") + " 1.59.59 PM";

                        break;
                    }
                }
                else
                {
                    Startdate = getDate(details.LastLedgerDate);
                    Enddate   = details.Endate.toDateTime().ToString("dd-MMM-yyyy");
                }


                switch (CBAType.CleanUp())
                {
                case "mysql":
                    sql = def.script.Replace("startdate", details.LastLedgerDate.ToString("yyyy-MM-dd")).
                          Replace("enddate", Convert.ToDateTime(details.Endate).ToString("yyyy-MM-dd")).Replace("acctid", mappedAccts).
                          Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                    Utils.Log(sql);
                    data = db.fetchMySQLCBA(sql);
                    break;

                case "sqlserver":
                    sql = def.script.Replace("startdate", Startdate).
                          Replace("enddate", Enddate).Replace("acctid", mappedAccts).
                          Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                    Utils.Log(sql);
                    data = db.getSQLServerCBA(sql);
                    break;

                default:
                    sql = def.script.Replace("startdate", Startdate).
                          Replace("enddate", Enddate).Replace("acctid", mappedAccts).
                          Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                    Utils.Log(sql);
                    data = db.fetchCBA(sql);
                    break;
                }


                int  nofT   = data.Rows.Count;
                bool isData = nofT > 0;
                Utils.Log(nofT + " transaction(s) fetched");
                int sn = 1;

                data = Utils.AddExtractionColumns(data);

                foreach (DataRow row in data.Rows)
                {
                    row["PostDate"] = row[def.postDateCol].toDateTime();

                    row["Valdate"] = row[def.valDateCol].toDateTime();

                    bool isDebit = row[def.directionCol].ToString().ToUpper().Equals("D");

                    row["CrDr"] = (isDebit ? "1" : "2");

                    row["Debits"] = (isDebit ? row[def.amountCol].toDecimal() : decimal.Zero);

                    row["Credits"] = (isDebit ? decimal.Zero : row[def.amountCol].toDecimal());

                    row["Amount"] = row["Credits"].toDecimal() + row["Debits"].toDecimal();

                    getUDFs(row, def);

                    row["Details"] = getNaration(def, row);

                    row["SN"]       = sn++;
                    row["Id"]       = uuid;
                    row["username"] = "******";
                }
                var balance = decimal.Zero;
                if (isData)
                {
                    try
                    {
                        Utils.Log("Computing Max Submited Date");
                        Edetails.LastSubmitedDate = data.Rows[0]["SubmittedOn"].ToString();
                        Utils.Log("Max Submitted Date =" + Edetails.LastSubmitedDate);
                    }
                    catch (Exception e)
                    {
                        Utils.Log("Failed to obtain Max submitted date because:" + e.Message);
                    }



                    if (isNIP && NIPsession.toInt() == 2)
                    {
                    }
                    else
                    {
                        Utils.Log("Attempting to Fetch Account Balance");

                        foreach (string cba in details.CBAccount)
                        {
                            DataTable baldata;

                            if (isNIP)
                            {
                                Enddate = Enddate.toDateTime().ToString("dd-MMM-yyyy");
                            }


                            switch (CBAType.CleanUp())
                            {
                            case "mysql":
                                sql = def.balScript.Replace("startdate", Convert.ToDateTime(Utils.getFirstDayofMonth(details.CurrentDate)).ToString("yyyy-MM-dd"))
                                      .Replace("enddate", Convert.ToDateTime(details.Endate).ToString("yyyy-MM-dd")).Replace("acctid", cba).
                                      Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                                baldata = db.fetchMySQLCBA(sql);
                                break;

                            case "sqlserver":
                                sql = def.balScript.Replace("startdate", Utils.getFirstDayofMonth(details.CurrentDate))
                                      .Replace("enddate", Enddate).Replace("acctid", cba).
                                      Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                                baldata = db.getSQLServerCBA(sql);
                                break;

                            default:
                                sql = def.balScript.Replace("startdate", Utils.getFirstDayofMonth(details.CurrentDate))
                                      .Replace("enddate", Enddate).Replace("acctid", cba).
                                      Replace("acctCcode", details.currency).Replace("acctBcode", details.CbaBranchCode);
                                baldata = db.fetchCBA(sql);
                                break;
                            }



                            if (baldata.Rows.Count > 0)
                            {
                                balance += baldata.Rows[0][def.balCol].toDecimal();
                            }
                        }
                        Utils.Log(sql);
                        Utils.Log("Balance downloaded successfully and = " + balance.ToString("0.00"));
                    }

                    string[] selected = new[] { "SN", "PostDate", "Valdate", "Details", "Debits", "Credits", "Amount", "CrDr", "ud1", "ud2", "ud3", "ud4", "ud5", "Id", "username" };



                    data = new DataView(data).ToTable(false, selected);



                    Edetails.TotalCredits = Convert.ToDecimal(data.Compute("Sum(Credits)", ""));
                    Edetails.TotalDebits  = Convert.ToDecimal(data.Compute("Sum(Debits)", ""));
                    Edetails.Latest       = Convert.ToDateTime(data.Compute("Max(PostDate)", ""));
                    Edetails.CreditCount  = data.Compute("count(CrDr)", "CrDr ='2' ").toInt();
                    Edetails.DebitCount   = data.Compute("count(CrDr)", "CrDr ='1' ").toInt();

                    Edetails.DataID = uuid;

                    Edetails.Balance = balance;



                    db.CopyDataTableToDB(data, "ExtractionTemp");
                }


                return(Edetails);
            }
            catch (Exception e)
            {
                throw new Exception("CBA Download failed for " + details.AccountName + "(" + details.AccountCode + ") because: " + e.Message);
            }
            finally
            {
                data.Clear();
                data.Dispose();
            }
        }
Esempio n. 6
0
        public void AddShareSkill(IWebDriver Driver)
        {
            //Click Share Skill button
            ShareSkillBtn.Click();
            Thread.Sleep(5000);

            //Title Input
            Title.SendKeys(Helpers.ExcelLib.ReadData(2, "Title"));

            //Description Input
            Description.SendKeys(Helpers.ExcelLib.ReadData(2, "Description"));

            //Select Category
            var selectElement1 = new SelectElement(Category);

            selectElement1.SelectByValue("6");
            Console.WriteLine("Category selcted");

            //Select Sub-Catergory

            var selectElement2 = new SelectElement(Subcategory);

            selectElement2.SelectByText("QA");
            Console.WriteLine("Sub-Category selcted");

            //Select Tags
            Tag1.SendKeys(Helpers.ExcelLib.ReadData(2, "Tag1"));
            Tag1.SendKeys(Keys.Enter);

            Console.WriteLine("Enter clicked");

            //Select Service Type
            Servicetype.Click();

            //Select Location Type
            Locationtype.Click();

            //Select End date
            Enddate.SendKeys("29-07-2019");

            //Input for the whole week
            //Monday time
            MonCheck.Click();
            MonStart.SendKeys(Helpers.ExcelLib.ReadData(2, "MonStart"));
            MonEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "MonEnd"));

            //Tuesday time
            TuesCheck.Click();
            TuesStart.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesStart"));
            TuesEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesEnd"));

            //Wednesday time
            WedCheck.Click();
            WedStart.SendKeys(Helpers.ExcelLib.ReadData(2, "WedStart"));
            WedEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "WedEnd"));

            //Thursday time
            ThursCheck.Click();
            ThursStart.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursStart"));
            ThursEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursEnd"));

            //Friday time
            FriCheck.Click();
            FriStart.SendKeys(Helpers.ExcelLib.ReadData(2, "FriStart"));
            FriEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "FriEnd"));

            //Select Skill trade
            SkillTrade.Click();

            //Select Skill Exchange
            SkillExchange.SendKeys(Helpers.ExcelLib.ReadData(2, "SkillExchange"));
            SkillExchange.SendKeys(Keys.Enter);

            //Upload Work Sample Upload click
            IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver;

            js1.ExecuteScript("arguments[0].click();", Upload);
            Thread.Sleep(5000);

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf");
            Thread.Sleep(4000);
            autoIt.Send("{ENTER}");

            //Select Active
            SkillActive.Click();

            //Click Save
            Savebtn.Click();
            Thread.Sleep(5000);

            //Verification

            //CommonDriver.Driver.FindElement(By.XPath("//a[contains(text(),'Manage Listings')]")).Click();
            //string ExpectedResult1 = "Software Tester 7";
            //string ActualResult1 = CommonDriver.Driver.FindElement(By.XPath("//td[contains(text(),'q')]")).Text;

            //if (ActualResult1 == ExpectedResult1)
            //{
            //    Console.WriteLine("Test Pass: Skill Added");
            //}
            //else
            //{
            //    Console.WriteLine("Test Fail: Skill Not Added");
            //}

            try
            {
                Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed);
                Console.WriteLine("Test Pass: Skill listing Added");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 7
0
        internal void AddShareSkill(IWebDriver Driver)
        {
            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkillTestData");
            Thread.Sleep(1000);

            //Click Share Skill button
            ShareSkillBtn.Click();
            Thread.Sleep(5000);

            //Title Input
            Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            //Description Input
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Select Category
            var selectElement1 = new SelectElement(Category);

            selectElement1.SelectByValue("6");
            Console.WriteLine("Category selcted");

            //Select Sub-Catergory

            var selectElement2 = new SelectElement(Subcategory);

            selectElement2.SelectByText("QA");
            Console.WriteLine("Sub-Category selcted");

            //Select Tags
            Tag1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tag1"));
            Tag1.SendKeys(Keys.Enter);

            Console.WriteLine("Enter clicked");

            //Select Service Type
            Servicetype.Click();

            //Select Location Type
            Locationtype.Click();

            //Select End date
            Enddate.SendKeys("29-07-2019");

            //Input for the whole week
            //Monday time
            MonCheck.Click();
            MonStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonStart"));
            MonEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonEnd"));

            //Tuesday time
            TuesCheck.Click();

            TuesStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesStart"));
            TuesEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesEnd"));

            //Wednesday time
            WedCheck.Click();
            WedStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedStart"));
            WedEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedEnd"));

            //Thursday time
            ThursCheck.Click();
            ThursStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursStart"));
            ThursEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursEnd"));

            //Friday time
            FriCheck.Click();
            FriStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriStart"));
            FriEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriEnd"));

            //Select Skill trade
            SkillTrade.Click();

            //Select Skill Exchange
            SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange"));
            SkillExchange.SendKeys(Keys.Enter);

            ////Upload Work Sample Upload click
            IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver;

            js1.ExecuteScript("arguments[0].click();", Upload);
            Thread.Sleep(5000);

            AutoItX3 autoIt = new AutoItX3();

            Thread.Sleep(5000);
            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf");
            Thread.Sleep(4000);
            autoIt.Send("{ENTER}");

            //Select Active
            SkillActive.Click();

            //Click Save
            Savebtn.Click();
            Thread.Sleep(5000);

            Base.test.Log(LogStatus.Info, "Skill added successfully");

            //Verification
            Thread.Sleep(4000);
            string ExpectedResult1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title");
            string ActualResult1   = ActualValue1.Text;

            if (ActualResult1 == ExpectedResult1)
            {
                Console.WriteLine("Test Pass: Skill Added");
                // Screenshot
                String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); //AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\");
                Base.test.Log(LogStatus.Info, "Image example: " + img);
                // end test. (Reports)
                Base.extent.EndTest(Base.test);
                // calling Flush writes everything to the log file (Reports)
                Base.extent.Flush();
                // Close the driver :)
                //GlobalDefinitions.driver.Close();
            }
            else
            {
                Console.WriteLine("Test Fail: Skill Not Added");
            }

            //try
            //{

            //    Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed);
            //    Console.WriteLine("Test Pass: Skill listing Added");
            //}
            //catch (Exception e)
            //{
            //    Console.WriteLine("Test Fail: Skill listing not present");
            //}
        }
Esempio n. 8
0
    protected void BtnConsolidateRpt_Click(object sender, EventArgs e)
    {
        DateTime start   = new DateTime();
        DateTime Enddate = new DateTime();

        if (txtStrtDate.Text.ToString() != "")
        {
            string[] date = new string[3];
            date  = txtStrtDate.Text.Trim().Split('/');
            start = new DateTime(Convert.ToInt16(date[2]), Convert.ToInt16(date[1]), Convert.ToInt16(date[0]));
        }
        if (txtEndDate.Text.ToString() != "")
        {
            string[] enddate = new string[3];
            enddate = txtEndDate.Text.Trim().Split('/');
            Enddate = new DateTime(Convert.ToInt16(enddate[2]), Convert.ToInt16(enddate[1]), Convert.ToInt16(enddate[0]));
        }

        if (ChkExportExcel.Checked == true)
        {
            DataTable Dtb1 = new DataTable();
            ArrayList Pa   = new ArrayList();
            ArrayList Pv   = new ArrayList();
            Pa.Add("@StartDate");
            Pa.Add("@EndDate");
            Pv.Add(txtStrtDate.Text.ToString() != "" ? start.ToString("yyyy/MM/dd") : "");
            Pv.Add(txtEndDate.Text.ToString() != "" ? Enddate.ToString("yyyy/MM/dd") : "");
            DBH.CreateDataTableCalender(Dtb1, "SP_ConSolidatedCalenderReports1", true, Pa, Pv);
            ExportToExcel(Dtb1);
        }
        else
        {
            System.IO.MemoryStream stream1 = new System.IO.MemoryStream();



            try
            {
                string Path = Server.MapPath("DeptWiseCalendarConsolidated.rpt");
                Path = Path.Substring(0, Path.LastIndexOf('\\'));
                Path = Path.Substring(0, Path.LastIndexOf('\\'));
                Path = Path + "\\Report\\DeptWiseCalendarConsolidated.rpt";
                myReportDocument.Load(Path);
                //myReportDocument.SetDatabaseLogon("software", "DelFirMENA$idea", "192.168.167.207", "DB_SkylineCalendarEvents");
                myReportDocument.SetDatabaseLogon("software", "DelFirMENA$idea");

                if (txtStrtDate.Text.ToString() != "")
                {
                    myReportDocument.SetParameterValue("@StartDate", start.ToString("yyyy/MM/dd"));
                }
                else
                {
                    myReportDocument.SetParameterValue("@StartDate", "");
                }
                if (txtStrtDate.Text.ToString() != "")
                {
                    myReportDocument.SetParameterValue("@EndDate", Enddate.ToString("yyyy/MM/dd"));
                }
                else
                {
                    myReportDocument.SetParameterValue("@EndDate", "");
                }


                //stream1 = null;
                //ExportOptions ex = myReportDocument.ExportOptions;
                //ex.ExportFormatType = ExportFormatType.PortableDocFormat;
                //ExportRequestContext x = new ExportRequestContext();
                //x.ExportInfo = ex;
                //stream1 = (System.IO.MemoryStream)myReportDocument.FormatEngine.ExportToStream(x);
                //Response.Clear();
                //Response.ContentType = "application/pdf";
                //Response.BinaryWrite(stream1.ToArray());
                //Response.End();
                //stream1.Close();

                System.IO.Stream oStream   = null;
                byte[]           byteArray = null;
                oStream   = myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byteArray = new byte[oStream.Length];
                oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = "application/pdf";
                Response.BinaryWrite(byteArray);
                Response.Flush();
                Response.Close();
                myReportDocument.Close();
                myReportDocument.Dispose();
            }
            catch (Exception Ex)
            {
                //    LogFile L = new LogFile();
                //    L.LogError("DisplayCalendar.aspx");
                //    L.LogError(Ex.Message.ToString());
                //    L.LogError(Session["User"].ToString());
                //    Response.Write(Ex.Message);
            }
            finally
            {
            }
        }
    }
Esempio n. 9
0
    protected void btnDate_Click(object sender, EventArgs e)
    {
        DateTime start   = new DateTime();
        DateTime Enddate = new DateTime();

        if (txtStrtDate.Text.ToString() != "")
        {
            string[] date = new string[3];
            date  = txtStrtDate.Text.Trim().Split('/');
            start = new DateTime(Convert.ToInt16(date[2]), Convert.ToInt16(date[1]), Convert.ToInt16(date[0]));
        }
        if (txtEndDate.Text.ToString() != "")
        {
            string[] enddate = new string[3];
            enddate = txtEndDate.Text.Trim().Split('/');
            Enddate = new DateTime(Convert.ToInt16(enddate[2]), Convert.ToInt16(enddate[1]), Convert.ToInt16(enddate[0]));
        }

        if (ChkExportExcel.Checked == true)
        {
            ArrayList pa = new ArrayList();
            ArrayList pv = new ArrayList();
            pa.Add("@EventTitle");
            pa.Add("@Category1");
            pa.Add("@Category2");
            pa.Add("@Year");
            pa.Add("@semester");
            pa.Add("@ItemType");
            pa.Add("@CalName");
            pa.Add("@StartDate");
            pa.Add("@EndDate");
            pv.Add(drpEvent.SelectedValue);
            pv.Add(DrpCat1.SelectedValue);
            pv.Add(drpCat2.SelectedValue);
            pv.Add(drpYear.SelectedValue);
            pv.Add(drpSem.SelectedValue);
            pv.Add(DrpType.SelectedValue);
            pv.Add(DrpCalendar.SelectedValue);
            pv.Add(txtStrtDate.Text.ToString() != "" ? start.ToString("yyyy/MM/dd"): "");
            pv.Add(txtStrtDate.Text.ToString() != "" ? Enddate.ToString("yyyy/MM/dd"):"");
            DataTable Dtb1 = new DataTable();
            DBH.CreateDataTableCalender(Dtb1, "SP_DeptwiseEvent", true, pa, pv);
            ExportToExcel(Dtb1);
        }
        else
        {
            System.IO.MemoryStream stream1 = new System.IO.MemoryStream();



            try
            {
                string Path = Server.MapPath("DeptWiseCalendar1.rpt");
                Path = Path.Substring(0, Path.LastIndexOf('\\'));
                Path = Path.Substring(0, Path.LastIndexOf('\\'));
                Path = Path + "\\Report\\DeptWiseCalendar1.rpt";
                myReportDocument.Load(Path);
                //myReportDocument.SetDatabaseLogon("software", "DelFirMENA$idea", "192.168.167.207", "DB_SkylineCalendarEvents");
                myReportDocument.SetDatabaseLogon("software", "DelFirMENA$idea");
                myReportDocument.SetParameterValue("@DeptName", DrpCalendar.SelectedItem.Text);
                if (txtStrtDate.Text.ToString() != "")
                {
                    myReportDocument.SetParameterValue("@StartDate", start.ToString("yyyy/MM/dd"));
                }
                else
                {
                    myReportDocument.SetParameterValue("@StartDate", "");
                }
                if (txtStrtDate.Text.ToString() != "")
                {
                    myReportDocument.SetParameterValue("@EndDate", Enddate.ToString("yyyy/MM/dd"));
                }
                else
                {
                    myReportDocument.SetParameterValue("@EndDate", "");
                }

                myReportDocument.SetParameterValue("@EventTitle", drpEvent.SelectedValue);
                myReportDocument.SetParameterValue("@Category1", DrpCat1.SelectedValue);
                myReportDocument.SetParameterValue("@Category2", drpCat2.SelectedValue);
                myReportDocument.SetParameterValue("@Year", drpYear.SelectedValue);
                myReportDocument.SetParameterValue("@semester", drpSem.SelectedValue);
                myReportDocument.SetParameterValue("@ItemType", DrpType.SelectedValue);
                myReportDocument.SetParameterValue("@CalName", DrpCalendar.SelectedValue);



                System.IO.Stream oStream   = null;
                byte[]           byteArray = null;
                oStream   = myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byteArray = new byte[oStream.Length];
                oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = "application/pdf";
                Response.BinaryWrite(byteArray);
                Response.Flush();
                Response.Close();
                myReportDocument.Close();
                myReportDocument.Dispose();
            }
            catch (Exception Ex)
            {
                Response.Write(Ex.Message);
            }

            finally
            {
            }
        }
    }
 private void Timebetween_Clicked(object sender, EventArgs e)
 {
     Enddate.Focus();
    GetTimeElapsed();
 }