Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                Category currentCategory = BLCategory.GetCategoryById(APCContext, id);
                if (currentCategory != null)
                {
                    currentCategory.Name = tbName.Text;
                    APCContext.SaveChanges();
                    MessageBox.Show("Category Details Successfully Updated");
                    ClearContent();
                }
                else
                {
                    MessageBox.Show("Category Id not found");
                }
            }
            else
            {
                MessageBox.Show("Category Id not found");
            }
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                Category currentCategory = BLCategory.GetCategoryById(APCContext, id);
                if (currentCategory != null)
                {
                    APCContext.DeleteObject(currentCategory);
                    APCContext.SaveChanges();
                    MessageBox.Show("Delete Successfully");
                    ClearContent();
                }
                else
                {
                    MessageBox.Show("Category Id not found");
                }
            }
            else
            {
                MessageBox.Show("Category Id not found");
            }
        }
Ejemplo n.º 3
0
        public JsonResult GetSubCategoryByCategory(string categoryId)
        {
            BLCategory BL = new BLCategory();
            IEnumerable <SelectListItem> SubCategory = BL.SubCategoryDDLByCategory(!string.IsNullOrEmpty(categoryId)?Convert.ToInt32(categoryId):0);

            return(Json(SubCategory));
        }
Ejemplo n.º 4
0
        private void insertInvoice_Product(Invoice invoice)
        {
            DataTable dt = (DataTable)dgInvoiceProduct.DataSource;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int     quantity      = 0;
                decimal price         = 0;
                decimal totalPrice    = 0;
                decimal serviceCharge = 0;
                bool    subCon        = false;
                string  description   = dt.Rows[i]["Description"].ToString();
                string  categoryName  = dt.Rows[i]["Name"].ToString();
                //Category selectedCategory = BLCategory.GetCategoryById(APCContext, categoryId);
                Category selectedCategory = BLCategory.GetCategoryByExactName(APCContext, categoryName);
                Kurs     selectedKurs     = BLKurs.GetKursByExactName(APCContext, dt.Rows[i]["Kurs"].ToString());
                int.TryParse(dt.Rows[i]["Quantity"].ToString(), out quantity);
                decimal.TryParse(dt.Rows[i]["Price"].ToString(), out price);
                decimal.TryParse(dt.Rows[i]["Total"].ToString(), out totalPrice);
                decimal.TryParse(dt.Rows[i]["ServiceCharge"].ToString(), out serviceCharge);
                bool.TryParse(dt.Rows[i]["SubCon"].ToString(), out subCon);

                BLInvoice_Product.insertInvoice_Product(APCContext, invoice, selectedCategory, description, quantity, dt.Rows[i]["Unit"].ToString(), price, selectedKurs, serviceCharge, totalPrice, subCon);
            }
        }
