示例#1
0
        public void ticketsAdvanceFilterRelatedTo()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var officeTickets_AllTicketsHelper = new OfficeTickets_AllTicketsHelper(GetWebDriver());

            // Variable
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");



                // Verify tickets with notes.

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketswithNotes");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Select activity type as notes.");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Notes");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify note present for ticket.");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Notes");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);


                //Verify tickets with documents.

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketWithDocs");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Select activity type as documents .");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Documents");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify ticket present has document.");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Documents");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);


                //Verify ticket with meetings.

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketsWithMeetings");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Select activity type as meetings");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Meetings");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify meeting present for ticket.");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Meeting");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);


                // Verify ticket with tasks .

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketWithTasks");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Select activity type as tasks.");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Tasks");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify task present for the ticket.");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Task");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);


                // Verify ticket with calls .

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketWithCalls");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Select activity type as calls.");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Calls");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify calls present for ticket.");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Calls");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                // Verify tickets with attachments .

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Redirect To URL");
                VisitOffice("tickets");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify page title.");
                VerifyTitle("Tickets");
                //officeTickets_AllTicketsHelper.WaitForElementVisible("AdvanceFilter", 10);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on advance filter.");
                officeTickets_AllTicketsHelper.ClickElement("AdvanceFilter");
                officeTickets_AllTicketsHelper.WaitForWorkAround(2000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "click ticket with activity type.");
                officeTickets_AllTicketsHelper.ClickForce("TicketWithCalls");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Click on apply button.");
                officeTickets_AllTicketsHelper.ClickForce("Apply");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                officeTickets_AllTicketsHelper.ClickElement("ClickTicket1");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify document present is related to clients");
                officeTickets_AllTicketsHelper.SelectByText("SelectActivity", "Calls");
                officeTickets_AllTicketsHelper.WaitForWorkAround(3000);

                executionLog.Log("TicketsAdvanceFilterRelatedTo", "Verify document present is related to clients");
                officeTickets_AllTicketsHelper.VerifyText("NoteTicket", "Calls");
                //officeTickets_AllTicketsHelper.WaitForWorkAround(3000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("TicketsAdvanceFilterRelatedTo");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("TicketsAdvanceFilterRelatedTo");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("TicketsAdvanceFilterRelatedTo", "Bug", "Medium", "Opportunities page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("TicketsAdvanceFilterRelatedTo");
                        TakeScreenshot("TicketsAdvanceFilterRelatedTo");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\TicketsAdvanceFilterRelatedTo.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("TicketsAdvanceFilterRelatedTo");
                        string id            = loginHelper.getIssueID("TicketsAdvanceFilterRelatedTo");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\TicketsAdvanceFilterRelatedTo.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("TicketsAdvanceFilterRelatedTo"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("TicketsAdvanceFilterRelatedTo");
                executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("TicketsAdvanceFilterRelatedTo");
                executionLog.WriteInExcel("TicketsAdvanceFilterRelatedTo", Status, JIRA, "Opportunities Management");
            }
        }
        private void setRouting(string [] message)
        {
            string address = message[0];

            if (message[1] == MessageNames.CONNECTION_TEARDOWN)
            {
                if (message[3] == "CC")
                {
                    short frequency = Int16.Parse(message[10]);
                    short port_In   = Int16.Parse(message[5]);
                    short port_Out  = Int16.Parse(message[7]);



                    CommutationTableRow rowToDelete = new CommutationTableRow();
                    rowToDelete = commutationTable.FindRow(Convert.ToInt16(message[7]), Convert.ToInt16(message[5]));
                    commutationTable.Table.Remove(rowToDelete);

                    string responseMessage = System.Configuration.ConfigurationManager.AppSettings["UDP" + numberOfRouter] + "#" + MessageNames.CONNECTION_TEARDOWN + "#OK" + "#" + "CC#";
                    SendingMessageCC(address, responseMessage);
                    Console.WriteLine("[" + Timestamp.generateTimestamp() + "] Message  delete from table  {0} port_in- {1} port_out- {2} frequency {3}", "COMUTATION", frequency, port_In, port_Out);
                }
                else if (message[3] == "BORDERTABLE")
                {
                    string responseMessage = System.Configuration.ConfigurationManager.AppSettings["UDP" + numberOfRouter] + "#" + MessageNames.CONNECTION_TEARDOWN + "#OK" + "#" + "CC#";


                    BorderNodeCommutationTableRow newRow = new BorderNodeCommutationTableRow();
                    //IP source--IP destination--czestotliwosc
                    newRow = borderNodeCommutationTable.FindRow(message[4], message[6], Int16.Parse(message[7]));
                    borderNodeCommutationTable.Table.Remove(newRow);
                    SendingMessageCC(address, responseMessage);

                    Console.WriteLine("[" + Timestamp.generateTimestamp() + "] Message  delete from table  {0} frequency: {1} Address Source: {2} Address Destionation: {3}", "BORDER_NODE_COMUTATION", message[7], message[4], message[6]);
                }
            }
            else if (message[1] == MessageNames.CONNECTION_REQUEST)
            {
                if (message[3] == "CC")
                {
                    Console.WriteLine("[" /*+ Timestamp.generateTimestamp() */ + "] Received message filling Commutation Table  from CC " + message[0]);

                    short frequency = Int16.Parse(message[10]);
                    short port_In   = Int16.Parse(message[5]);
                    short port_Out  = Int16.Parse(message[7]);



                    CommutationTableRow commuteRow = new CommutationTableRow(frequency, port_In, frequency, port_Out);
                    commutationTable.Table.Add(commuteRow);

                    string responseMessage = System.Configuration.ConfigurationManager.AppSettings["UDP" + numberOfRouter] + "#" + MessageNames.CONNECTION_REQUEST + "#OK" + "#" + "CC#";
                    SendingMessageCC(address, responseMessage);
                    Console.WriteLine("[" /*+ Timestamp.generateTimestamp() */ + "] Message  new registry to table  {0} ", "COMUTATION_TABLE" +
                                      " Frequency: " + message[10] + " port_in: " + message[5] + " port_out: " + message[7]);
                }
                else if (message[3] == "BORDERTABLE")
                {
                    Console.WriteLine("[" /*+ Timestamp.generateTimestamp() */ + "] Received message filling BorderNodeCommutationTable  from CC " + message[0]);
                    string responseMessage = System.Configuration.ConfigurationManager.AppSettings["UDP" + numberOfRouter] + "#" + MessageNames.CONNECTION_REQUEST + "#OK" + "#" + "CC#";


                    BorderNodeCommutationTableRow newRow = new BorderNodeCommutationTableRow(
                        message[4], Convert.ToInt16(message[5]), Convert.ToInt16(1), Convert.ToInt16(message[7]), Convert.ToInt16(7),
                        Convert.ToInt16(1), message[6], Convert.ToInt16(2), Convert.ToInt16(1));
                    borderNodeCommutationTable.Table.Add(newRow);
                    SendingMessageCC(address, responseMessage);
                    Console.WriteLine("[" /*+ Timestamp.generateTimestamp() */ + "] Message  new registry to table  {0} ", "BORDER_NODE_COMUTATION " +
                                      "Frequency: " + message[7] + " port_in " + message[5]);
                }
            }
        }
示例#3
0
        internal static object ConvertTo(this object value, Type toType, Func <object> getConverter,
                                         IServiceProvider serviceProvider)
        {
            if (value == null)
            {
                return(null);
            }

            var str = value as string;

            if (str != null)
            {
                //If there's a [TypeConverter], use it
                object converter = getConverter?.Invoke();
                if (null != converter)
                {
                    var xfTypeConverter         = converter as TypeConverter;
                    var xfExtendedTypeConverter = xfTypeConverter as IExtendedTypeConverter;
                    if (xfExtendedTypeConverter != null)
                    {
                        return(value = xfExtendedTypeConverter.ConvertFromInvariantString(str, serviceProvider));
                    }
                    if (xfTypeConverter != null)
                    {
                        return(value = xfTypeConverter.ConvertFromInvariantString(str));
                    }
                    var converterType = converter?.GetType();
                    if (converterType != null)
                    {
                        var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
                                                                                        new[] { typeof(string) });
                        if (convertFromStringInvariant != null)
                        {
                            return(value = convertFromStringInvariant.Invoke(converter, new object[] { str }));
                        }
                    }
                }

                var ignoreCase = (serviceProvider?.GetService(typeof(IConverterOptions)) as IConverterOptions)?.IgnoreCase ?? false;

                //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
                if (toType.GetTypeInfo().IsGenericType&& toType.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    toType = Nullable.GetUnderlyingType(toType);
                }

                //Obvious Built-in conversions
                if (toType.GetTypeInfo().IsEnum)
                {
                    return(Enum.Parse(toType, str, ignoreCase));
                }

                if (toType == typeof(SByte))
                {
                    return(SByte.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Int16))
                {
                    return(Int16.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Int32))
                {
                    return(Int32.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Int64))
                {
                    return(Int64.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Byte))
                {
                    return(Byte.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(UInt16))
                {
                    return(UInt16.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(UInt32))
                {
                    return(UInt32.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(UInt64))
                {
                    return(UInt64.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Single))
                {
                    return(Single.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Double))
                {
                    return(Double.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Boolean))
                {
                    return(Boolean.Parse(str));
                }
                if (toType == typeof(TimeSpan))
                {
                    return(TimeSpan.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(DateTime))
                {
                    return(DateTime.Parse(str, CultureInfo.InvariantCulture));
                }
                if (toType == typeof(Char))
                {
                    char c = '\0';
                    _ = Char.TryParse(str, out c);
                    return(c);
                }
                if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
                {
                    return(str.Substring(2));
                }
                if (toType == typeof(String))
                {
                    return(value);
                }
                if (toType == typeof(Decimal))
                {
                    return(Decimal.Parse(str, CultureInfo.InvariantCulture));
                }
            }

            //if the value is not assignable and there's an implicit conversion, convert
            if (value != null && !toType.IsAssignableFrom(value.GetType()))
            {
                var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
                                 ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);

                if (opImplicit != null)
                {
                    value = opImplicit.Invoke(null, new[] { value });
                    return(value);
                }
            }

            return(value);
        }
示例#4
0
 public short GetInt16(string name)
 {
     return(Int16.Parse(Values[name]));
 }
示例#5
0
        private void urunGoruntule(int rowNumber, string[] jsonProducts)
        {
            string[] p_id     = new string[rowNumber];
            string[] p_name   = new string[rowNumber];
            string[] p_cat    = new string[rowNumber];
            string[] p_price  = new string[rowNumber];
            string[] p_imgsrc = new string[rowNumber];
            string[] p_desc   = new string[rowNumber];
            for (int i = 0; i < rowNumber; i++)
            {
                JsonService app = JsonConvert.DeserializeObject <JsonService>(jsonProducts[i]);
                Console.WriteLine(i.ToString());
                p_id[i]     = app.p_id;
                p_name[i]   = app.p_name;
                p_cat[i]    = app.p_cat;
                p_price[i]  = app.p_price.ToString();
                p_imgsrc[i] = app.p_imgsrc;
                p_desc[i]   = app.p_desc;
            }
            Console.WriteLine("Last:" + p_id.Last().ToString());

            Grid grid = new Grid();

            grid.RowSpacing    = 10;
            grid.ColumnSpacing = 10;
            int font = 0;

            if (DeviceDisplay.MainDisplayInfo.Width < 1080)//Timer çak
            {
                font = 18;
            }
            else
            {
                font = 22;
            }

            for (int i = 0; i != rowNumber; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = 100
                });
            }

            grid.ColumnDefinitions.Add(new ColumnDefinition {
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
            });

            for (int i = 0; i != rowNumber; i++)
            {
                p_price[i] = p_price[i].Replace('.', ',');
                var imgBtn = new ImageButton {
                    WidthRequest = 128, HeightRequest = 128, BorderColor = Color.Transparent, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.Transparent, Source = "http://littlep.xyz/" + p_imgsrc[i]
                };
                var label = new Label {
                    Text = p_name[i] + Environment.NewLine + p_desc[i], FontSize = font, HorizontalTextAlignment = TextAlignment.Start, VerticalTextAlignment = TextAlignment.Center
                };
                var btn = new Button {
                    ClassId = i.ToString(), StyleId = i.ToString(), Text = p_price[i] + " TL", FontSize = font, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End                   /* HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.End*/
                };
                btn.Command = new Command(() =>
                {
                    DisplayAlert(p_name[Int16.Parse(btn.ClassId)], p_desc[Int16.Parse(btn.ClassId)], p_price[Int16.Parse(btn.ClassId)].ToString());
                });
                //                       col,row
                grid.Children.Add(imgBtn, 0, i);
                grid.Children.Add(label, 1, i);
                grid.Children.Add(btn, 2, i);
                Grid.SetColumnSpan(label, 4);
                Grid.SetColumnSpan(btn, 4);
            }

            ScrollView scv = new ScrollView()
            {
                Content = grid
            };

            Content = scv;
        }
