Esempio n. 1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (txtProductID.Text.Length > 0)
            {
                CMEDShopProduct product = new CMEDShopProduct
                {
                    product_id = long.Parse(txtProductID.Text),
                    product_title = txtTitle.Text,
                    category_id = long.Parse(lstCategory.SelectedValue),
                    supplier_id = long.Parse(lstSupplier.SelectedValue),
                    product_price = double.Parse(txtProductPrice.Text),
                    product_status = lstProductStatus.SelectedValue,
                    short_description = FreeTextBox3.Text,
                    long_description = FreeTextBox1.Text,
                    thumb_pic_url = txtThumbNail.Text,
                    full_pic_url = txtMainPhoto.Text,
                    year = Int32.Parse(lstProductYear.SelectedValue),
                    location = lstLocation.SelectedValue,
                    topic = lstTopic.SelectedValue,
                    active = chkActive.Enabled,
                    updated_by = (string)Session["adminemail"],

                };

                controller.UpdateCMEDShopProduct(product);
            }
        }
Esempio n. 2
0
        public void UpdateCMEDShopProduct(CMEDShopProduct product)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "UpdateCMEDShopProduct";

            cmd.Parameters.AddWithValue("@product_id", product.product_id);
            cmd.Parameters.AddWithValue("@product_title", product.product_title);
            cmd.Parameters.AddWithValue("@category_id", product.category_id);
            cmd.Parameters.AddWithValue("@supplier_id", product.supplier_id);
            cmd.Parameters.AddWithValue("@product_price", product.product_price);
            cmd.Parameters.AddWithValue("@product_status", product.product_status);
            cmd.Parameters.AddWithValue("@short_description", product.short_description);
            cmd.Parameters.AddWithValue("@long_description", product.long_description);
            cmd.Parameters.AddWithValue("@thumb_pic_url", product.thumb_pic_url);
            cmd.Parameters.AddWithValue("@full_pic_url", product.full_pic_url);
            cmd.Parameters.AddWithValue("@year", product.year);
            cmd.Parameters.AddWithValue("@location", product.location);
            cmd.Parameters.AddWithValue("@topic", product.topic);
            cmd.Parameters.AddWithValue("@active", product.active);
            cmd.Parameters.AddWithValue("@updated_by", product.updated_by);

            db.Execute(cmd);

            return;
        }
Esempio n. 3
0
        public List<CMEDShopProduct> getCMEDShopProductsByCategoryLocation(long category_id, long location_id)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetCMEDShopProductsByCategoryLocation";

            cmd.Parameters.AddWithValue("@category_id", category_id);
            cmd.Parameters.AddWithValue("@location_id", location_id);

            DataTable dt = db.Execute(cmd);

            List<CMEDShopProduct> Products = new List<CMEDShopProduct>();

            foreach (DataRow dr in dt.Rows)
            {
                CMEDShopProduct product = new CMEDShopProduct
                {
                    product_id = long.Parse(dr["product_id"].ToString()),
                    product_title = dr["product_title"].ToString(),
                    supplier_id = long.Parse(dr["supplier_id"].ToString()),
                    category_id = long.Parse(dr["category_id"].ToString()),
                    product_price = double.Parse(dr["product_price"].ToString()),
                    product_status = dr["product_status"].ToString(),
                    short_description = dr["short_description"].ToString(),
                    long_description = dr["long_description"].ToString(),
                    thumb_pic_url = dr["thumb_pic_url"].ToString(),
                    full_pic_url = dr["full_pic_url"].ToString(),
                    year = Int32.Parse(dr["year"].ToString()),
                    sort = Int32.Parse(dr["sort"].ToString()),
                    location = dr["location"].ToString(),
                    topic = dr["topic"].ToString(),
                    is_bundle = dr["is_bundle"].ToString(),
                    preview_url = dr["preview_url"].ToString(),
                    purchase_url = dr["Purchase_url"].ToString(),
                    active = bool.Parse(dr["active"].ToString()),
                    date_created = DateTime.Parse(dr["date_created"].ToString()),
                    created_by = dr["created_by"].ToString(),
                    date_updated = DateTime.Parse(dr["date_updated"].ToString()),
                    updated_by = dr["updated_by"].ToString(),
                    supplier_name = dr["supplier_name"].ToString(),
                    category_name = dr["category_name"].ToString(),
                    pdf_available = Boolean.Parse(dr["pdf_available"].ToString()),
                    pdf_url = dr["pdf_url"].ToString(),

                };

                Products.Add(product);
            }

            return Products;
        }
Esempio n. 4
0
        public List<CMEDShopProduct> getCMEDShopProductsByCategoryLocationSlides(long category_id, long location_id)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetCMEDShopProductsByCategoryLocationSlides";

            cmd.Parameters.AddWithValue("@category_id", category_id);
            cmd.Parameters.AddWithValue("@location_id", location_id);

            DataTable dt = db.Execute(cmd);

            List<CMEDShopProduct> Products = new List<CMEDShopProduct>();

            foreach (DataRow dr in dt.Rows)
            {
                CMEDShopProduct product = new CMEDShopProduct
                {
                    product_id = long.Parse(dr["product_id"].ToString()),
                    product_title = dr["product_title"].ToString(),
                    sort = Int32.Parse(dr["sort"].ToString()),
                    pdf_available = Boolean.Parse(dr["pdf_available"].ToString()),
                    pdf_url = dr["pdf_url"].ToString(),

                };

                Products.Add(product);
            }

            return Products;
        }
Esempio n. 5
0
        public CMEDShopProduct GetCMEDShopProduct(long product_id)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetCMEDShopProduct";
            cmd.Parameters.AddWithValue("@product_id", product_id);

            DataTable dt = db.Execute(cmd);

            DataRow dr = dt.Rows[0];

            CMEDShopProduct product = new CMEDShopProduct
            {
                product_id = long.Parse(dr["product_id"].ToString()),
                product_title = dr["product_title"].ToString(),
                supplier_id = long.Parse(dr["supplier_id"].ToString()),
                category_id = long.Parse(dr["category_id"].ToString()),
                product_price = double.Parse(dr["product_price"].ToString()),
                product_status = dr["product_status"].ToString(),
                short_description = dr["short_description"].ToString(),
                long_description = dr["long_description"].ToString(),
                thumb_pic_url = dr["thumb_pic_url"].ToString(),
                full_pic_url = dr["full_pic_url"].ToString(),
                year = Int32.Parse(dr["year"].ToString()),
                location = dr["location"].ToString(),
                topic = dr["topic"].ToString(),
                is_bundle = dr["is_bundle"].ToString(),
                preview_url = dr["preview_url"].ToString(),
                purchase_url = dr["Purchase_url"].ToString(),
                active = bool.Parse(dr["active"].ToString()),
                date_created = DateTime.Parse(dr["date_created"].ToString()),
                created_by = dr["created_by"].ToString(),
                date_updated = DateTime.Parse(dr["date_updated"].ToString()),
                updated_by = dr["updated_by"].ToString(),
                supplier_name = dr["supplier_name"].ToString(),
                category_name = dr["category_name"].ToString(),

            };

            return product;
        }