Ejemplo n.º 5
0
        private void PopulateCarousel()
        {
            List <BLCategory> categories = BLCategory.RetrieveListFromDB(connectionString);

            foreach (BLCategory category in categories)
            {
                Image image = new Image
                {
                    CssClass = "carousel-image",
                    ImageUrl = $"ImgHandler.ashx?categoryId={category.Id}"
                };
                HyperLink link = new HyperLink
                {
                    NavigateUrl = $"/Result.aspx?categoryId={category.Id}"
                };
                link.Controls.Add(image);

                Label captionLabel = new Label
                {
                    Text = $"<h3 style = 'color: #FFFFFF' > {category.Name} </ h3 >"
                };
                Panel captionPanel = new Panel {
                    CssClass = "carousel-caption"
                };
                captionPanel.Controls.Add(captionLabel);

                Panel itemPanel = new Panel {
                    CssClass = "item"
                };
                itemPanel.Controls.Add(link);
                itemPanel.Controls.Add(captionPanel);

                categoryCarousel.Controls.Add(itemPanel);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 表:BLCategory (添加一条数据
 /// </summary>
 /// <param name="bLCategory">添加的数据</param>
 /// <returns>执行成功的行数</returns>
 public static int Insert(BLCategory bLCategory)
 {
     return(DBHelp.ExecuteNonQuery(
                "insert into BLCategory values(@BLName)",
                new SqlParameter[] {
         new SqlParameter("@BLName", bLCategory.BLName)
     }));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 表:BLCategory (修改数据
 /// </summary>
 /// <param name="bLCategory">修改的数据</param>
 /// <returns>执行成功的行数</returns>
 public static int Update(BLCategory bLCategory)
 {
     return(DBHelp.ExecuteNonQuery(
                "update BLCategory set BLName=@BLName where BLID=@BLID",
                new SqlParameter[] {
         new SqlParameter("@BLName", bLCategory.BLName),
         new SqlParameter("@BLID", bLCategory.BLID),
     }));
 }
Ejemplo n.º 8
0
 private void btnInsert_Click(object sender, EventArgs e)
 {
     if (BLCategory.insertCategory(APCContext, tbName.Text))
     {
         MessageBox.Show("Category Successfully Added");
         ClearContent();
     }
     else
     {
         MessageBox.Show("Please check your input");
     }
 }
Ejemplo n.º 9
0
 private void btnSearchByName_Click(object sender, EventArgs e)
 {
     if (tbSearchValue.Text.Trim() != "")
     {
         List <Category> clientList = BLCategory.GetCategoryByName(APCContext, tbSearchValue.Text);
         dgSearchResult.DataSource = clientList;
     }
     else
     {
         MessageBox.Show("Category Name not found");
     }
 }
Ejemplo n.º 10
0
        private void PopulateCategoryDropdown()
        {
            List <BLCategory> categories = BLCategory.RetrieveListFromDB(connectionString);

            foreach (BLCategory category in categories)
            {
                Label listItem = new Label
                {
                    Text = $"<li><a href='/Result.aspx?categoryId={category.Id}'>{category.Name}</a></li>"
                };
                categoryDropdownMenu.Controls.Add(listItem);
            }
        }
Ejemplo n.º 11
0
        private void DisplayCategoryResult()
        {
            BLCategory category = BLCategory.RetrieveFromDB(connectionString, categoryId);

            if (category == null)
            {
                throw new HttpException(404, $"Result.aspx?categoryId={categoryId} doesn't exist.");
            }
            resultBLProducts = BLProduct.RetrieveListFromDB(connectionString,
                                                            $"CategoryID = {categoryId} AND ID NOT IN (SELECT VariantID FROM ProductVariants)");
            ResultTitle.InnerHtml       = category.Name;
            ResultImage.Src             = $"ImgHandler.ashx?categoryId={categoryId}";
            ResultDescription.InnerHtml = category.Description;
            DisplayProducts();
        }
Ejemplo n.º 12
0
        public static List <BLCategory> SelectAll()
        {
            string            sql  = "SELECT  BLID,BLName FROM BLCategory ";
            SqlDataReader     dr   = DBHelper.MyExecuteReader(sql);
            List <BLCategory> list = new List <BLCategory>();

            while (dr.Read())
            {
                BLCategory bl = new BLCategory();
                bl.BLID   = Convert.ToInt32(dr["BLID"]);
                bl.BLName = dr["BLName"].ToString();
                list.Add(bl);
            }
            dr.Close();
            return(list);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 查询大类节点
        /// </summary>
        /// <returns></returns>
        public static List <BLCategory> getBLCategoryList()
        {
            List <BLCategory> list = new List <BLCategory>();
            String            sql  = string.Format("select * from BLCategory");

            using (SqlDataReader sdr = DBHelp.MyExecuteReader(sql, null))
            {
                while (sdr.Read())
                {
                    BLCategory bl = new BLCategory();
                    bl.BLID   = Convert.ToInt32(sdr["BLID"]);
                    bl.BLName = sdr["BLName"].ToString();
                    list.Add(bl);
                }
            }

            return(list);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 表:BLCategory (根据BLID查询
        /// </summary>
        /// <param name="BLID">所需BLID</param>
        /// <returns>查询结果</returns>
        public static BLCategory Select_BLID(int BLID)
        {
            BLCategory bLCategory = null;

            using (SqlDataReader dataReader = DBHelp.ExecuteSqlDataReader(
                       "select * from BLCategory where BLID=@BLID",
                       new SqlParameter[] {
                new SqlParameter("@BLID", BLID)
            }))
            {
                while (dataReader.Read())
                {
                    bLCategory = new BLCategory()
                    {
                        BLID   = Convert.ToInt32(dataReader["BLID"]),
                        BLName = Convert.ToString(dataReader["BLName"]),
                    };
                }
                return(bLCategory);
            }
        }
Ejemplo n.º 15
0
        public HomeLayOutModel GetLayOutData()
        {
            HomeLayOutModel objHomeLayOutModel = new HomeLayOutModel();

            BLCategory    objBLCategory    = new BLCategory();
            BLDocument    objBLDocument    = new BLDocument();
            BLSubCategory objBLSubCategory = new BLSubCategory();

            ViewCategoryModel objViewCategoryModel = new ViewCategoryModel();

            objViewCategoryModel.CurrentPage        = 1;
            objViewCategoryModel.PageSize           = int.MaxValue - 1;
            objHomeLayOutModel.objViewCategoryModel = new ViewCategoryModel();
            objHomeLayOutModel.objViewCategoryModel = objBLCategory.GetCategoryList(objViewCategoryModel);

            if (objHomeLayOutModel != null && objHomeLayOutModel.objViewCategoryModel != null && objHomeLayOutModel.objViewCategoryModel.CategoryList != null && objHomeLayOutModel.objViewCategoryModel.CategoryList.Count > 0)
            {
                for (int i = 0; i < objHomeLayOutModel.objViewCategoryModel.CategoryList.Count; i++)
                {
                    //string[] DocumentIds = objHomeLayOutModel.objViewCategoryModel.CategoryList[i].QuickLinks.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    //if (DocumentIds != null && DocumentIds.Length > 0)
                    //{
                    //    objHomeLayOutModel.objViewCategoryModel.CategoryList[i].objDocumentList = new List<DocumentModel>();
                    //    for (int j = 0; j < DocumentIds.Length; j++)
                    //    {
                    //        objHomeLayOutModel.objViewCategoryModel.CategoryList[i].objDocumentList.Add(objBLDocument.GetDocumentById(Convert.ToInt32(DocumentIds[j])));
                    //    }
                    //}
                }
            }
            ViewSubCategoryModel objViewSubCategoryModel = new ViewSubCategoryModel();

            objViewSubCategoryModel.CurrentPage = 1;
            objViewSubCategoryModel.PageSize    = int.MaxValue - 1;

            objHomeLayOutModel.objSubViewCategoryModel = new ViewSubCategoryModel();
            objHomeLayOutModel.objSubViewCategoryModel = objBLSubCategory.GetSubCategoryList(objViewSubCategoryModel);

            return(objHomeLayOutModel);
        }
Ejemplo n.º 16
0
        public List <Category> searchById(int id)
        {
            if (id != 0)
            {
                List <Category> categoryList = BLCategory.GetCategoryListById(APCContext, id);

                if (categoryList != null)
                {
                    tbId.Text   = categoryList[0].Id.ToString();
                    tbName.Text = categoryList[0].Name;
                    return(categoryList);
                }
                else
                {
                    MessageBox.Show("Category Id not found");
                }
            }
            else
            {
                MessageBox.Show("Category Id not found");
            }
            return(null);
        }
Ejemplo n.º 17
0
    private void ClearFields()
    {
        this.created = DateTime.MinValue;
            this.uid = string.Empty;
            this.saveInfo = false;

            this.creditCard = null;
            this.billingAddress = null;
            this.shippingAddress = null;
            this.shoppingCart = null;
            this.category = null;

            this.billingAddress = new BLAddress();
            this.shippingAddress = new BLAddress();
            this.shoppingCart = new BLShoppingCart();
            this.creditCard = new BLCreditCard();
            this.items = new BLItems();
            this.orders = new BLOrders();
            this.category = new BLCategory();
            this.item = new BLItem();
    }
Ejemplo n.º 18
0
 public HomeController()
 {
     BL = new BLCategory();
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 表:BLCategory (添加一条数据
 /// </summary>
 /// <param name="bLCategory">添加的数据</param>
 /// <returns>执行成功的行数</returns>
 public static int Insert(BLCategory bLCategory)
 {
     return(Dal_BLCategory.Insert(bLCategory));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 表:BLCategory (修改数据
 /// </summary>
 /// <param name="bLCategory">修改的数据</param>
 /// <returns>执行成功的行数</returns>
 public static int Update(BLCategory bLCategory)
 {
     return(Dal_BLCategory.Update(bLCategory));
 }
 public Categories[] allCategories()
 {
     return(BLCategory.allCategories());
 }
Ejemplo n.º 22
0
        private void rptCategoryList_Bind()
        {
            dsCategory = BLCategory.GetList(this.categoryID);
            if (this.categoryID==0)
            {
                rptCategoryList.DataSource = dsCategory.Tables["Category"];
                rptCategoryList.DataBind();
            }
            else
            {
                BLCategory category = new BLCategory();
                category.ID = this.categoryID;
                category.Retrieve();
                dsCategory2 = BLCategory.GetList(category.ParentID);

                if (category.ParentID>0 && dsCategory.Tables["Category"].Rows.Count==0)
                {
                    dsCategory = dsCategory2;

                    BLCategory category2 = new BLCategory();
                    category2.ID = category.ParentID;
                    category2.Retrieve();
                    dsCategory2 = BLCategory.GetList(category2.ParentID);

                    this.categoryChildID = this.categoryID;
                    this.categoryID = category.ParentID;

                    rptCategoryList.DataSource = dsCategory2.Tables["Category"];
                    rptCategoryList.DataBind();
                }
                else
                {
                    rptCategoryList.DataSource = dsCategory2.Tables["Category"];
                    rptCategoryList.DataBind();
                }
            }
        }