示例#6
0
        //
        public HttpResponseMessage Geteqiw_r_getRTree(string year, string include, string stcode, string Level)
        {
            string result = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(year))
                {
                    result = rule.JsonStr("error", "缺少结束日期", "");
                }
                else if (string.IsNullOrEmpty(stcode))
                {
                    result = rule.JsonStr("error", "缺少城市代码", "");
                }
                else if (string.IsNullOrEmpty(Level))
                {
                    result = rule.JsonStr("error", "缺少断面级别", "");
                }
                else
                {
                    RuletblEQIW_R_Section     rule_section = new RuletblEQIW_R_Section();
                    IList <tblEQIW_R_Section> list         = rule_section.GetRCodeBySTCodeByRole(stcode, Int32.Parse(year), Int16.Parse(Level), Int32.Parse(include), 1);
                    List <tbleqiw_r_rcode>    rcodelist    = new List <tbleqiw_r_rcode>();
                    if (list != null && list.Count > 0)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            tbleqiw_r_rcode tbl = new tbleqiw_r_rcode();
                            tbl.rcode = list[i].fldRCode;
                            tbl.rname = list[i].fldRName;
                            rcodelist.Add(tbl);
                        }
                    }
                    if (list != null && list.Count > 0)
                    {
                        result = rule.JsonStr("ok", "", list);
                    }
                    else
                    {
                        result = rule.JsonStr("nodata", "没有河流数据", "");
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        /// <summary>
        /// Returns an object for parsing
        /// and adding to a list of parameters for data access.
        /// </summary>
        /// <param name="node">The <see cref="System.Xml.XPath.IXPathNavigable"/> to query.</param>
        /// <param name="setQuery">The XPath <see cref="System.String"/>.</param>
        /// <param name="throwException">When <code>true</code>, throw an exception for null nodes and nodes that do not parse into the specified type.</param>
        /// <param name="defaultValue">Return a boxing <see cref="System.Object"/> for “zero-length” text nodes.</param>
        /// <param name="nsMan">
        /// The <see cref="System.Xml.XmlNamespaceManager"/>
        /// to use to resolve prefixes.
        /// </param>
        /// <typeparam name="T">The type to parse from the node value.</typeparam>
        public static object GetNodeValueAndParse <T>(IXPathNavigable node, string setQuery, bool throwException, T defaultValue, XmlNamespaceManager nsMan)
        {
            string errMsg = null;

            T stronglyT = default(T);

            object p = GetNodeValue(node, setQuery, throwException, nsMan);

            try
            {
                if (p == null)
                {
                    p = defaultValue;
                }
                else if (string.IsNullOrEmpty(p.ToString().Trim()))
                {
                    p = defaultValue;
                }
                else if (stronglyT is bool)
                {
                    p = bool.Parse(p.ToString());
                }
                else if (stronglyT is Byte)
                {
                    p = Byte.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is DateTime)
                {
                    p = DateTime.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is Decimal)
                {
                    p = Decimal.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is Double)
                {
                    p = Double.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is Int16)
                {
                    p = Int16.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is Int32)
                {
                    p = Int32.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (stronglyT is Int64)
                {
                    p = Int64.Parse(p.ToString(), CultureInfo.CurrentCulture);
                }
                else if (typeof(T).IsAssignableFrom(typeof(string)))
                {
                    p = p.ToString();
                }
                else
                {
                    Type t = typeof(T);
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "The specified type, “{0},” is not supported.", t.FullName));
                }
            }
            catch (Exception ex)
            {
                Type t = typeof(T);
                errMsg = string.Format(CultureInfo.CurrentCulture, "Parse for “{0}” fails for element in “{1}.” Value to parse: “{2}.” Default Message: “{3}.”",
                                       t.FullName, setQuery, (p == null) ? "Null" : p.ToString(), ex.Message);
                throw new XmlException(errMsg);
            }

            return(p);
        }
        private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (tipo.Equals('N'))
                {
                    CheckControls(tabPage2);
                    if (contT == 0)
                    {
                        vaciarCamposBusquedas();
                        Modelo.CondicionesPago c = new Modelo.CondicionesPago();
                        c.codigo      = Int16.Parse(CodigoC.Text);
                        c.descripcion = DescripcionC.Text;
                        c.dias        = Int16.Parse(DiasC.Text);
                        c.anticipo    = AnticipoC.Checked;
                        c.porcentaje  = decimal.Parse(PorcentajeC.Text);
                        Object item = s.guardarPagos(c);

                        System.Reflection.PropertyInfo m = item.GetType().GetProperty("message");
                        System.Reflection.PropertyInfo a = item.GetType().GetProperty("code");
                        String message = (String)(m.GetValue(item, null));
                        int    code    = (int)(a.GetValue(item, null));

                        if (code == 1)
                        {
                            ResetControls(tabPage2);
                            DisableControls(tabPage2);
                            tipo = 's';
                            Recarga();
                            this.tabControl1.SelectTab(0);
                            MessageBox.Show(message, "OK", MessageBoxButtons.OK, MessageBoxIcon.None);
                        }
                        else if (code == 2)
                        {
                            MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Se deben de llenar todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    contT = 0;
                }
                else if (tipo.Equals('E'))
                {
                    CheckControls(tabPage2);
                    if (contT == 0)
                    {
                        Modelo.CondicionesPago c = new Modelo.CondicionesPago();
                        c.codigo      = Int16.Parse(CodigoC.Text);
                        c.descripcion = DescripcionC.Text;
                        c.dias        = Int16.Parse(DiasC.Text);
                        c.anticipo    = AnticipoC.Checked;
                        c.porcentaje  = decimal.Parse(PorcentajeC.Text);

                        Object item = s.editarPagos(c);

                        System.Reflection.PropertyInfo m = item.GetType().GetProperty("message");
                        System.Reflection.PropertyInfo a = item.GetType().GetProperty("code");
                        String message = (String)(m.GetValue(item, null));
                        int    code    = (int)(a.GetValue(item, null));

                        if (code == 1)
                        {
                            ResetControls(tabPage2);
                            DisableControls(tabPage2);
                            tipo = 's';
                            Recarga();
                            MessageBox.Show(message, "OK", MessageBoxButtons.OK, MessageBoxIcon.None);
                        }
                        else if (code == 2)
                        {
                            MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        contT = 0;
                    }
                }
                else if (tipo.Equals('s'))
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public ActionResult Kaydet_Lig(List <string> values, int id)
        {
            for (int i = 0; i < values.Count; i += 3)
            {
                try
                {
                    if (BP_DatabaseEntities.Turnuva.Find(id).turnuvaCesidi == "lig")
                    {
                        if (BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1 != null && BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2 != null)
                        {
                            if (BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1 > BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2)
                            {
                                BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).pts -= 3;
                            }
                            else if (BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1 < BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2)
                            {
                                BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).pts -= 3;
                            }
                            else
                            {
                                BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).pts -= 1;
                                BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).pts -= 1;
                            }
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).avg -= Convert.ToInt32(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1) - Convert.ToInt32(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2);
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).avg -= Convert.ToInt32(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2) - Convert.ToInt32(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1);
                        }

                        BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor1 = Int16.Parse(values[i]);
                        BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).skor2 = Int16.Parse(values[i + 1]);
                        if (Int16.Parse(values[i]) > Int16.Parse(values[i + 1]))
                        {
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).pts += 3;
                        }
                        else if (Int16.Parse(values[i]) < Int16.Parse(values[i + 1]))
                        {
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).pts += 3;
                        }
                        else
                        {
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).pts += 1;
                            BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).pts += 1;
                        }
                        BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID1).avg += Int16.Parse(values[i]) - Int16.Parse(values[i + 1]);
                        BP_DatabaseEntities.Takim.Find(BP_DatabaseEntities.Match.Find(Int16.Parse(values[i + 2])).takimID2).avg += Int16.Parse(values[i + 1]) - Int16.Parse(values[i]);
                    }
                }
                catch { }
            }

            BP_DatabaseEntities.SaveChanges();
            return(RedirectToAction("Yonet", "Home", new { id = id }));
        }
示例#10
0
        public void searchListManagementItem()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog         = new ExecutionLog();
            var loginHelper          = new LoginHelper(GetWebDriver());
            var listManagementHelper = new ListManagementHelper(GetWebDriver());

            // Variable
            var    name   = "Test" + GetRandomNumber();
            var    name2  = "Testlist" + GetRandomNumber();
            var    Id     = "12345" + GetRandomNumber();
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("SearchListManagementItem", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("SearchListManagementItem", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("SearchListManagementItem", "Redirect To List Management page");
                listManagementHelper.ClickElement("Marketing");
                listManagementHelper.WaitForWorkAround(4000);

                executionLog.Log("SearchListManagementItem", "Redirect To List Management page");
                GetWebDriver().Navigate().GoToUrl("https://www.pegasus-test.com/en/listmanagements/clients");
                listManagementHelper.WaitForWorkAround(2000);

                executionLog.Log("SearchListManagementItem", "Click on Create list");
                listManagementHelper.ClickForce("Create");
                listManagementHelper.WaitForWorkAround(1000);

                executionLog.Log("SearchListManagementItem", "Name the list");
                listManagementHelper.TypeText("ListName", name);

                executionLog.Log("SearchListManagementItem", "Click on Create button");
                listManagementHelper.ClickElement("Createbuttn");
                listManagementHelper.WaitForWorkAround(1000);

                executionLog.Log("SearchListManagementItem", "Search the list name");
                listManagementHelper.TypeText("SearchList", name);

                executionLog.Log("SearchListManagementItem", "verify the list name");
                String listname = listManagementHelper.GetText("//ul[@id='listManagerGroup']/li/p");

                executionLog.Log("SearchListManagementItem", "verify the list name");
                Assert.AreEqual(listname, name);
                Console.WriteLine("List Rename successfull");

                //executionLog.Log("SearchListManagementItem", "Click on list");
                //listManagementHelper.ClickElement("Firstlist");
                //listManagementHelper.WaitForWorkAround(1000);

                //executionLog.Log("SearchListManagementItem", "Rename the list");
                //listManagementHelper.TypeText("Name", name2);

                //executionLog.Log("SearchListManagementItem", "Click on Back button");
                //listManagementHelper.ClickElement("Backbutton");
                //listManagementHelper.WaitForWorkAround(1000);

                //executionLog.Log("SearchListManagementItem", "Search the list name");
                //listManagementHelper.TypeText("SearchList", name2);

                //executionLog.Log("SearchListManagementItem", "verify the list name");
                //String listname = listManagementHelper.GetText("//ul[@id='listManagerGroup']/li/p");

                //executionLog.Log("SearchListManagementItem", "verify the list name");
                //Assert.AreEqual(listname, name2);
                //Console.WriteLine("List Rename successfull");

                //executionLog.Log("SearchListManagementItem", "Delete List");
                //listManagementHelper.MouseOver("//ul[@id='listManagerGroup']/li/p");
                //listManagementHelper.WaitForWorkAround(2000);

                //executionLog.Log("SearchListManagementItem", "Delete List");
                //listManagementHelper.ClickElement("DeleteList");

                //executionLog.Log("SearchListManagementItem", "Click on Delete button");
                //listManagementHelper.ClickElement("Deletebuttn");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("SearchListManagementItem");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Search List Management Item");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Search List Management Item", "Bug", "Medium", "Equipment page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Rename ListManagement Item");
                        TakeScreenshot("SearchListManagementItem");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\SearchListManagementItem.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("SearchListManagementItem");
                        string id            = loginHelper.getIssueID("Search List Management Item");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\SearchListManagementItem.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Search List Management Item"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Search List Management Item");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("SearchListManagementItem");
                executionLog.WriteInExcel("Search List Management Item", Status, JIRA, "List Management");
            }
        }
