Ejemplo n.º 1
0
        public bool UpdateTraveller(TravellerDetails details, GridViewUpdateEventArgs e)
        {
            List <SqlParameter> param = new List <SqlParameter>
            {
                new SqlParameter()
                {
                    ParameterName = "@CustomerName",
                    Value         = (details.gvEditorDelete.Rows[e.RowIndex].FindControl("txtTravellerName") as TextBox).Text.Trim()
                },
                new SqlParameter()
                {
                    ParameterName = "@FullName",
                    Value         = (details.gvEditorDelete.Rows[e.RowIndex].FindControl("txtFullName") as TextBox).Text.Trim()
                },
                new SqlParameter()
                {
                    ParameterName = "@Mobile",
                    Value         = (details.gvEditorDelete.Rows[e.RowIndex].FindControl("txtMobile") as TextBox).Text.Trim()
                },
                new SqlParameter()
                {
                    ParameterName = "@EmailID",
                    Value         = (details.gvEditorDelete.Rows[e.RowIndex].FindControl("txtEmailID") as TextBox).Text.Trim()
                },

                new SqlParameter()
                {
                    ParameterName = "@UserTypeId",
                    Value         = (details.gvEditorDelete.Rows[e.RowIndex].FindControl("cmbUserType") as DropDownList).SelectedValue.ToString().Trim()
                },

                new SqlParameter()
                {
                    ParameterName = "@CustomerID",
                    Value         = (Convert.ToInt32(details.gvEditorDelete.DataKeys[e.RowIndex].Value.ToString()))
                }
            };

            return(Convert.ToBoolean(DAL.spExecuteWithReturnValue("spUpdateTravellerDetails", param)));
        }
Ejemplo n.º 2
0
        private void RunIssuingTest(IssuingTestCase tc, out string doc_ID, [CallerMemberName] string callerName = "")
        {
            LoginDetails     login     = tc.Login;
            TravellerDetails traveller = tc.Traveller;
            PurchaseDetails  purchase  = tc.Purchase;
            RefundDetails    refund    = tc.Refund;

            bool loggedIn = S1.Login(login.Username, login.Password);

            Assert.IsTrue(loggedIn);
            WebDriver.WaitForElement(S1.IssuingPage.AutofillSearchButton, 10);
            //System.Threading.Thread.Sleep(3000);

            if (traveller.Autofill != null && !string.IsNullOrEmpty(traveller.Autofill.Identifier))
            {
                if (S1.IssuingPage.AddTokenButton.Visible)
                {
                    S1.IssuingPage.AddTokenButton.Click();
                    WebDriver.SwitchTo().Frame("travellerIFrame");
                    SetValue(traveller.Autofill.Identifier, S1, s1 => s1.SGPIdentifier);
                    S1.IssuingPage.SG_IDSaveButton.Click();
                    WebDriver.SwitchTo().DefaultContent();
                }
                else
                {
                    SetValue(traveller.Autofill.Identifier, S1, s1 => s1.Identifier);
                }
                if (traveller.Autofill.Identifier == traveller.Passport.Number)
                {
                    WebDriver.TabAndReturnFocusedElement();
                    if (S1.IssuingPage.AutofillSearchButton.Visible)
                    {
                        S1.IssuingPage.AutofillSearchButton.Click();
                    }
                    if (!string.IsNullOrEmpty(traveller.Passport.Country))
                    {
                        SetValue(traveller.Passport.Country.ToUpper(), S1, s1 => s1.PassportAutofillCountry);
                    }
                }

                bool autofill = S1.SearchAutofillTraveller();
                System.Threading.Thread.Sleep(3000);
                if (!autofill)
                {
                    Bitmap screenshot = WebDriver.TakeScreenshot();
                    SaveBitmap(WebDriver.TakeScreenshot(), "BasicIssuingwithAutofillTest_" + login.Username);

                    throw new AssertionException("Basic Issuing with Autofill failed for user: "******"dd/MM/yyyy");
                        //if (item.Receipt.Date == "" || DateTime.Today.Date.Subtract(Convert.ToDateTime(Convert.ToDateTime(item.Receipt.Date)
                        //    .ToString("dd/MM/yyyy"))).Days > 60)
                        //{
                        item.Receipt.Date = receiptDate;
                        //}
                    }
                    catch (Exception) { }
                    SetValue(item.Receipt.Date, currentRow, row => row.ReceiptDate);
                }

                SetValue(item.Description, currentRow, row => row.GoodsDescription);
                SetValue(item.Quantity, currentRow, row => row.Quantity);
                SetValue(item.Price, currentRow, row => row.Price);
                SetValue(item.PurchaseAmount, currentRow, row => row.PurchaseAmount);
                SetValue(item.GrossAmount, currentRow, row => row.GrossAmount);
                SetValue(item.Amount1, currentRow, row => row.Amount1);
                SetValue(item.Amount2, currentRow, row => row.Amount2);
                SetValue(item.Amount3, currentRow, row => row.Amount3);
                SetValue(item.Amount4, currentRow, row => row.Amount4);
                SetValue(item.Amount5, currentRow, row => row.Amount5);
                SetValue(item.Vat, currentRow, row => row.VAT);
            }

            SetValue(purchase.PurchaseDate, S1, s1 => s1.PurchaseDate);
            SetValue(purchase.MerchandiseDescription, S1, s1 => s1.MerchandiseDescription);
            SetValue(purchase.ShopInvoiceNumber, S1, s1 => s1.ShopInvoiceNumber);

            var    result = S1.IssueTff();
            string docid  = result.DocID;

            doc_ID = docid;

            if (string.IsNullOrEmpty(docid) && !tc.ExpectError)
            {
                SaveBitmap(result.Bitmap, callerName + "_" + tc.Login.Username);
                throw new AssertionException("Issuing TFF failed with error: " + result.ToastMsg);
            }
            else if (string.IsNullOrEmpty(docid) && tc.ExpectError)
            {
                Assert.Pass("TFF was not issued (expected behavior), with error: " + result.ToastMsg);
            }
            else
            {
                //Assert.Pass("TFF was issued successfully. DocID: " + docid);
                S1.IssuingPage.CloseButton.Click();
            }
        }