示例#1
0
        public MainPage Add(String product, String unitptice, String quantityperunit,
                            String unitsinsrock, String unitsonorder, String reorderlevel)
        {
            loginField.SendKeys("user");
            passwordField.SendKeys("user");
            passwordField.Submit();

            All_Products.Click();
            Create_new.Click();
            Product_Name.SendKeys(product);
            Product_Name.Click();

            Category_Id.Click();
            Category_Id.FindElement(By.XPath("//option[. = 'Beverages']")).Click();
            Supplier_Id.Click();
            Supplier_Id.FindElement(By.XPath("//option[. = 'Tokyo Traders']")).Click();

            Unit_Price.SendKeys(unitptice);
            Unit_Price.Click();
            QuantityPer_Unit.SendKeys(quantityperunit);
            QuantityPer_Unit.Click();
            UnitsIn_Stock.SendKeys(unitsinsrock);
            Unit_Price.Click();
            UnitsOn_Order.SendKeys(unitsonorder);
            UnitsOn_Order.Click();
            Reorder_Level.SendKeys(reorderlevel);
            Reorder_Level.Click();
            Button_OK.Click();

            return(new MainPage(driver));
        }
        protected void btn_send_Click(object sender, EventArgs e)
        {
            //CMD.Parameters.AddWithValue("@Category_Id", P_Model.Category_Id);
            //CMD.Parameters.AddWithValue("@User_Id", P_Model.User_Id);
            //CMD.Parameters.AddWithValue("@Title", P_Model.Title);
            //CMD.Parameters.AddWithValue("@Description", P_Model.Description);

            //CMD.Parameters.AddWithValue("@User_id", P_Model.User_Id);
            //CMD.Parameters.AddWithValue("@Post_TXT", P_Model.Details_lst[0].Post_TXT);
            //CMD.Parameters.AddWithValue("@Post_TypeID", (int)Post_Type.Post);
            if (string.IsNullOrEmpty(Category_Id))
            {
                AlertwithRedirect("Error", "Try Again and if this error still hapen please contact Admin", "/Pages/Default.aspx");
                return;
            }
            Post_Model Post_M_Object = new Post_Model();

            Post_M_Object.Category_Id = int.Parse(Category_Id.Trim());
            Post_M_Object.User_Id     = UserOBJ.ID;
            Post_M_Object.Title       = inputTitle.Value;
            Post_M_Object.Description = "";

            List <Post_Details_Model> PD_List  = new List <Post_Details_Model>();
            Post_Details_Model        PD_Model = new Post_Details_Model();

            PD_Model.User_Id     = UserOBJ.ID;
            PD_Model.Post_TXT    = Editor1.Content;
            PD_Model.Post_TypeID = Post_Type.Post;

            PD_List.Add(PD_Model);

            Post_M_Object.Details_lst = PD_List;

            int Res = Post.InsertPost(Post_M_Object);

            if (Res > 0)
            {
                AlertwithRedirect("Attention", "You have added new post successfully..", "/Pages/Post_View.aspx?pageindex=1&ID=" + Res);
                return;
            }
            else
            {
                Alert("Error", "Try Again and if this error still hapen please contact Admin");
                return;
            }
        }
示例#3
0
文件: Exist.cs 项目: cassie-cos/lab4
        public MainPage Exist()
        {
            loginField.SendKeys("user");
            passwordField.SendKeys("user");
            passwordField.Submit();

            All_Products.Click();
            Element.Click();

            Assert.AreEqual(Product_Name.GetAttribute("value"), "test");
            Assert.AreEqual(Category_Id.FindElement(By.CssSelector("#CategoryId > option:nth-child(2)")).GetAttribute("text"), "Beverages");
            Assert.AreEqual(Supplier_Id.FindElement(By.CssSelector("#SupplierId > option:nth-child(5)")).GetAttribute("text"), "Tokyo Traders");
            Assert.AreEqual(Unit_Price.GetAttribute("value"), "80,0000");
            Assert.AreEqual(QuantityPer_Unit.GetAttribute("value"), "30 in");
            Assert.AreEqual(UnitsIn_Stock.GetAttribute("value"), "40");
            Assert.AreEqual(UnitsOn_Order.GetAttribute("value"), "40");
            Assert.AreEqual(Reorder_Level.GetAttribute("value"), "5");

            Button_OK.Click();

            return(new MainPage(driver));
        }
        public override int GetHashCode()
        {
            int hashCode = 635632148;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + Category_Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <Category> .Default.GetHashCode(Category);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CategoryName);

            hashCode = hashCode * -1521134295 + Price.GetHashCode();
            hashCode = hashCode * -1521134295 + Discount.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description);

            hashCode = hashCode * -1521134295 + File_Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <FileStorage> .Default.GetHashCode(FileStorage);

            hashCode = hashCode * -1521134295 + EqualityComparer <ICollection <ProductCart> > .Default.GetHashCode(ProductCart);

            return(hashCode);
        }
 public override string ToString()
 {
     return($"{{{nameof(Id)}={Id.ToString()}, {nameof(Name)}={Name}, {nameof(Category_Id)}={Category_Id.ToString()}, {nameof(Category)}={Category}, {nameof(CategoryName)}={CategoryName}, {nameof(Price)}={Price.ToString()}, {nameof(Discount)}={Discount.ToString()}, {nameof(Description)}={Description}, {nameof(File_Id)}={File_Id.ToString()}, {nameof(FileStorage)}={FileStorage}, {nameof(ProductCart)}={ProductCart}}}");
 }