示例#11
0
    public static List <ICommand> parse(string script)
    {
        List <ICommand> commands            = new List <ICommand>();
        bool            textBlock           = false;
        bool            prompt              = false;
        PromptCommand   currentPrompt       = null;
        string          currentChoice       = null;
        string          currentConsequences = "";

        foreach (string line in script.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
        {
            if (!string.IsNullOrEmpty(line.Trim()))
            {
                string[] lineData = line.Trim().Split('|');
                if (textBlock)
                {
                    if (lineData[0].Equals("[end]"))
                    {
                        textBlock = false;
                    }
                    else
                    {
                        commands.Add(new TextCommand(lineData[0]));
                    }
                }
                else if (prompt)
                {
                    if (currentPrompt == null)
                    {
                        currentPrompt = new PromptCommand();
                    }
                    if (currentChoice == null)
                    {
                        if (lineData[0].Equals("[end]"))
                        {
                            commands.Add(currentPrompt);
                            currentPrompt = null;
                            prompt        = false;
                        }
                        else
                        {
                            currentChoice = lineData[0];
                        }
                    }
                    else
                    {
                        if (lineData[0].Equals("[end]"))
                        {
                            currentPrompt.addConsequences(currentChoice, parse(currentConsequences));
                            currentConsequences = "";
                            currentChoice       = null;
                        }
                        else
                        {
                            currentConsequences += line + "\r\n";
                        }
                    }
                }
                else
                {
                    Command command;
                    try {
                        command = (Command)(Enum.Parse(typeof(Command), lineData[0].ToUpper()));
                    } catch (ArgumentException e) {
                        throw new ArgumentException("Invalid command: " + lineData[0]);
                    }
                    switch (command)
                    {
                    case Command.SPEAKER:
                        commands.Add(new SpeakerCommand(lineData[1]));
                        break;

                    case Command.TEXT:
                        commands.Add(new TextCommand(lineData[1]));
                        break;

                    case Command.SPEAKERTEXT:
                        commands.Add(new SpeakerCommand(lineData[1]));
                        commands.Add(new TextCommand(lineData[2]));
                        break;

                    case Command.TEXTBLOCK:
                        textBlock = true;
                        break;

                    case Command.PORTRAIT:
                        commands.Add(new PortraitCommand(lineData[1], lineData[2][0] /*, lineData[3][0]*/));
                        break;

                    case Command.BACKGROUND:
                        commands.Add(new BackgroundCommand(lineData[1]));
                        break;

                    case Command.LINK:
                        commands.Add(new LinkCommand(lineData[1]));
                        break;

                    case Command.ADDPOINTS:
                        commands.Add(new AddPointsCommand(lineData[1], Int16.Parse(lineData[2])));
                        break;

                    case Command.PROMPT:
                        prompt = true;
                        break;

                    case Command.DATECHECK:
                        commands.Add(new DateCheckCommand(lineData[1]));
                        break;

                    case Command.FINALCHECK:
                        commands.Add(new FinalCheckCommand());
                        break;
                    }
                }
            }
        }

        return(commands);
    }
示例#12
0
        private static List <Position> ParsePositions(Byte[] byteBuffer, int linesNB, out int index)
        {
            index  = 0;
            index += 7;
            uint dataSize = byteBuffer[index];

            index++;
            uint codecID = byteBuffer[index];

            if (codecID == CODEC_FMXXX)
            {
                index++;
                uint numberOfData = byteBuffer[index];

                Console.WriteLine("{0} {1} {2} ", codecID, numberOfData, dataSize);

                List <Position> result = new List <Position>();

                index++;
                for (int i = 0; i < numberOfData; i++)
                {
                    Position position = new Position();

                    var timestamp = Int64.Parse(Parsebytes(byteBuffer, index, 8), System.Globalization.NumberStyles.HexNumber);
                    index += 8;

                    position.Time = DateTime.Now;

                    var Preority = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                    index++;

                    position.Lo = Int32.Parse(Parsebytes(byteBuffer, index, 4), System.Globalization.NumberStyles.HexNumber) / 10000000.0;
                    index      += 4;

                    position.La = Int32.Parse(Parsebytes(byteBuffer, index, 4), System.Globalization.NumberStyles.HexNumber) / 10000000.0;
                    index      += 4;

                    var Altitude = Int16.Parse(Parsebytes(byteBuffer, index, 2), System.Globalization.NumberStyles.HexNumber);
                    index += 2;

                    var dir = Int16.Parse(Parsebytes(byteBuffer, index, 2), System.Globalization.NumberStyles.HexNumber);

                    if (dir < 90)
                    {
                        position.Direction = 1;
                    }
                    else if (dir == 90)
                    {
                        position.Direction = 2;
                    }
                    else if (dir < 180)
                    {
                        position.Direction = 3;
                    }
                    else if (dir == 180)
                    {
                        position.Direction = 4;
                    }
                    else if (dir < 270)
                    {
                        position.Direction = 5;
                    }
                    else if (dir == 270)
                    {
                        position.Direction = 6;
                    }
                    else if (dir > 270)
                    {
                        position.Direction = 7;
                    }
                    index += 2;

                    var Satellite = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                    index++;

                    if (Satellite >= 3)
                    {
                        position.Status = "A";
                    }
                    else
                    {
                        position.Status = "L";
                    }

                    position.Speed = Int16.Parse(Parsebytes(byteBuffer, index, 2), System.Globalization.NumberStyles.HexNumber);
                    index         += 2;

                    int ioEvent = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                    index++;
                    int ioCount = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                    index++;
                    //read 1 byte
                    {
                        int cnt = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                        index++;
                        for (int j = 0; j < cnt; j++)
                        {
                            int id = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                            index++;
                            //Add output status
                            switch (id)
                            {
                            case ACC:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                position.Status += value == 1 ? ",ACC off" : ",ACC on";
                                index++;
                                break;
                            }

                            case DOOR:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                position.Status += value == 1 ? ",door close" : ",door open";
                                index++;
                                break;
                            }

                            case GSM:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                position.Status += string.Format(",GSM {0}", value);
                                index++;
                                break;
                            }

                            case STOP:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                position.StopFlag = value == 1;
                                position.IsStop   = value == 1;

                                index++;
                                break;
                            }

                            case IMMOBILIZER:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                position.Alarm = value == 0 ? "Activate Anti-carjacking success" : "Emergency release success";
                                index++;
                                break;
                            }

                            case GREEDRIVING:
                            {
                                var value = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                                switch (value)
                                {
                                case 1:
                                {
                                    position.Alarm = "Acceleration intense !!";
                                    break;
                                }

                                case 2:
                                {
                                    position.Alarm = "Freinage brusque !!";
                                    break;
                                }

                                case 3:
                                {
                                    position.Alarm = "Virage serré !!";
                                    break;
                                }

                                default:
                                    break;
                                }
                                index++;
                                break;
                            }

                            default:
                            {
                                index++;
                                break;
                            }
                            }
                        }
                    }

                    //read 2 byte
                    {
                        int cnt = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                        index++;
                        for (int j = 0; j < cnt; j++)
                        {
                            int id = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                            index++;



                            switch (id)
                            {
                            case Analog:
                            {
                                var value = Int16.Parse(Parsebytes(byteBuffer, index, 2), System.Globalization.NumberStyles.HexNumber);
                                if (value < 12)
                                {
                                    position.Alarm += string.Format("Low voltage", value);
                                }
                                index += 2;
                                break;
                            }

                            case SPEED:
                            {
                                var value = Int16.Parse(Parsebytes(byteBuffer, index, 2), System.Globalization.NumberStyles.HexNumber);
                                position.Alarm += string.Format("Speed", value);
                                index          += 2;
                                break;
                            }

                            default:
                            {
                                index += 2;
                                break;
                            }
                            }
                        }
                    }

                    //read 4 byte
                    {
                        int cnt = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                        index++;
                        for (int j = 0; j < cnt; j++)
                        {
                            int id = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                            index++;

                            switch (id)
                            {
                            case TEMPERATURE:
                            {
                                var value = Int32.Parse(Parsebytes(byteBuffer, index, 4), System.Globalization.NumberStyles.HexNumber);
                                position.Alarm += string.Format("Temperature {0}", value);
                                index          += 4;
                                break;
                            }

                            case ODOMETER:
                            {
                                var value = Int32.Parse(Parsebytes(byteBuffer, index, 4), System.Globalization.NumberStyles.HexNumber);
                                position.Mileage = value;
                                index           += 4;
                                break;
                            }

                            default:
                            {
                                index += 4;
                                break;
                            }
                            }
                        }
                    }

                    //read 8 byte
                    {
                        int cnt = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                        index++;
                        for (int j = 0; j < cnt; j++)
                        {
                            int id = byte.Parse(Parsebytes(byteBuffer, index, 1), System.Globalization.NumberStyles.HexNumber);
                            index++;

                            var io = Int64.Parse(Parsebytes(byteBuffer, index, 8), System.Globalization.NumberStyles.HexNumber);
                            position.Status += string.Format(",{0} {1}", id, io);
                            index           += 8;
                        }
                    }

                    result.Add(position);
                    Console.WriteLine(position.ToString());
                }

                return(result);
            }
            return(null);
        }
