예제 #1
0
 public List <CM_DEV_DTO> DEVICE_Search(string index, CM_DEV_DTO filterInput)
 {
     return(procedureHelper.GetData <CM_DEV_DTO>("DEVICE_Search", new {
         INDEX = index,
         CURRENT_BRANCH = AbpSession.UserId.ToString(),
         DEVICE_CODE = filterInput.DEVICE_CODE,
         DEVICE_NAME = filterInput.DEVICE_NAME,
         BRANCH_ID = filterInput.BRANCH_ID,
         ACTIVE_STATUS = filterInput.ACTIVE_STATUS
     }));
 }
예제 #2
0
 public List <dynamic> DEVICE_Update(CM_DEV_DTO input)
 {
     input.MAKER_ID = AbpSession.UserId.ToString();
     return(procedureHelper.GetData <dynamic>("DEVICE_Update", input));
 }
 public List <dynamic> DEVICE_Update([FromBody] CM_DEV_DTO input)
 {
     return(deviceAppService.DEVICE_Update(input));
 }
예제 #4
0
        public void DeleteWithCheckData(String code)
        {
            Login();

            System.Threading.Thread.Sleep(3000);

            driver.Navigate().GoToUrl(homeURL + "/app/admin/thiet-bi");
            System.Threading.Thread.Sleep(5000);

            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(120.0));

            //Page
            IList <IWebElement> pages = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[3]/p-table/div/p-paginator/div/span")).FindElements(By.TagName("a"));
            //Retrieve from DOM

            IWebElement table = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[3]/p-table/div/div/table")).FindElement(By.TagName("tbody"));

            wait.Until(driver => table.FindElements(By.TagName("tr")));

            List <IWebElement> rows = table.FindElements(By.TagName("tr")).ToList();

            //random row
            int         index     = rows.Count / 2 + 1;
            IWebElement rowChoose = rows.ElementAt(index);

            //Get data row Web
            IList <IWebElement> fields = rowChoose.FindElements(By.TagName("td"));
            string id       = fields.ElementAt(0).Text;
            string status   = fields.ElementAt(4).Text;
            string Dep_name = fields.ElementAt(2).Text;

            //Get data from db
            CM_DEV_DTO fromDb = DataProvider.Instance.GetData <CM_DEV_DTO>("DEPARTMENT_Search", new
            {
                DEP_CODE      = id,
                DEP_NAME      = "",
                BRANCH_ID     = "",
                RECORD_STATUS = ""
            }).FirstOrDefault();

            //check Pre-execute
            Assert.AreEqual(status, fromDb.RECORD_STATUS);

            IWebElement deleteButton = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/div/button[3]"));
            //deleteButton.Click();

            string dialog = "/html/body/div";

            //IWebElement confirmDiaLog = driver.FindElement(By.XPath(dialog));
            //if (!confirmDiaLog.Displayed)
            //{
            //    Assert.Fail("Loi UI hoac Khong Chon Duoc");
            //}
            //string title = confirmDiaLog.FindElement(By.ClassName("swal-title")).Text;
            //Assert.AreEqual("Không có dữ liệu để xóa", title);
            //confirmDiaLog.FindElement(By.XPath("/html/body/div/div/div[3]/div/button")).Click();

            //Execute
            rowChoose.Click();
            string classes = rowChoose.GetAttribute("class");

            if (!classes.Contains("ui-state-highlight"))
            {
                Assert.Fail("Loi UI hoac Khong Chon Duoc");
            }

            deleteButton = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/div/button[3]"));
            deleteButton.Click();

            IWebElement confirmDiaLog = driver.FindElement(By.XPath(dialog));

            if (!confirmDiaLog.Displayed)
            {
                Assert.Fail("Loi UI hoac Khong Chon Duoc");
            }

            IWebElement confirmButton = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("/html/body/div/div/div[4]/div[2]/button")));

            confirmButton.Click();

            //result
            System.Threading.Thread.Sleep(6000);
            IWebElement resultDialog = driver.FindElement(By.XPath(dialog));
            string      title        = resultDialog.FindElement(By.ClassName("swal-title")).Text;

            //Check
            if (status == "0")
            {
                Assert.AreEqual(Dep_name + " đã bị xóa", title);
                fromDb = DataProvider.Instance.GetData <CM_DEV_DTO>("DEPARTMENT_Search", new
                {
                    DEP_CODE      = id,
                    DEP_NAME      = "",
                    BRANCH_ID     = "",
                    RECORD_STATUS = ""
                }).FirstOrDefault();
                Assert.AreEqual(fromDb.RECORD_STATUS, "0");
            }
            else
            {
                Assert.AreEqual("Xóa thành công", title);
                fromDb = DataProvider.Instance.GetData <CM_DEV_DTO>("DEPARTMENT_Search", new
                {
                    DEP_CODE      = id,
                    DEP_NAME      = "",
                    BRANCH_ID     = "",
                    RECORD_STATUS = ""
                }).FirstOrDefault();
                Assert.AreEqual(fromDb.RECORD_STATUS, "0");
            }
            driver.Close();
        }
 public List <CM_DEV_DTO> DEVICE_Search(string index, [FromBody] CM_DEV_DTO filterInput)
 {
     return(deviceAppService.DEVICE_Search(index, filterInput));
 }