示例#13
0
        static void Main(string[] args)
        {
            string brokers_first_name;
            string brokers_last_name;
            string brokers_city;

            Console.WriteLine("Enter broker first name: ");
            brokers_first_name = Console.ReadLine();

            Console.WriteLine("Enter broker last name: ");
            brokers_last_name = Console.ReadLine();

            Console.WriteLine("Enter broker company id: ");
            string brokers_company_id = Console.ReadLine();
            int    brokers_comp_id    = Int16.Parse(brokers_company_id);

            Console.WriteLine("Enter broker city: ");
            brokers_city = Console.ReadLine();

            DataBaseControls dataBaseControls = new DataBaseControls();

            dataBaseControls.AddToTheDatabase(brokers_first_name, brokers_last_name, brokers_comp_id, brokers_city);



            ////Reading the database
            //ModelCodeFirst context = new ModelCodeFirst();
            //foreach (var broker in context.brokers)
            //{
            //Console.WriteLine(broker.name);
            //}
            //context.brokers.Find(1);



            ////Writing to Database
            //var company = new Company() { id = 4, name = "FDM" };
            //ModelCodeFirst context = new ModelCodeFirst();
            //context.companies.Add(company);
            //context.SaveChanges();



            ////Writing to Database
            //var broker = new Broker() { first_name = "John", last_name = "Hurst", companyId = 1, city = "Londons" };
            //ModelCodeFirst context = new ModelCodeFirst();
            //context.brokers.Add(broker);
            //context.SaveChanges(); //Persists changes to database



            ////Updating the database
            //ModelCodeFirst context = new ModelCodeFirst();
            //var broker = context.brokers.Find(10);
            //broker.city = "London";
            //context.SaveChanges();



            ////Read from the database
            //ModelCodeFirst context = new ModelCodeFirst();
            //Console.WriteLine(context.brokers.Find(5).first_name);

            ////Delete from database
            //ModelCodeFirst context = new ModelCodeFirst();
            //var brokers = context.brokers.Where(b => b.companyId == 1);

            //foreach (var broker in brokers)
            //{
            //context.brokers.Remove(broker);
            //}
            //context.SaveChanges();



            //ModelCodeFirst context = new ModelCodeFirst();
            //var query = (from b in context.brokers
            //             where b.city == "London"
            //             select b);

            //foreach (var broker in query)
            //{
            //    Console.WriteLine("{0} {1}", broker.first_name, broker.last_name);
            //}
        }
示例#14
0
 public void chooseLevel(string levelNum)
 {
     pc.levelUpdater(Int16.Parse(levelNum));
     Resume();
 }
        protected void UpdateProduct_Click(object sender, EventArgs e)
        {
            //if (Page.IsValid)
            //{
            //W/o validation controls, this command won't work!
            //Any other logical validation for your data goes here.
            //Ex. Assume the foreign keys SupplierID and CategoryID are required.
            if (SupplierList.SelectedIndex == 0)
            {
                errormsgs.Add("Select a supplier.");
            }
            //else
            if (CategoryList.SelectedIndex == 0)
            {
                //Would only capture 1 error at a time through the logical items.
                //But if done indiv and add the error message to the list, can test that list to see if we got through all logical validation.
                errormsgs.Add("Select a category.");
            }

            //On the update, you must have the pkey of the record that is being processed.
            if (string.IsNullOrEmpty(ProductID.Text.Trim()))
            {
                errormsgs.Add("Search for the product you wish to maintain.");
            }
            //Check if all logical validation was successful.
            if (errormsgs.Count() > 0)
            {
                //Means we failed; some bad validation.
                LoadMessageDisplay(errormsgs, "alert alert-info");
            }
            else
            {
                //Assume your validation is successful and you can proceed with adding the data to the db.
                try
                {
                    //Create an instance of your <T>
                    Product item = new Product();
                    //Extract data from form and load your instance of <T>

                    //In addition to the non-PKey fields being accessed and loaded, the pkey value MUST also be loaded.
                    item.ProductID = int.Parse(ProductID.Text.Trim());

                    item.ProductName     = ProductName.Text.Trim();
                    item.SupplierID      = int.Parse(SupplierList.SelectedValue);
                    item.CategoryID      = int.Parse(CategoryList.SelectedValue);
                    item.QuantityPerUnit = string.IsNullOrEmpty(QuantityPerUnit.Text.Trim()) ? null : QuantityPerUnit.Text.Trim();
                    if (string.IsNullOrEmpty(UnitPrice.Text.Trim()))
                    {
                        item.UnitPrice = null;
                    }
                    else
                    {
                        item.UnitPrice = decimal.Parse(UnitPrice.Text.Trim());
                    }
                    if (string.IsNullOrEmpty(UnitsInStock.Text.Trim()))
                    {
                        item.UnitsInStock = null;
                    }
                    else
                    {
                        item.UnitsInStock = Int16.Parse(UnitsInStock.Text.Trim());
                    }
                    if (string.IsNullOrEmpty(UnitsOnOrder.Text.Trim()))
                    {
                        item.UnitsOnOrder = null;
                    }
                    else
                    {
                        item.UnitsOnOrder = Int16.Parse(UnitsOnOrder.Text.Trim());
                    }

                    //During an update, you need to take the ACTUAL value that is in the field
                    item.Discontinued = Discontinued.Checked;
                    //Connect to the appropriate BLL controller for <T>
                    ProductController sysmgr = new ProductController();
                    //Issue the appropriate BLL controller method to process <T>
                    int rowsaffected = sysmgr.Product_Update(item);
                    //Process any returning information from the controller method and issue a success message.
                    //Did the db REALLY get updated?
                    if (rowsaffected == 0)
                    {
                        errormsgs.Add(ProductName.Text + " has not been updated. Search for the product again.");
                        LoadMessageDisplay(errormsgs, "alert alert-warning");
                        BindProductList();
                    }
                    else
                    {
                        errormsgs.Add(ProductName.Text + " has been updated.");
                        LoadMessageDisplay(errormsgs, "alert alert-success");
                        BindProductList();
                        ProductList.SelectedValue = ProductID.Text;
                    }
                }
                catch (DbUpdateException ex)
                {
                    UpdateException updateException = (UpdateException)ex.InnerException;
                    if (updateException.InnerException != null)
                    {
                        errormsgs.Add(updateException.InnerException.Message.ToString());
                    }
                    else
                    {
                        errormsgs.Add(updateException.Message);
                    }
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
                catch (DbEntityValidationException ex)
                {
                    foreach (var entityValidationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in entityValidationErrors.ValidationErrors)
                        {
                            errormsgs.Add(validationError.ErrorMessage);
                        }
                    }
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
                catch (Exception ex)
                {
                    errormsgs.Add(GetInnerException(ex).ToString());
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
            }
        }
示例#16
0
 public override object FromStringValue(string xml)
 {
     return(Int16.Parse(xml));
 }
示例#17
0
 private void btnCrearTienda_Click(object sender, EventArgs e)
 {
     try
     {
         TiendaDAO tiendaPorNombre = new TiendaDAO();
         Tienda    ti = tiendaPorNombre.buscaTiendaPorNombre(txtNombreTienda.Text.Trim().ToUpper());
         if (validaCampos() == true)
         {
             if (ti != null)
             {
                 MessageBox.Show("Error: La tienda ya se encuentra ingresada.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtNombreTienda.Text = "";
                 txtNombreTienda.Focus();
                 return;
             }
             else
             {
                 try
                 {
                     long      x           = long.Parse(objetoPaso.paso0);         //id
                     TiendaDAO editaTienda = new TiendaDAO();
                     editaTienda.EditarTienda(x, txtNombreTienda.Text.Trim().ToUpper(), txtDireccionTienda.Text, txtTelefonoTienda.Text, dtFechaIngresoTienda.Value, txtNombreEmpresa.Text, Int16.Parse(cmbCiudad.SelectedValue.ToString()));
                     MessageBox.Show("Modificación de tienda exitosa.");
                     objetoPaso.paso0 = (String)(0.ToString());
                     PortadaMantenedorTienda tiendaView = new PortadaMantenedorTienda();
                     tiendaView.cargaTiendas();
                     this.Visible = false;
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("Error al modificar la tienda.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error de sistema al editar la tienda.");
     }
 }
        public void SetMonitors(bool result)
        {
            lock (locker)
            {
                MonitorTemplates deserializedFeed = null;
                try
                {
                    if (!lmViewModelsDefault.Equals(lmViewModels))
                    {
                        lmViewModels = new SyncList <LiveMonitorViewModel>(lmViewModelsDefault);
                    }

                    foreach (LiveMonitorViewModel lv in lmViewModels)
                    {
                        lv.liveOddsPage = 1000;
                    }

                    string number    = StationRepository.StationNumber;
                    string templates = WsdlRepository.GetContentManagementData(StationRepository.StationNumber);
                    deserializedFeed = JsonConvert.DeserializeObject <MonitorTemplates>(templates);

                    var screens = Screen.AllScreens.Where(s => !s.Primary).ToList();
                    for (int i = 0; i < ChangeTracker.LiveMonitors.Count; i++)
                    {
                        string index = screens[i].DeviceName.Substring(screens[i].DeviceName.Length - 1, 1);
                        lmViewModels[i].LiveOddsVisibility = Visibility.Collapsed;

                        lmViewModels[i].HeaderTextVisibility = Visibility.Collapsed;
                        lmViewModels[i].BannerVisibility     = Visibility.Collapsed;
                        lmViewModels[i].rotating             = false;
                        lmViewModels[i].rotationInterval     = 10;
                        lmViewModels[i].MonitorWidth         = screens[i].WorkingArea.Width;
                        lmViewModels[i].MonitorHeight        = screens[i].WorkingArea.Height;

                        MonitorTemplate temp = deserializedFeed.monitorTemplates.Where(x => x.monitorPosition == index).FirstOrDefault();
                        if (temp == null)
                        {
                            Mediator.SendMessage(i + "|" + Visibility.Collapsed.ToString(), MsgTag.ChangeVisibility);

                            Dispatcher.Invoke(() =>
                            {
                                if (!lmViewModels[i].IsClosed)
                                {
                                    lmViewModels[i].ViewWindow.Visibility = Visibility.Visible;
                                }
                            });
                            lmViewModels[i].HeaderTextVisibility = Visibility.Collapsed;
                            lmViewModels[i].BannerVisibility     = Visibility.Collapsed;
                            lmViewModels[i].rotating             = false;
                            lmViewModels[i].rotationInterval     = 10;
                            lmViewModels[i].MonitorWidth         = screens[i].WorkingArea.Width;
                            lmViewModels[i].MonitorHeight        = screens[i].WorkingArea.Height;

                            lmViewModels[i].LiveOddsRow        = 0;
                            lmViewModels[i].LiveOddsVisibility = Visibility.Visible;
                            lmViewModels[i].LiveOddsHeight     = screens[i].WorkingArea.Height;
                            lmViewModels[i].liveOddsPage       = i + 1001;
                        }
                        else
                        {
                            string            templateId = temp.templateId;
                            AvailableTemplate template   = deserializedFeed.availableTemplates.Where(x => x.templateId == templateId).FirstOrDefault();
                            if (template != null)
                            {
                                for (int y = 0; y < template.content.Count(); y++)
                                {
                                    string type = template.content.ElementAt(y).contentType;
                                    if (type == "VFL")
                                    {
                                        Dispatcher.Invoke(() =>
                                        {
                                            if (!lmViewModels[i].IsClosed)
                                            {
                                                lmViewModels[i].ViewWindow.Visibility = Visibility.Collapsed;
                                            }
                                        });

                                        Mediator.SendMessage(i + "|" + Visibility.Visible.ToString(), MsgTag.ChangeVisibility);

                                        Mediator.SendMessage(i + "|" + SetVFLAddress(screens[i], 0), MsgTag.SetUpBrowser);
                                    }
                                    else if (type == "VHC")
                                    {
                                        Dispatcher.Invoke(() =>
                                        {
                                            if (!lmViewModels[i].IsClosed)
                                            {
                                                lmViewModels[i].ViewWindow.Visibility = Visibility.Collapsed;
                                            }
                                        });

                                        Mediator.SendMessage(i + "|" + Visibility.Visible.ToString(),
                                                             MsgTag.ChangeVisibility);
                                        Mediator.SendMessage(i + "|" + SetVHCAddress(screens[i]), MsgTag.SetUpBrowser);
                                    }
                                    else
                                    {
                                        Mediator.SendMessage(i + "|" + Visibility.Collapsed.ToString(), MsgTag.ChangeVisibility);


                                        Dispatcher.Invoke(() =>
                                        {
                                            if (!lmViewModels[i].IsClosed)
                                            {
                                                lmViewModels[i].ViewWindow.Visibility = Visibility.Visible;
                                            }
                                        });
                                        //lmViewModels[i].HeaderTextVisibility = Visibility.Collapsed;
                                        //lmViewModels[i].BannerVisibility = Visibility.Collapsed;
                                        //lmViewModels[i].rotating = false;
                                        //lmViewModels[i].rotationInterval = 10;
                                        //lmViewModels[i].MonitorWidth = screens[i].WorkingArea.Width;
                                        //lmViewModels[i].MonitorHeight = screens[i].WorkingArea.Height;

                                        if (type == "HEADER_TEXT")
                                        {
                                            lmViewModels[i].HeaderRow            = y;
                                            lmViewModels[i].HeaderTextVisibility = Visibility.Visible;
                                            double dd  = Int64.Parse(template.content.ElementAt(y).size);
                                            double sc  = screens[i].WorkingArea.Height;
                                            double res = dd * sc / 100;
                                            lmViewModels[i].HeaderTextHeight = res;
                                            lmViewModels[i].HeaderText       = template.content.ElementAt(y).data;
                                        }
                                        else if (type == "LIVE_ODDS")
                                        {
                                            lmViewModels[i].LiveOddsRow        = y;
                                            lmViewModels[i].LiveOddsVisibility = Visibility.Visible;
                                            double desiredHeight = Int64.Parse(template.content.ElementAt(y).size) *
                                                                   screens[i].WorkingArea.Height / 100;
                                            ;
                                            if (desiredHeight != lmViewModels[i].LiveOddsHeight)
                                            {
                                                Dispatcher.Invoke(() =>
                                                {
                                                    LiveMonitorsCollectionList[i].Clear();
                                                });

                                                lmViewModels[i].LiveOddsHeight = desiredHeight;
                                            }

                                            if (template.content.ElementAt(y).data.ToLowerInvariant().Contains("page"))
                                            {
                                                string page =
                                                    template.content.ElementAt(y)
                                                    .data.Substring(template.content.ElementAt(y).data.Length - 1, 1);
                                                lmViewModels[i].liveOddsPage     = Int16.Parse(page);
                                                lmViewModels[i].rotating         = false;
                                                lmViewModels[i].rotationInterval = 10;
                                            }
                                            else if (
                                                template.content.ElementAt(y)
                                                .data.ToLowerInvariant()
                                                .Contains("rotating"))
                                            {
                                                //if(!lmViewModels[i].rotating)
                                                //    LiveMonitorRotationCounters[i] = 0;

                                                lmViewModels[i].rotating         = true;
                                                lmViewModels[i].rotationInterval =
                                                    Int16.Parse(template.content.ElementAt(y).additParams);
                                            }
                                        }
                                        else if (type == "BANNER")
                                        {
                                            double dd  = Int64.Parse(template.content.ElementAt(y).size);
                                            double sc  = screens[i].WorkingArea.Height;
                                            double res = dd * sc / 100;

                                            lmViewModels[i].BannerRow        = y;
                                            lmViewModels[i].BannerVisibility = Visibility.Visible;
                                            lmViewModels[i].BannerHeight     = res;
                                            lmViewModels[i].BannerLink       = template.content.ElementAt(y).data;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    LiveMonitorViewModel vm         = lmViewModels.Where(x => x.liveOddsPage != 1000).FirstOrDefault();
                    LiveMonitorViewModel vmRotating = lmViewModels.Where(x => x.rotating).FirstOrDefault();
                    if (vm != null || vmRotating != null)
                    {
                        lmViewModels = new SyncList <LiveMonitorViewModel>(lmViewModels.OrderBy(x => x.liveOddsPage).ToList());
                        LiveMonitorHeights.Clear();
                        for (int i = 0; i < lmViewModels.Count; i++)
                        {
                            LiveMonitorHeights.Add(lmViewModels[i].LiveOddsHeight);
                            lmViewModels[i].MatchesCollection = LiveMonitorsCollectionList[i];
                        }
                    }
                    else
                    {
                        ResetMonitorsHeight();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
示例#19
0
    /*****************
    ** read_comfile **
    ******************
    ** Read the command file.  Set global parameters as
    ** specified.  This routine assumes that the command file
    ** is already open.
    */
    private static void read_comfile(StreamReader cfile)
    {
        String inbuf;

        String eptr;             /* Offset to "=" sign */
        /* markples: now the value half of the key=value pair */

        int eIndex;      /* markples: now this is the "=" offset */

        PF i;            /* Index */

        /*
        ** Sit in a big loop, reading a line from the file at each
        ** pass.  Terminate on EOF.
        */
        while ((inbuf = cfile.ReadLine()) != null)
        {
            /*
            ** Parse up to the "=" sign.  If we don't find an
            ** "=", then flag an error.
            */
            if ((eIndex = inbuf.IndexOf('=')) == -1)
            {
                Console.WriteLine("**COMMAND FILE ERROR at LINE:");
                Console.WriteLine(" " + inbuf);
                goto skipswitch;        /* A GOTO!!!! */
            }

            /*
            ** Insert a null where the "=" was, then convert
            ** the substring to uppercase.  That will enable
            ** us to perform the match.
            */
            String name = inbuf.Substring(0, eIndex);
            eptr = inbuf.Substring(eIndex + 1);
            name = name.ToUpper();
            i    = PF.MAXPARAM;
            do
            {
                if (name == s_paramnames[(int)i])
                {
                    break;
                }
            } while (--i >= 0);

            if (i < 0)
            {
                Console.WriteLine("**COMMAND FILE ERROR -- UNKNOWN PARAM: "
                                  + name);
                goto skipswitch;
            }

            /*
            ** Advance eptr to the next field...which should be
            ** the value assigned to the parameter.
            */
            switch (i)
            {
            case PF.GMTICKS:            /* GLOBALMINTICKS */
                global.min_ticks = Int64.Parse(eptr);
                break;

            case PF.MINSECONDS:         /* MINSECONDS */
                global.min_secs = Int32.Parse(eptr);
                SetRequestSecs();
                break;

            case PF.ALLSTATS:           /* ALLSTATS */
                global.allstats = getflag(eptr);
                break;

            case PF.OUTFILE:            /* OUTFILE */
                global.ofile_name = eptr;
                try
                {
                    global.ofile         = File.AppendText(global.ofile_name);
                    global.write_to_file = true;

                    /*
                    ** Open the output file.
                    */
                }
                catch (IOException)
                {
                    Console.WriteLine("**Error opening output file: {0}", global.ofile_name);
                    global.write_to_file = false;
                }
                break;

            case PF.CUSTOMRUN:          /* CUSTOMRUN */
                global.custrun = getflag(eptr);
                for (i = 0; (int)i < s_tests.Length; i++)
                {
                    s_tests[(int)i].bRunTest = !global.custrun;
                }
                break;

            case PF.DONUM:              /* DONUMSORT */
                global.numsortstruct_jagged.bRunTest   =
                    global.numsortstruct_rect.bRunTest = getflag(eptr);
                break;

            case PF.NUMNUMA:            /* NUMNUMARRAYS */
                global.numsortstruct_rect.numarrays   = Int16.Parse(eptr);
                global.numsortstruct_jagged.numarrays = global.numsortstruct_rect.numarrays;
                global.numsortstruct_jagged.adjust    =
                    global.numsortstruct_rect.adjust  = 1;
                break;

            case PF.NUMASIZE:           /* NUMARRAYSIZE */
                global.numsortstruct_rect.arraysize   = Int32.Parse(eptr);
                global.numsortstruct_jagged.arraysize = global.numsortstruct_rect.arraysize;
                break;

            case PF.NUMMINS:            /* NUMMINSECONDS */
                global.numsortstruct_rect.request_secs   = Int32.Parse(eptr);
                global.numsortstruct_jagged.request_secs = global.numsortstruct_rect.request_secs;
                break;

            case PF.DOSTR:              /* DOSTRINGSORT */
                global.strsortstruct.bRunTest = getflag(eptr);
                break;

            case PF.STRASIZE:           /* STRARRAYSIZE */
                global.strsortstruct.arraysize = Int32.Parse(eptr);
                break;

            case PF.NUMSTRA:            /* NUMSTRARRAYS */
                global.strsortstruct.numarrays = Int16.Parse(eptr);
                global.strsortstruct.adjust    = 1;
                break;

            case PF.STRMINS:            /* STRMINSECONDS */
                global.strsortstruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.DOBITF:     /* DOBITFIELD */
                global.bitopstruct.bRunTest = getflag(eptr);
                break;

            case PF.NUMBITOPS:          /* NUMBITOPS */
                global.bitopstruct.bitoparraysize = Int32.Parse(eptr);
                global.bitopstruct.adjust         = 1;
                break;

            case PF.BITFSIZE:           /* BITFIELDSIZE */
                global.bitopstruct.bitfieldarraysize = Int32.Parse(eptr);
                break;

            case PF.BITMINS:            /* BITMINSECONDS */
                global.bitopstruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.DOEMF:              /* DOEMF */
                global.emfloatstruct_struct.bRunTest    =
                    global.emfloatstruct_class.bRunTest = getflag(eptr);
                break;

            case PF.EMFASIZE:           /* EMFARRAYSIZE */
                global.emfloatstruct_class.arraysize  = Int32.Parse(eptr);
                global.emfloatstruct_struct.arraysize = global.emfloatstruct_class.arraysize;
                break;

            case PF.EMFLOOPS:           /* EMFLOOPS */
                global.emfloatstruct_class.loops = Int32.Parse(eptr);
                break;

            case PF.EMFMINS:            /* EMFMINSECOND */
                global.emfloatstruct_class.request_secs  = Int32.Parse(eptr);
                global.emfloatstruct_struct.request_secs = global.emfloatstruct_class.request_secs;
                break;

            case PF.DOFOUR:     /* DOFOUR */
                global.fourierstruct.bRunTest = getflag(eptr);
                break;

            case PF.FOURASIZE:          /* FOURASIZE */
                global.fourierstruct.arraysize = Int32.Parse(eptr);
                global.fourierstruct.adjust    = 1;
                break;

            case PF.FOURMINS:           /* FOURMINSECONDS */
                global.fourierstruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.DOASSIGN:           /* DOASSIGN */
                global.assignstruct_jagged.bRunTest   =
                    global.assignstruct_rect.bRunTest = getflag(eptr);
                break;

            case PF.AARRAYS:            /* ASSIGNARRAYS */
                global.assignstruct_rect.numarrays   = Int16.Parse(eptr);
                global.assignstruct_jagged.numarrays = global.assignstruct_rect.numarrays;
                break;

            case PF.ASSIGNMINS:         /* ASSIGNMINSECONDS */
                global.assignstruct_rect.request_secs   = Int32.Parse(eptr);
                global.assignstruct_jagged.request_secs = global.assignstruct_rect.request_secs;
                break;

            case PF.DOIDEA:     /* DOIDEA */
                global.ideastruct.bRunTest = getflag(eptr);
                break;

            case PF.IDEAASIZE:          /* IDEAARRAYSIZE */
                global.ideastruct.arraysize = Int32.Parse(eptr);
                break;

            case PF.IDEALOOPS:          /* IDEALOOPS */
                global.ideastruct.loops = Int32.Parse(eptr);
                break;

            case PF.IDEAMINS:           /* IDEAMINSECONDS */
                global.ideastruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.DOHUFF:     /* DOHUFF */
                global.huffstruct.bRunTest = getflag(eptr);
                break;

            case PF.HUFFASIZE:          /* HUFFARRAYSIZE */
                global.huffstruct.arraysize = Int32.Parse(eptr);
                break;

            case PF.HUFFLOOPS:          /* HUFFLOOPS */
                global.huffstruct.loops  = Int32.Parse(eptr);
                global.huffstruct.adjust = 1;
                break;

            case PF.HUFFMINS:           /* HUFFMINSECONDS */
                global.huffstruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.DONNET:     /* DONNET */
                global.nnetstruct_jagged.bRunTest   =
                    global.nnetstruct_rect.bRunTest = getflag(eptr);
                break;

            case PF.NNETLOOPS:          /* NNETLOOPS */
                global.nnetstruct_rect.loops      = Int32.Parse(eptr);
                global.nnetstruct_jagged.loops    = global.nnetstruct_rect.loops;
                global.nnetstruct_jagged.adjust   =
                    global.nnetstruct_rect.adjust = 1;
                break;

            case PF.NNETMINS:           /* NNETMINSECONDS */
                global.nnetstruct_rect.request_secs   = Int32.Parse(eptr);
                global.nnetstruct_jagged.request_secs = global.nnetstruct_rect.request_secs;
                break;

            case PF.DOLU:               /* DOLU */
                global.lustruct.bRunTest = getflag(eptr);
                break;

            case PF.LUNARRAYS:          /* LUNUMARRAYS */
                global.lustruct.numarrays = Int32.Parse(eptr);
                global.lustruct.adjust    = 1;
                break;

            case PF.LUMINS:     /* LUMINSECONDS */
                global.lustruct.request_secs = Int32.Parse(eptr);
                break;

            case PF.ALIGN:              /* ALIGN */
                global.align = Int32.Parse(eptr);
                break;

            case PF.DONUMJAGGED:              /* DONUMSORTJAGGED */
                global.numsortstruct_jagged.bRunTest = getflag(eptr);
                break;

            case PF.DONUMRECT:              /* DONUMSORTRECT */
                global.numsortstruct_rect.bRunTest = getflag(eptr);
                break;

            case PF.DOEMFSTRUCT:              /* DOEMFSTRUCT */
                global.emfloatstruct_struct.bRunTest = getflag(eptr);
                break;

            case PF.DOEMFCLASS:              /* DOEMFCLASS */
                global.emfloatstruct_class.bRunTest = getflag(eptr);
                break;

            case PF.DOASSIGNJAGGED:           /* DOASSIGNJAGGED */
                global.assignstruct_jagged.bRunTest = getflag(eptr);
                break;

            case PF.DOASSIGNRECT:           /* DOASSIGNRECT */
                global.assignstruct_rect.bRunTest = getflag(eptr);
                break;

            case PF.DONNETJAGGED:     /* DONNETJAGGED */
                global.nnetstruct_jagged.bRunTest = getflag(eptr);
                break;

            case PF.DONNETRECT:     /* DONNETRECT */
                global.nnetstruct_rect.bRunTest = getflag(eptr);
                break;
            }
skipswitch:
            continue;
        }       /* End while */

        return;
    }
        public void verifyCreatedIframeOnPartnerAssociationPage()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var integration_IframeAppsHelper = new Integration_IframeAppsHelper(GetWebDriver());

            // Variable
            var tab = "tab" + RandomNumber(111, 999);

            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Redirect at admin page");
                VisitOffice("admin");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Redirect at iframe apps page.");
                VisitOffice("iframes");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify page title.");
                VerifyTitle("Iframe Apps");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", " Click On Create button.");
                integration_IframeAppsHelper.ClickElement("Create");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify page title.");
                VerifyTitle("Create Iframe");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on Save button.");
                integration_IframeAppsHelper.ClickElement("Save");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for mandatoryness.");
                integration_IframeAppsHelper.VerifyText("TabNameErr", "This field is required.");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for mandatoryness.");
                integration_IframeAppsHelper.VerifyText("UserNameErr", "This field is required.");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for mandatoryness.");
                integration_IframeAppsHelper.VerifyText("PasswrdErr", "This field is required.");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for mandatoryness.");
                integration_IframeAppsHelper.VerifyText("URLErr", "This field is required.");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on cancel button.");
                integration_IframeAppsHelper.ClickElement("Cancel");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title.");
                VerifyTitle("Iframe Apps");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", " Click On Create button.");
                integration_IframeAppsHelper.ClickElement("Create");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify page title.");
                VerifyTitle("Create Iframe");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter Tab Name");
                integration_IframeAppsHelper.TypeText("TabName", tab);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter user Name");
                integration_IframeAppsHelper.TypeText("UserNameInputFieldName", "User");
                integration_IframeAppsHelper.WaitForWorkAround(4000);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter Password");
                integration_IframeAppsHelper.TypeText("PasswordInputFieldNmae", "1qaz!QAZ");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter an invalid alphabetical url.");
                integration_IframeAppsHelper.TypeText("LoginURL", "sadada");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for invalid url.");
                integration_IframeAppsHelper.VerifyText("URLErr2", "Invalid URL");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter an invalid numerical url.");
                integration_IframeAppsHelper.TypeText("LoginURL", "12222");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for invalid url.");
                integration_IframeAppsHelper.VerifyText("URLErr2", "Invalid URL");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter an invalid web address.");
                integration_IframeAppsHelper.TypeText("LoginURL", "www.google.com");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify validation for invalid url.");
                integration_IframeAppsHelper.VerifyText("URLErr2", "Invalid URL");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter a valid Login Url");
                integration_IframeAppsHelper.TypeText("LoginURL", _office + "login");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on partner portal check box.");
                integration_IframeAppsHelper.ClickElement("PartnerPortal");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on Save button");
                integration_IframeAppsHelper.ClickElement("Save");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for creation success text.");
                integration_IframeAppsHelper.WaitForText("Iframe created successfully.", 10);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Logout from the application.");
                VisitOffice("logout");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Login with valid username and password");
                Login("qa.association", "1qaz!QAZ");
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);
                integration_IframeAppsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title.");
                VerifyTitle("QA Association - Details");

                var loc = "//span[text()='" + tab + "']";
                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for locator to be present.");
                integration_IframeAppsHelper.WaitForElementPresent(loc, 10);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify created iframe present in partner association portal.");
                integration_IframeAppsHelper.IsElementPresent(loc);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Logout fron the partner portal.");
                VisitOffice("logout");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Redirect at office admin.");
                VisitOffice("admin");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Redirect at iframe apps page.");
                VisitOffice("iframes");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter iframe name to be searched.");
                integration_IframeAppsHelper.TypeText("SearchTabName", tab);
                integration_IframeAppsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on edit icon.");
                integration_IframeAppsHelper.ClickElement("Edit");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title.");
                VerifyTitle("Edit Iframe");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Uncheck the partner portal check box.");
                integration_IframeAppsHelper.ClickElement("PartnerPortal");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on Save button.");
                integration_IframeAppsHelper.ClickElement("Save");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for iframe updation success text.");
                integration_IframeAppsHelper.WaitForText("Iframe updated Successfully.", 10);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Logout from the application.");
                VisitOffice("logout");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Login with valid username and password");
                Login("qa.association", "1qaz!QAZ");
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);
                integration_IframeAppsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title.");
                VerifyTitle("QA Association - Details");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for locator to be present.");
                integration_IframeAppsHelper.WaitForElementPresent(loc, 10);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify created iframe not present in partner association portal.");
                integration_IframeAppsHelper.ElementNotAvailable(loc);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Logout from partner association portal.");
                VisitOffice("logout");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Redirect at iframe apps page.");
                VisitOffice("iframes");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Verify page title.");
                VerifyTitle("Iframe Apps");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Enter iframe name to  be searched.");
                integration_IframeAppsHelper.TypeText("SearchTabName", tab);
                integration_IframeAppsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click on delete button.");
                integration_IframeAppsHelper.ClickElement("ClickOnDelete");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Click ok to accept alert message.");
                integration_IframeAppsHelper.AcceptAlert();

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for deletion success message.");
                integration_IframeAppsHelper.WaitForText("Iframe deleted successfully.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyCreatedIframeOnPartnerAssociationPage");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Created Iframe On Partner Association Page");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Created Iframe On Partner Association Page", "Bug", "Medium", "Iframe Intergration page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Verify Created Iframe On Partner Association Page");
                        TakeScreenshot("VerifyCreatedIframeOnPartnerAssociationPage");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyCreatedIframeOnPartnerAssociationPage.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyCreatedIframeOnPartnerAssociationPage");
                        string id            = loginHelper.getIssueID("Verify Created Iframe On Partner Association Page");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyCreatedIframeOnPartnerAssociationPage.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Created Iframe On Partner Association Page"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Created Iframe On Partner Association Page");
                //     executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyCreatedIframeOnPartnerAssociationPage");
                executionLog.WriteInExcel("Verify Created Iframe On Partner Association Page", Status, JIRA, "IFrame");
            }
        }
示例#21
0
        public static long Solution()
        {
            string rawString  = @"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48";
            var    numberGrid = rawString.Split('\n').Select(x => Array.ConvertAll(x.Split(' '), c => Int16.Parse(c))).ToArray();

            return((long)LargestProductInCell(numberGrid).Max());
        }
示例#22
0
        public static void EmailTemplateInfo()
        {
            bool status = false;

            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

                using (SqlConnection sqlConnection = new SqlConnection(connectionString))
                {
                    sqlConnection.Open();
                    Console.WriteLine("Successfully connected to the SQL server.");

                    var emailTemplateInfos = GetEmailTemplateInfo(sqlConnection);

                    foreach (var library in emailTemplateInfos)
                    {
                        string        listTo    = library.To;
                        string        listCC    = library.Cc;
                        string        from      = library.From;
                        string        subject   = library.Subject;
                        string        fromPWD   = library.FromPWD;
                        string        emailBody = library.BodyHeader;
                        string[]      indexes   = library.Index.Split(',');
                        List <string> days      = library.AlertinDays.Split(',').ToList();

                        foreach (var day in days)
                        {
                            int d = Int16.Parse(day);
                            subject = string.Format(library.Subject, day);

                            string sql1 = "Select " + library.Index + " from " + library.SqlViewName + " Where [Expiry Date] = '" + (DateTime.Today.AddDays(d)).ToString() + "'";


                            library.BodyFooter = string.Format(library.BodyFooter);

                            emailBody = string.Format(library.BodyHeader, d);


                            SqlCommand cmd1 = new SqlCommand(sql1, sqlConnection);
                            // List<LibraryIndexes> libraryIndexes1 = new List<LibraryIndexes>();

                            try
                            {
                                Console.WriteLine("Documents related to each library were selected.");
                                SqlDataReader reader1;
                                reader1 = cmd1.ExecuteReader();
                                DataTable dt = new DataTable();
                                dt.Load(reader1);
                                Console.WriteLine("Loading executing data");
                                int numRows = dt.Rows.Count;
                                int ix      = 0;

                                foreach (DataRow ind in dt.Rows)
                                {
                                    ix++;
                                    emailBody += "<table border=0>";
                                    List <string> values = new List <string>();
                                    int           iy     = 0;
                                    foreach (string index in indexes)
                                    {
                                        String Info = index.Replace("[", "").Replace("]", "");
                                        emailBody += "<tr><td width = '200px'>" + Info + "</td>" +
                                                     "<td width='100px'>" + Convert.ToString(ind.ItemArray[iy]) + "</td>" +
                                                     "</tr>";
                                        iy++;
                                    }
                                    Console.WriteLine("The email body is set as the document " + ix);



                                    emailBody += "</table ></br></br>";


                                    if (numRows == ix)
                                    {
                                        emailBody += library.BodyFooter;

                                        status = SendEmail(listTo
                                                           , listCC
                                                           , subject
                                                           , emailBody
                                                           , from
                                                           , fromPWD);
                                        string success = string.Format(@"Successfully send Email. Library Name : {0} To : {1} Cc : {2} Subject : {3} "
                                                                       , library.LibraryName, library.To, library.Cc, subject
                                                                       );
                                        bool text = true;
                                        Print("EmailTemplateInfo", success, text);

                                        Console.WriteLine("Email send to the relevent parties of " + library.LibraryName);
                                        Console.WriteLine(" ");
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Error : " + e);
                                Console.ReadLine();

                                string success = string.Format(@"Email Send Failed. Library Name : {0}  To : {1}  Cc : {2}  Error : {3}"
                                                               , library.LibraryName, library.To, library.Cc, e
                                                               );
                                bool text = false;
                                Print("EmailTemplateInfo", success, text);
                            }
                        }
                    }
                }
                Console.ReadLine();
                return;
            }

            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex);
                bool text = false;
                Print("EmailTemplateInfo", "Error : " + ex, text);
                return;
            }
        }
        public static string getKey(string seedTXT, string appKeyTXT)
        {
            Int32 result;

            string[] seed   = { seedTXT.Substring(0, 2), seedTXT.Substring(2, 2), seedTXT.Substring(4, 2), seedTXT.Substring(6, 2) };
            string[] appKey = { appKeyTXT.Substring(0, 2), appKeyTXT.Substring(2, 2) };

            // secrets
            int[] sec_1 = { 0xB2, 0x3F, 0xAA };
            int[] sec_2 = { 0xB1, 0x02, 0xAB };

            // Compute each 16b part of the response
            Int32 res_msb = transform(Int16.Parse(appKey[0] + appKey[1], System.Globalization.NumberStyles.HexNumber), sec_1) | transform(Int16.Parse(seed[0] + seed[3], System.Globalization.NumberStyles.HexNumber), sec_2);
            Int32 res_lsb = transform(Int16.Parse(seed[1] + seed[2], System.Globalization.NumberStyles.HexNumber), sec_1) | transform(res_msb, sec_2);

            result = (res_msb << 16) | res_lsb;

            return(result.ToString("X8"));
        }
示例#24
0
        /// <summary>
        /// Returns a parsers for the String value using the given built-in class for parsing.
        /// </summary>
        /// <param name="type">is the type to parse the value to</param>
        /// <returns>value matching the type passed in</returns>
        public static SimpleTypeParser GetParser(Type type)
        {
            Type typeBoxed = TypeHelper.GetBoxedType(type);

            if (typeBoxed == typeof(string))
            {
                return(value => value);
            }
            if (typeBoxed == typeof(char?))
            {
                return(value => value[0]);
            }
            if (typeBoxed == typeof(bool?))
            {
                return(value => Boolean.Parse(value));
            }
            if (typeBoxed == typeof(Guid?))
            {
                return(value => new Guid(value));
            }

            // -- Integers
            if (typeBoxed == typeof(byte?))
            {
                return(delegate(String value) {
                    value = value.Trim();
                    if (value.StartsWith("0x"))
                    {
                        return Byte.Parse(value.Substring(2), NumberStyles.HexNumber);
                    }

                    return Byte.Parse(value.Trim());
                });
            }
            if (typeBoxed == typeof(sbyte?))
            {
                return(value => SByte.Parse(value.Trim()));
            }
            if (typeBoxed == typeof(short?))
            {
                return(value => Int16.Parse(value));
            }
            if (typeBoxed == typeof(ushort?))
            {
                return(value => UInt16.Parse(value));
            }
            if (typeBoxed == typeof(int?))
            {
                return(value => Int32.Parse(value));
            }
            if (typeBoxed == typeof(uint?))
            {
                return(value => UInt32.Parse(value));
            }
            if (typeBoxed == typeof(long?))
            {
                return(delegate(String value)
                {
                    value = value.TrimEnd('l', 'L', ' ');
                    return Int64.Parse(value);
                });
            }
            if (typeBoxed == typeof(ulong?))
            {
                return(delegate(String value)
                {
                    value = value.TrimEnd('l', 'L', ' ');
                    return UInt64.Parse(value);
                });
            }

            // -- Floating Point
            if (typeBoxed == typeof(float?))
            {
                return(delegate(String value)
                {
                    value = value.TrimEnd('f', 'F', ' ');
                    return Single.Parse(value);
                });
            }
            if (typeBoxed == typeof(double?))
            {
                return(delegate(String value)
                {
                    value = value.TrimEnd('f', 'F', 'd', 'D', ' ');
                    return Double.Parse(value);
                });
            }
            if (typeBoxed == typeof(decimal?))
            {
                return(delegate(String value)
                {
                    value = value.TrimEnd('f', 'F', 'd', 'D', 'M', 'm', ' ');
                    return Decimal.Parse(value);
                });
            }

            var untyped = Nullable.GetUnderlyingType(typeBoxed);

            if ((untyped != null) && untyped.IsEnum)
            {
                return(value => Enum.Parse(untyped, value, true));
            }

            return(null);
        }
示例#25
0
        public void adminTicketCategoryURLChange()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");

            // Initializing the objects
            var executionLog             = new ExecutionLog();
            var loginHelper              = new LoginHelper(GetWebDriver());
            var tickets_MasterDataHelper = new Tickets_MasterDataHelper(GetWebDriver());


            // Variable
            var    FirstName = "Test" + GetRandomNumber();
            var    LastName  = "Tester" + GetRandomNumber();
            var    Number    = "12345678" + GetRandomNumber();
            String JIRA      = "";
            String Status    = "Pass";

            try
            {
                executionLog.Log("AdminTicketCategoryURLChange", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("AdminTicketCategoryURLChange", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("AdminTicketCategoryURLChange", "Go to tickets >> Master Data >> Categories");
                VisitOffice("tickets/masterdata/category");
                tickets_MasterDataHelper.WaitForWorkAround(5000);

                executionLog.Log("AdminTicketCategoryURLChange", "Click On any Ticket Category");
                tickets_MasterDataHelper.ClickElement("ClickOnAyTicketCategory");
                tickets_MasterDataHelper.WaitForWorkAround(5000);

                executionLog.Log("AdminTicketCategoryURLChange", "Change the url of the page.");
                VisitOffice("tickets/masterdata/edit/category/18");
                tickets_MasterDataHelper.WaitForWorkAround(4000);

                executionLog.Log("AdminTicketCategoryURLChange", "Verify Validation message.");
                // tickets_MasterDataHelper.WaitForText("You don't have privilege.", 20);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("AdminTicketCategoryURLChange");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Ticket Category URL Change");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Ticket Category URL Change", "Bug", "Medium", "Admin Tickets", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Ticket Category URL Change");
                        TakeScreenshot("AdminTicketCategoryURLChange");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminTicketCategoryURLChange.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("AdminTicketCategoryURLChange");
                        string id            = loginHelper.getIssueID("Ticket Category URL Change");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminTicketCategoryURLChange.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Ticket Category URL Change"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Ticket Category URL Change");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("AdminTicketCategoryURLChange");
                executionLog.WriteInExcel("Ticket Category URL Change", Status, JIRA, "Admin Tickets");
            }
        }
示例#26
0
        static void Main(string[] args)
        {
            #region Settings
            Config settings = new Config();
            settings.server = "127.0.0.1";
            if (args.Length == 6 || args.Length == 8)
            {
                for (int i = 0; i <= args.Length / 2; i += 2)
                {
                    string s = args[i];
                    switch (s)
                    {
                    case "-user":
                        settings.user = args[i + 1];
                        break;

                    case "-pass":
                        settings.password = args[i + 1];
                        break;

                    case "-slot":
                        settings.char_slot = Int16.Parse(args[i + 1]) - 1;
                        break;

                    case "-server":
                        settings.server = args[i + 1];
                        break;
                    }
                    Console.WriteLine("[Cfg] {0:G}:{1:G}", args[i].TrimStart('-'), args[i + 1]);
                }
            }
            else if (File.Exists("config.cfg"))
            {
                string line;
                System.IO.StreamReader cfg = new System.IO.StreamReader("config.cfg");
                while ((line = cfg.ReadLine()) != null)
                {
                    string[] setting = line.Split(":");
                    switch (setting[0])
                    {
                    case "username":
                        settings.user = setting[1];
                        break;

                    case "password":
                        settings.password = setting[1];
                        setting[1]        = "********";
                        break;

                    case "char_slot":
                        settings.char_slot = Int16.Parse(setting[1]) - 1;
                        break;

                    case "server":
                        settings.server = setting[1];
                        break;
                    }
                    Console.WriteLine("[Cfg]{0:G}:{1:G}", setting[0], setting[1]);
                }
            }
            else
            {
                Console.WriteLine("[Cfg]No login information provided, Move config file into folder with exe or add launch args with -user user -pass pass -slot #");
                Exit();
            }
            if (settings.user == null)
            {
                Console.WriteLine("[Cfg]No username set");
                Console.Write("Enter a username:"******"[Cfg]No password set");
                Console.Write("Enter a password:");
                settings.password = Console.ReadLine();
            }
            #endregion
            User = new Client(settings, false, true);
            User.Login();
            Thread.Sleep(100);
            User.Logout();
            Exit();
        }
        protected void CompanyList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (CompanyList.SelectedValue != null && CompanyList.SelectedValue != string.Empty)
            {
                base.LCurr.CompanyId = Int32.Parse(CompanyList.SelectedValue);
            }
            else
            {
                base.LCurr.CompanyId = 0;
            }
            ProjectList.Items.Clear(); Session.Remove("ProjectList"); ProjectList.DataSource = GetProjectList(); ProjectList.DataBind();
            ListItem li = null;

            li = ProjectList.Items.FindByValue(base.LCurr.ProjectId.ToString());
            if (li != null)
            {
                ProjectList.ClearSelection(); li.Selected = true; base.LCurr.ProjectId = Int16.Parse(li.Value);
            }
            else if (ProjectList.Items.Count > 0)
            {
                ProjectList.Items[0].Selected = true;
                try
                {
                    base.LCurr.ProjectId = Int16.Parse(ProjectList.Items[0].Value);
                }
                catch { base.LCurr.ProjectId = 0; }
            }
            else
            {
                base.LCurr.ProjectId = 0;
            }
            SwitchCmpPrj();
            this.Redirect(Request.RawUrl);
        }
        protected void AddProduct_Click(object sender, EventArgs e)
        {
            //if (Page.IsValid)
            //{
            //W/o validation controls, this command won't work!
            //Any other logical validation for your data goes here.
            //Ex. Assume the foreign keys SupplierID and CategoryID are required.
            if (SupplierList.SelectedIndex == 0)
            {
                errormsgs.Add("Select a supplier.");
            }
            //else
            if (CategoryList.SelectedIndex == 0)
            {
                //Would only capture 1 error at a time through the logical items.
                //But if done indiv and add the error message to the list, can test that list to see if we got through all logical validation.
                errormsgs.Add("Select a category.");
            }

            //Check if all logical validation was successful.
            if (errormsgs.Count() > 0)
            {
                //Means we failed; some bad validation.
                LoadMessageDisplay(errormsgs, "alert alert-info");
            }
            else
            {
                //Assume your validation is successful and you can proceed with adding the data to the db.
                try
                {
                    //Create an instance of your <T>
                    Product item = new Product();
                    //Extract data from form and load your instance of <T>
                    item.ProductName     = ProductName.Text.Trim();
                    item.SupplierID      = int.Parse(SupplierList.SelectedValue);
                    item.CategoryID      = int.Parse(CategoryList.SelectedValue);
                    item.QuantityPerUnit = string.IsNullOrEmpty(QuantityPerUnit.Text.Trim()) ? null : QuantityPerUnit.Text.Trim();
                    if (string.IsNullOrEmpty(UnitPrice.Text.Trim()))
                    {
                        item.UnitPrice = null;
                    }
                    else
                    {
                        item.UnitPrice = decimal.Parse(UnitPrice.Text.Trim());
                    }
                    if (string.IsNullOrEmpty(UnitsInStock.Text.Trim()))
                    {
                        item.UnitsInStock = null;
                    }
                    else
                    {
                        item.UnitsInStock = Int16.Parse(UnitsInStock.Text.Trim());
                    }
                    if (string.IsNullOrEmpty(UnitsOnOrder.Text.Trim()))
                    {
                        item.UnitsOnOrder = null;
                    }
                    else
                    {
                        item.UnitsOnOrder = Int16.Parse(UnitsOnOrder.Text.Trim());
                    }
                    //Logically, this is a new product, NOT a discontinued product.
                    item.Discontinued = false;
                    //Connect to the appropriate BLL controller for <T>
                    ProductController sysmgr = new ProductController();
                    //Issue the appropriate BLL controller method to process <T>
                    int newProductID = sysmgr.Product_Add(item);
                    //Process any returning information from the controller method and issue a success message.
                    errormsgs.Add(ProductName.Text + " has been added to the database: ID = " + newProductID.ToString());
                    ProductID.Text = newProductID.ToString();
                    LoadMessageDisplay(errormsgs, "alert alert-success");

                    //You may need to refresh various controls on your form. In this case, the DDL.
                    BindProductList();
                    ProductList.SelectedValue = ProductID.Text; //This works as long as it's a string.
                }
                catch (DbUpdateException ex)
                {
                    UpdateException updateException = (UpdateException)ex.InnerException;
                    if (updateException.InnerException != null)
                    {
                        errormsgs.Add(updateException.InnerException.Message.ToString());
                    }
                    else
                    {
                        errormsgs.Add(updateException.Message);
                    }
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
                catch (DbEntityValidationException ex)
                {
                    foreach (var entityValidationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in entityValidationErrors.ValidationErrors)
                        {
                            errormsgs.Add(validationError.ErrorMessage);
                        }
                    }
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
                catch (Exception ex)
                {
                    errormsgs.Add(GetInnerException(ex).ToString());
                    LoadMessageDisplay(errormsgs, "alert alert-danger");
                }
            }
            //}
        }
        public void partnerReportReflectsColumnsSpecified()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");



            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var residual_income_officePayoutHelper = new ResidualIncome_OfficePayoutHelper(GetWebDriver());


            // Variable random
            String JIRA   = "";
            String Status = "Pass";

            try
            {
                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Login with valid username and password");
                Login(username[0], password[0]);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Redirect To Report Columns page");
                GetWebDriver().Navigate().GoToUrl("https://www.pegasus-test.com/newthemecorp/pegasustestoffice/rir/report_columns");
                residual_income_officePayoutHelper.WaitForWorkAround(2000);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Check Merchant ID checkbox");
                bool checkbox = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnMerchantNumber']");
                if (checkbox == false)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnMerchantNumber']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Uncheck Sales Transaction checkbox");
                bool checkbox2 = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnSalesTrans']");
                if (checkbox == true)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnSalesTrans']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Uncheck Average Ticket checkbox");
                bool checkbox3 = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnAvgTicket']");
                if (checkbox3 == true)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnAvgTicket']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Uncheck Office Income checkbox");
                bool checkbox4 = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnOfficeIncome']");
                if (checkbox4 == true)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnOfficeIncome']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Uncheck Office Adjustment checkbox");
                bool checkbox5 = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnAdjustment']");
                if (checkbox5 == true)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnAdjustment']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Uncheck Agent Revenue Share checkbox");
                bool checkbox6 = residual_income_officePayoutHelper.isChecked("//*[@id='RirOrgReportColumnRevShare']");
                if (checkbox5 == true)
                {
                    residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnRevShare']");
                }
                else
                {
                }

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Click on Save button");
                residual_income_officePayoutHelper.ClickViaJavaScript("//*[@id='RirOrgReportColumnReportColumnsForm']/div[4]/div/button");

                executionLog.Log("VerifyCreatedIframeOnPartnerAssociationPage", "Wait for creation success text.");
                residual_income_officePayoutHelper.WaitForText("Report display columns updated successfully.", 10);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Logout from the application.");
                VisitOffice("logout");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Login with valid username and password");
                Login("aslamassociate", "123456");
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);
                residual_income_officePayoutHelper.WaitForWorkAround(3000);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Redirect To Report Columns page");
                GetWebDriver().Navigate().GoToUrl("https://www.pegasus-test.com/newthemecorp/pegasustestoffice/partners/reports");
                residual_income_officePayoutHelper.WaitForWorkAround(2000);


                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Select Reporting Period");
                residual_income_officePayoutHelper.Select("ReportingPeriod", "2017-03-01");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Select File Date");
                residual_income_officePayoutHelper.Select("FileDate", "2017-03-16");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Select Processor");
                residual_income_officePayoutHelper.Select("Processor", "First Data North");
                residual_income_officePayoutHelper.WaitForWorkAround(4000);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Select File Format");
                residual_income_officePayoutHelper.Select("FileFormat", "Pegasus");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Search Payouts");
                residual_income_officePayoutHelper.ClickElement("Searchreport");
                residual_income_officePayoutHelper.WaitForWorkAround(6000);

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Reports Generated");
                residual_income_officePayoutHelper.VerifyPageText("NewThemeCorp Residual Reports");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Merchant Id");
                residual_income_officePayoutHelper.VerifyText("MerchantID", "Merchant Id");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Merchant Name");
                residual_income_officePayoutHelper.VerifyText("Merchantname", "Merchant Name");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Merchant Income");
                residual_income_officePayoutHelper.VerifyText("Merchantincome", "Merchant Income");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Merchant Expense");
                residual_income_officePayoutHelper.VerifyText("Merchantexpense", "Merchant Expense");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Sales Volume");
                residual_income_officePayoutHelper.VerifyText("Salesvol", "Sales Volume");

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Sales Transaction");
                var value = residual_income_officePayoutHelper.GetText("//div[@id='report_container']/table/thead/tr/th[6]");
                Assert.IsFalse(value.Contains("Sales Transactions"));

                executionLog.Log("PartnerReportReflectsColumnsSpecified", "Verify Payout");
                residual_income_officePayoutHelper.VerifyText("Payout", "Payout");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("PartnerReportReflectsColumnsSpecified");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("PartnerReportReflectsColumnsSpecified");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Partner Report Reflects Columns Specified", "Bug", "Medium", "Corp Employee page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Partner Report Reflects Columns Specified");
                        TakeScreenshot("PartnerReportReflectsColumnsSpecified");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\PartnerReportReflectsColumnsSpecified.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("PartnerReportReflectsColumnsSpecified");
                        string id            = loginHelper.getIssueID("Partner Report Reflects Columns Specified");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\PartnerReportReflectsColumnsSpecified.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Partner Report Reflects Columns Specified"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Partner Report Reflects Columns Specified");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("PartnerReportReflectsColumnsSpecified");
                executionLog.WriteInExcel("Partner Report Reflects Columns Specified", Status, JIRA, "Corp Employee");
            }
        }
示例#30
0
    public void Query()
    {
        DateTime s   = DateTime.Parse("2010-6-16 00:00:00");
        DateTime end = DateTime.Parse(DateTime.Now.ToString());

        if (txt_StartTime.Text.Trim() != "")
        {
            s = DateTime.Parse(txt_StartTime.Text.Trim() + " 0:00:00");
        }
        if (txt_EndTime.Text.Trim() != "")
        {
            end = DateTime.Parse(txt_EndTime.Text.Trim() + " 23:59:59");
        }
        string     strItem = "Select  distinct MonitorItem,AIName from View_MonitorItemEnd where fxdate BETWEEN '" + s + "' AND '" + end + "' ";
        DataSet    ds      = new MyDataOp(strItem).CreateDataSet();
        DataSet    ds_new  = ds.Clone();
        DataColumn dcdate  = new DataColumn("日期");

        ds_new.Tables[0].Columns.Add(dcdate);
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            DataColumn dc   = new DataColumn(dr["AIName"].ToString() + "(" + dr["MonitorItem"].ToString() + ")", typeof(Int16));
            DataColumn dcid = new DataColumn(dr["MonitorItem"].ToString());
            ds_new.Tables[0].Columns.Add(dc);
            ds_new.Tables[0].Columns.Add(dcid);
        }
        //将统计数据加入到DataSet中
        string strToday = @"SELECT SUM(N) AS Expr1, MonitorItem, fxdate " +
                          "FROM (SELECT count(MonitorItem) AS N, MonitorItem, LEFT(CONVERT(varchar, AccessDate, 120), 10) fxdate " +
                          " FROM t_MonitorItemDetail INNER JOIN" +
                          "   t_M_SampleInfor ON " +
                          " t_M_SampleInfor.id = t_MonitorItemDetail.SampleID" +
                          " WHERE (fxdate BETWEEN '" + s + "' AND '" + end + "') and t_MonitorItemDetail.flag=3  GROUP BY MonitorItem, AccessDate) a" +
                          " GROUP BY MonitorItem, fxdate" +
                          " ORDER BY fxdate, MonitorItem";
        //string strData = "Select num,itemid,cdate from t_M_EndDayInfo order by itemid,cdate";
        DataSet dsData = new MyDataOp(strToday).CreateDataSet();

        for (DateTime dt = s; dt < end;)
        {
            DataRow dr = ds_new.Tables[0].NewRow();
            dr["日期"] = dt.Date.ToString("yyyy-MM-dd");
            for (int i = 4; i < ds_new.Tables[0].Columns.Count; i = i + 2)
            {
                DataRow[] drdata = dsData.Tables[0].Select("fxdate='" + dt.Date.ToString("yyyy-MM-dd") + "' and MonitorItem='" + ds_new.Tables[0].Columns[i].ColumnName + "'");

                if (drdata.Length > 0)
                {
                    dr[i - 1] = drdata[0][0].ToString();
                }
                else
                {
                    dr[i - 1] = "0";
                }
            }

            ds_new.Tables[0].Rows.Add(dr);
            dt = dt.AddDays(1);
        }
        DataRow total = ds_new.Tables[0].NewRow();

        ds_new.Tables[0].Columns.Remove("MonitorItem");
        ds_new.Tables[0].Columns.Remove("AIName");
        ds_new.Tables[0].AcceptChanges();
        total[0] = "合计";
        for (int j = 1; j < ds_new.Tables[0].Columns.Count; j = j + 2)
        {
            if (j % 2 == 1)
            {
                object temp = ds_new.Tables[0].Compute("sum([" + ds_new.Tables[0].Columns[j].ColumnName + "])", "");
                total[j] = Int16.Parse(temp.ToString());
            }
        }
        ds_new.Tables[0].Rows.Add(total);
        if (ds_new.Tables[0].Rows.Count == 0)
        {
            //没有记录仍保留表头
            ds_new.Tables[0].Rows.Add(ds_new.Tables[0].NewRow());
            grdvw_List.DataSource = ds_new;
            grdvw_List.DataBind();
            int intColumnCount = grdvw_List.Rows[0].Cells.Count;
            grdvw_List.Rows[0].Cells.Clear();
            grdvw_List.Rows[0].Cells.Add(new TableCell());
            grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount;
        }
        else
        {
            grdvw_List.DataSource = ds_new;
            grdvw_List.DataBind();
        }
    }