private void LoadData()
 {
     // Option for brand
     cbbBrand.DataSource    = BrandBLL.FindAll();
     cbbBrand.DisplayMember = "Name";
     cbbBrand.ValueMember   = "Name";
     //cbbBrand.Hide();
     // Option for purpose
     cbbPurpose.DataSource    = PurposeBLL.FindAll();
     cbbPurpose.DisplayMember = "Name";
     cbbPurpose.ValueMember   = "Name";
     // Option for Price
     cbbPrice.DataSource    = PriceBLL.FindAll();
     cbbPrice.DisplayMember = "Name";
     cbbPrice.ValueMember   = "Name";
     //cbbPrice.Hide();
     // Option for color
     cbbColor.DataSource    = ColorBLL.FindAll();
     cbbColor.DisplayMember = "Name";
     cbbColor.ValueMember   = "Name";
     //cbbColor.Hide();
     // Option for gender
     cbbGender.DataSource    = GenderBLL.FindAll();
     cbbGender.DisplayMember = "Name";
     cbbGender.ValueMember   = "Name";
     // Option for Object using
     cbbObjectUsing.DataSource    = ObjectUsingBLL.FindAll();
     cbbObjectUsing.DisplayMember = "Name";
     cbbObjectUsing.ValueMember   = "Name";
 }
Example #2
0
    //添加品牌
    protected void BtnSvae_Click(object sender, EventArgs e)
    {
        try
        {
            BrandBLL   bll   = new BrandBLL();
            BrandModel model = new BrandModel();

            model.Title        = PageValidate.HtmlEncode(txtTitle.Value.Trim());
            model.ImgPath      = PageValidate.HtmlEncode(txtImgPath.Value.Trim());
            model.Url          = PageValidate.HtmlEncode(txtUrl.Value.Trim());
            model.ShowPosition = ShowPosition.SelectedValue;
            model.Sort         = (txtSort.Value.Trim() == "") ? 0 : Convert.ToInt32(txtSort.Value.Trim());
            model.Remarks      = txtRemarks.Value.Trim();

            if (bll.AddBrand(model))
            {
                Tz888.Common.MessageBox.ShowAndRedirect(this.Page, "添加成功!", "BrandManage.aspx", false);
            }
            else
            {
                Tz888.Common.MessageBox.Show(this.Page, "添加失败!");
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Example #3
0
        public BrandBLL checkBrandAvailableOrNot(string keyword)
        {
            BrandBLL b = new BrandBLL();

            SqlConnection con = new SqlConnection(myconnstrng);

            DataTable dt = new DataTable();

            //fdfd
            try
            {
                string sql = "SELECT Brand_Name from Brand_Master WHERE Brand_Name LIKE '%" + keyword + "%'";

                SqlDataAdapter adapter = new SqlDataAdapter(sql, con);

                con.Open();

                adapter.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    b.Brand_Name = dt.Rows[0]["Brand_Name"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
            return(b);
        }
Example #4
0
        private string Edit(NameValueCollection rParams)
        {
            string res = "{success:false,msg:'编辑失败'}";

            //组装参数
            BrandEntity entity = new BrandEntity();

            if (!string.IsNullOrEmpty(rParams["id"]))
            {
                entity = new BrandBLL(CurrentUserInfo).GetByID(rParams["id"]);
            }
            entity          = DataLoader.LoadFrom <BrandEntity>(rParams, entity);
            entity.ClientID = CurrentUserInfo.ClientID;
            if (!string.IsNullOrEmpty(rParams["id"]))
            {
                new BrandBLL(CurrentUserInfo).Update(entity);
                res = "{success:true,msg:'编辑成功'}";
            }
            else
            {
                new BrandBLL(CurrentUserInfo).Create(entity);
                res = "{success:true,msg:'编辑成功'}";
            }
            return(res);
        }
Example #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TBrand   tbrand   = InitBrand();
            BrandBLL brandbll = new BrandBLL();

            brandbll.UpdateBrand(tbrand, tbrand.BrandID);
            CommonLibrary.RunJs.PageReplace("Brand_UpdateManage.aspx?LastID=" + tbrand.BrandID);
        }
        protected void btnDelBrand_Click(object sender, EventArgs e)
        {
            BrandCL  brandCL  = new BrandCL();
            BrandBLL brandBLL = new BrandBLL();

            brandCL.id = id;
            brandBLL.deleteBrand(brandCL);
            Response.Redirect("ProductManagement.aspx");
        }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string   Keyword  = Server.UrlDecode(CommonLibrary.CommOperate.GetStrFromRequestQueryString("title"));
         BrandBLL brandbll = new BrandBLL();
         Response.Write(brandbll.CheckTitle(Keyword).ToString().ToLower());
         Response.End();
     }
 }
Example #8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TBrand   tbrand   = InitBrand();
            BrandBLL brandbll = new BrandBLL();

            brandbll.AddBrand(tbrand);
            int lastid = brandbll.GetLastID();

            CommonLibrary.RunJs.PageReplace("Brand_UpdateManage.aspx?LastID=" + lastid);
        }
        private void bindBrands(int brandId)
        {
            BrandCL  brandCL  = new BrandCL();
            BrandBLL brandBLL = new BrandBLL();

            brandCL           = brandBLL.getBrands(brandId);
            txtBName.Text     = brandCL.name;
            ddlBRating.Text   = brandCL.brandRating.ToString();
            txtBDiscount.Text = brandCL.promotions.ToString();
        }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string   Keyword  = Server.UrlDecode(CommonLibrary.CommOperate.GetStrFromRequestQueryString("q"));
         BrandBLL brandbll = new BrandBLL();
         Response.ContentType = "text/html";
         Response.Write(brandbll.GetBrandJson(Keyword));
         Response.End();
     }
 }
Example #11
0
        static void Main(string[] args)
        {
            Brands b = new Brands();

            b.BrandID  = 12;
            b.Name     = "Apple";
            b.ImageUrl = "dada";
            BrandBLL br = new BrandBLL();
            int      kq = br.Insert(b);

            Console.WriteLine(kq);
            Console.ReadKey();
        }
Example #12
0
        public bool Insert(BrandBLL b)
        {
            //Creating A Boolean VAriable and set its default value to false
            bool isSucces = false;

            //Connecting to Database
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //Writing Query to Add New Category
                string sql = "INSERT INTO Brand_Master (Brand_Name,Description) VALUES (@Brand_Name, @Description)";

                //Creating SQL Command to pass values in our query
                SqlCommand cmd = new SqlCommand(sql, conn);
                //Passing Values through parameter
                cmd.Parameters.AddWithValue("@Brand_Name", b.Brand_Name);
                cmd.Parameters.AddWithValue("@Description", b.Description);


                //Open Database Connection
                conn.Open();

                //Creating the int variable to execute query
                int rows = cmd.ExecuteNonQuery();

                //If the query is executed successfully then its value will be greater than 0 else it will be less than 0

                if (rows > 0)
                {
                    //Query Executed Succesfully
                    isSucces = true;
                }
                else
                {
                    //Failed to Execute Query
                    isSucces = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Closing Database Connection
                conn.Close();
            }

            return(isSucces);
        }
Example #13
0
        public bool Update(BrandBLL b)
        {
            //Creating Boolean variable and set its default value to false
            bool isSuccess = false;

            //Creating SQL Connection
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //Query to Update Category
                string sql = "UPDATE Brand_Master SET Brand_Name=@Brand_Name, Description=@Description WHERE Brand_ID=@Brand_ID";

                //SQl Command to Pass the Value on Sql Query
                SqlCommand cmd = new SqlCommand(sql, conn);

                //Passing Value using cmd
                cmd.Parameters.AddWithValue("@Brand_Name", b.Brand_Name);
                cmd.Parameters.AddWithValue("@Description", b.Description);
                cmd.Parameters.AddWithValue("@Brand_ID", b.Brand_ID);


                //Open DAtabase Connection
                conn.Open();

                //Create Int Variable to execute query
                int rows = cmd.ExecuteNonQuery();

                //if the query is successfully executed then the value will be grater than zero
                if (rows > 0)
                {
                    //Query Executed Successfully
                    isSuccess = true;
                }
                else
                {
                    //Failed to Execute Query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
        protected void btnBrand_Click(object sender, EventArgs e)
        {
            BrandCL  brandCL  = new BrandCL();
            BrandBLL brandBLL = new BrandBLL();

            brandCL.id           = id;
            brandCL.name         = txtBName.Text;
            brandCL.dateCreated  = DateTime.Now;
            brandCL.dateModified = DateTime.Now;
            brandCL.brandRating  = Convert.ToInt32(ddlBRating.Text);
            brandCL.isDeleted    = false;
            brandCL.promotions   = Convert.ToDecimal(txtBDiscount.Text);
            brandBLL.updateBrand(brandCL);
            lblSuccessfulBrand.Text = "Brand Updated Successfully";
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                string userId = Session["UserId"].ToString();
            }
            else
            {
                //If the session value for userid is not set, redirect the user to the loginpage
                //see the ReturnUrl querystring value, it will be the page, that the ASP.NEt
                //infrastructure will redirect to after successful validation of the user

                //See the <Authentication node in web.config
                FormsAuthentication.RedirectToLoginPage();
            }
            CategoryBLL categoryBLL = new CategoryBLL();
            //Instantiates the Category BusinessLogic Layer Class.
            BrandBLL brandBLL = new BrandBLL();

            //Instantiates the Brand BusinessLogic Layer Class.
            if (!IsPostBack)
            {
                Collection <CategoryCL> categoriesInProduct = categoryBLL.viewCategory();
                //Initialises the Categories from the DataBase.
                lstPCategoryName.DataSource     = from x in categoriesInProduct select x;
                lstPCategoryName.DataTextField  = "name";
                lstPCategoryName.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstPCategoryName.DataBind();
                //Binds the data in the DropDown List.
                Collection <BrandCL> brandsInProduct = brandBLL.viewBrand();
                //Initialises the Brands from the DataBase.
                lstPBrandName.DataSource     = from x in brandsInProduct select x;
                lstPBrandName.DataTextField  = "name";
                lstPBrandName.DataValueField = "id";
                //Adds the Names of Brands in the DropDown List.
                lstPBrandName.DataBind();
                //Binds the data in the DropDown List.
                lstCParentCategory.DataSource     = from x in categoriesInProduct select x;
                lstCParentCategory.DataTextField  = "name";
                lstCParentCategory.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstCParentCategory.DataBind();
            }
            //Binds the data in the DropDown List.
        }
Example #16
0
        //Initialises when the Create Category Button is clicked.
        protected void btnBrand_Click(object sender, EventArgs e)
        {
            BrandCL brandCL = new BrandCL();
            //Instantiates the Brand Communication Layer Class.
            BrandBLL brandBLL = new BrandBLL();

            //Instantiates the Brand BusinessLogic Layer Class.
            brandCL.brandRating  = Convert.ToInt32(ddlBRating.SelectedValue);
            brandCL.name         = txtBName.Text;
            brandCL.promotions   = Convert.ToDecimal(txtBDiscount.Text);
            brandCL.dateCreated  = DateTime.Now;
            brandCL.dateModified = DateTime.Now;
            brandCL.isDeleted    = false;
            //Adds the data entered from the Inputs to the Communication Layer Class instance.
            brandBLL.createBrand(brandCL);
            //This method sends the data of the Communication Layer class instance to the Database.
            lblSuccessfulBrand.Text = "Brand Created Successfully.";
        }
Example #17
0
        public bool Delete(BrandBLL b)
        {
            //Create a Boolean variable and set its value to false
            bool isSuccess = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //SQL Query to Delete from Database
                string sql = "DELETE FROM Brand_Master WHERE Brand_ID=@Brand_ID";

                SqlCommand cmd = new SqlCommand(sql, conn);
                //Passing the value using cmd
                cmd.Parameters.AddWithValue("@Brand_ID", b.Brand_ID);

                //Open SqlConnection
                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //If the query is executd successfully then the value of rows will be greater than zero else it will be less than 0
                if (rows > 0)
                {
                    //Query Executed Successfully
                    isSuccess = true;
                }
                else
                {
                    //Faied to Execute Query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
Example #18
0
        private void LoadEvent()
        {
            StringBuilder gd = new StringBuilder("");

            GenderBLL.FindAll().ForEach(x => {
                gd.Append(x.ToString());
            });
            StringBuilder ou = new StringBuilder();

            ObjectUsingBLL.FindAll().ForEach(x =>
            {
                ou.Append(x.ToString());
            });
            StringBuilder pp = new StringBuilder();

            PurposeBLL.FindAll().ForEach(x =>
            {
                pp.Append(x.ToString());
            });
            StringBuilder pr = new StringBuilder();

            PriceBLL.FindAll().ForEach(x =>
            {
                pr.Append(x.ToString());
            });
            StringBuilder br = new StringBuilder();

            BrandBLL.FindAll().ForEach(x =>
            {
                br.Append(x.ToString());
            });
            StringBuilder cl = new StringBuilder();

            ColorBLL.FindAll().ForEach(x =>
            {
                cl.Append(x.ToString());
            });
            lbGD.Text = gd.ToString();
            lbOU.Text = ou.ToString();
            lbBR.Text = br.ToString();
            lbCL.Text = cl.ToString();
            lbPP.Text = pp.ToString();
            lbPR.Text = pr.ToString();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //add brand into table

            if (textBrandName.Text != "")
            {
                if (textDescription.Text != "")
                {
                    BrandBLL = BrandDAL.checkBrandAvailableOrNot(textBrandName.Text);

                    if (textBrandName.Text != BrandBLL.Brand_Name)
                    {
                        BrandBLL.Brand_Name  = textBrandName.Text;
                        BrandBLL.Description = textDescription.Text;

                        bool success = BrandDAL.Insert(BrandBLL);
                        if (success == true)
                        {
                            MessageBox.Show("Brand Inserted Succesfully .!!");
                            clear();
                            DataTable dt = BrandDAL.Select();
                            dgvBrand.DataSource = dt;
                        }
                        else
                        {
                            MessageBox.Show("Failed to insert category :/ ");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Brand is Already Added in Database Please choose another Brand");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter Description");
                }
            }
            else
            {
                MessageBox.Show("Please Enter Brnad Name");
            }
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int Brandid = 0;
                Int32.TryParse(CommonLibrary.CommOperate.GetStrFromRequestQueryString("id"), out Brandid);
                TBrand   tbrand   = new TBrand();
                BrandBLL brandbll = new BrandBLL();

                tbrand              = brandbll.GetBrandByID(Brandid);
                tbx_title.Text      = tbrand.BrandName;
                ContentHolder.Value = tbrand.BrandMemo;
                #region 图片列表
                L_selpic.Text = ImageOperate.GetImageSelect(tbrand.BrandMemo, tbrand.BrandPic);
                #endregion
                Tbx_BrandTemplate.Text = tbrand.BrandTemplate;
                if (tbrand.IsRemote == true)
                {
                    L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" Checked=Checked />";
                }
                else
                {
                    L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" />";
                }

                if (tbrand.IsRecom == true)
                {
                    L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\"  Checked=Checked  value=\"true\" />";
                }
                else
                {
                    L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\"    value=\"true\" />";
                }

                Tbx_Addtime.Text  = tbrand.BrandAddtime.ToString("yyyy-MM-dd hh:mm:ss");
                Tbx_Adder.Text    = LoginUser.Admin_RealName;
                H_Adder.Value     = LoginUser.Admin_ID.ToString();
                tbx_SortId.Text   = tbrand.SortID.ToString();
                Tbx_htmlpath.Text = tbrand.BrandHtmlPath;
            }
        }
Example #21
0
 public ParametersController()
 {
     meterBLL = new MeterBLL(paramBLL.db, this.User.Identity.Name);
     brandBLL = new BrandBLL(paramBLL.db);
 }
        /// <summary>
        ///  显示所有订单
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductOrderShow()
        {
            #region
            //model.apiOrderModel api = new model.apiOrderModel()
            //{
            //    orderId = "3215464",
            //    deliveryPrice = 132,
            //    buyNameAddress = "深圳",
            //    cityId = "罗湖",
            //    createTime = DateTime.Now,
            //    district = "国贸"
            //    ,
            //    favorablePrice = 231,
            //    invoiceTitle = "dfda",
            //    invoiceType = "jdfakd",
            //    isPay = 0,
            //    itemPrice = 34233,
            //    orderMsg = "发的噶",
            //    orderPrice = 23423,
            //    orderStatus = 1,
            //    paidPrice = 2342,
            //    payOuterId = "11000"
            //    ,
            //    payTime = DateTime.Now,
            //    phone = "12345666660",
            //    postcode = "444444",
            //    provinceId = "32",
            //    realName = "张三",
            //    taxPrice = 2342,
            //    apiOrderDetails = new model.apiOrderDetailsModel[] { new model.apiOrderDetailsModel() { orderId = "3215464", detailsColor="Red", detailsDeliveryPrice="123", detailsEditTime=DateTime.Now,
            //    detailsImg="sdfa", detailsItemPrice=12313, detailsOrderId="123123", detailsPayTime=DateTime.Now, detailsSaleCount=1, detailsScode="396382741000F", detailsSendTime=DateTime.Now, detailsStatus=1,
            //    detailsSucessTime=DateTime.Now, detailsTaxPrice=123, detailsTime=DateTime.Now}
            //    },
            //    apiOrderDiscount = new model.apiOrderDiscountModel[] { new model.apiOrderDiscountModel() { orderId = "3215464" } },
            //    apiOrderPayDetails = new model.apiOrderPayDetailsModel[] { new model.apiOrderPayDetailsModel() { orderId = "3215464", payTime = DateTime.Now } }

            //};
            //System.Runtime.Serialization.Json.DataContractJsonSerializer ser = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(model.apiOrderModel));
            //System.IO.MemoryStream ms = new System.IO.MemoryStream();
            //ser.WriteObject(ms, api);
            //string jsonString = System.Text.Encoding.UTF8.GetString(ms.ToArray());
            //jsonString = jsonString.Replace("_","");
            //GetPage("http://localhost:10155/api/AddAllOrder?userName='******'&userPwd='123'", jsonString);
            #endregion
            string[] str = new string[10];                                               //查询条件
            str[0] = Request.Form["beginTime"] == null ? "" : Request.Form["beginTime"]; //开始时间
            str[1] = Request.Form["endTime"] == null ? "" : Request.Form["endTime"];     //结束时间
            str[2] = Request.Form["yhm"] == null ? "" : Request.Form["yhm"];             //用户名
            str[3] = Request.Form["Brand"] == null ? "" : Request.Form["Brand"];         //品牌
            str[4] = Request.Form["Type"] == null ? "" : Request.Form["Type"];           //类别
            str[5] = Request.Form["state"] == null ? "" : Request.Form["state"];         //状态
            str[6] = Request.Form["pricemin"] == null ? "" : Request.Form["pricemin"];   //最小价格
            str[7] = Request.Form["pricemax"] == null ? "" : Request.Form["pricemax"];   //最大价格
            str[8] = Request.Form["Scode"] == null ? "" : Request.Form["Scode"];         //货号
            str[9] = Request.Form["OrderId"] == null ? "" : Request.Form["OrderId"];     //单号
            bll.ProductOrderbll bll = new bll.ProductOrderbll();
            Exception           ex;
            DataTable           table = bll.GetProductOrder(0, 10, str, out ex);
            ViewData["pageCount"]     = bll.GetProductOrderCount(str);;
            ViewData["pageRowsCount"] = table != null ? table.Rows.Count : 0;
            if (table != null)
            {
                #region
                foreach (DataColumn c in table.Columns)
                {
                    if (c.ColumnName == "nid")
                    {
                        c.ColumnName = "编号";
                    }
                    if (c.ColumnName == "orderId")
                    {
                        c.ColumnName = "订单编号";
                    }
                    if (c.ColumnName == "productScode")
                    {
                        c.ColumnName = "货号";
                    }
                    if (c.ColumnName == "CAT")
                    {
                        c.ColumnName = "品牌";
                    }
                    if (c.ColumnName == "CAT2")
                    {
                        c.ColumnName = "类别";
                    }
                    if (c.ColumnName == "SIZE")
                    {
                        c.ColumnName = "尺码";
                    }
                    if (c.ColumnName == "Color")
                    {
                        c.ColumnName = "颜色";
                    }
                    if (c.ColumnName == "PRICEE")
                    {
                        c.ColumnName = "批发价";
                    }
                    if (c.ColumnName == "PRICED")
                    {
                        c.ColumnName = "成本价";
                    }
                    if (c.ColumnName == "orderNum")
                    {
                        c.ColumnName = "数量";
                    }
                    if (c.ColumnName == "orderCreateTime")
                    {
                        c.ColumnName = "订单创建时间";
                    }
                    if (c.ColumnName == "UserName")
                    {
                        c.ColumnName = "用户名";
                    }
                    if (c.ColumnName == "reserved")
                    {
                        c.ColumnName = "订单状态";
                    }
                }
                List <SelectListItem> drplist = new List <SelectListItem>();//品牌下拉框
                BrandBLL          bb          = new BrandBLL();
                List <BrandModel> brm         = bb.SelectBrand();
                foreach (var temp in brm)
                {
                    SelectListItem sl = new SelectListItem();
                    sl.Text  = temp.BrandName;
                    sl.Value = temp.BrandAbridge;
                    drplist.Add(sl);
                }
                ViewData["DrpBrand"] = drplist;
                ProductTypeBLL          ptb         = new ProductTypeBLL();
                List <SelectListItem>   drplisttype = new List <SelectListItem>();//类别下拉框
                List <ProductTypeModel> listType    = ptb.GetProductType();
                foreach (var temp in listType)
                {
                    SelectListItem si = new SelectListItem();
                    si.Text  = temp.TypeName;
                    si.Value = temp.TypeNo;
                    drplisttype.Add(si);
                }
                ViewData["DropType"] = drplisttype;
                #endregion
                return(View(table));
            }
            else
            {
                return(View("../ErrorMsg/Index"));
            }
        }
Example #23
0
        /// <summary>
        /// Bind dropdownlist
        /// </summary>
        /// <param name="langId">Id ngôn ngữ</param>
        /// <param name="drp"></param>
        /// <param name="type">enum loại drp </param>
        /// <param name="isFirstRow">có cần thêm dòng đầu tiên không</param>
        /// <param name="emptyFirstRow">text dòng đầu</param>
        /// <param name="param">Biến điều kiện</param>
        public static void BuildDropDownList(int langId, DropDownList drp, Common.UtilityLocal.List type, bool isFirstRow, string emptyFirstRow, string param)
        {
            switch (type)
            {
            case Common.UtilityLocal.List.ProductDivision:
                DivisionBLL divisionBLL = new DivisionBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_Division> lstDivision = divisionBLL.GetList(langId, string.Empty, string.Empty, string.Empty, 1, 999, out total);
                if (lstDivision != null && lstDivision.Count > 0)
                {
                    foreach (PNK_Division item in lstDivision)
                    {
                        drp.Items.Add(new ListItem(item.DivisionDesc.Title, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            case Common.UtilityLocal.List.ProductType:
                ProductTypeBLL produtTypeBLL = new ProductTypeBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }

                IList <PNK_ProductType> lstProductType = produtTypeBLL.GetList(langId, string.Empty, string.Empty, param, 1, 9999, out total);
                if (lstProductType != null && lstProductType.Count > 0)
                {
                    foreach (PNK_ProductType item in lstProductType)
                    {
                        drp.Items.Add(new ListItem(item.ProductTypeDesc.Title, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            case Common.UtilityLocal.List.ProductGroup:
                ProductGroupBLL produtGroupBLL = new ProductGroupBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }

                IList <PNK_ProductGroup> lstProductGroup = produtGroupBLL.GetList(langId, string.Empty, string.Empty, string.Empty, param, 1, 9999, out total);
                if (lstProductGroup != null && lstProductGroup.Count > 0)
                {
                    foreach (PNK_ProductGroup item in lstProductGroup)
                    {
                        drp.Items.Add(new ListItem(item.ProductGroupDesc.Title, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            //Hãng sản xuất
            case Common.UtilityLocal.List.Brand:
                BrandBLL brandBLL = new BrandBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_Brand> lstBrand = brandBLL.GetList(langId, string.Empty, string.Empty, string.Empty, 1, 999, out total);
                if (lstBrand != null && lstBrand.Count > 0)
                {
                    foreach (PNK_Brand item in lstBrand)
                    {
                        drp.Items.Add(new ListItem(item.BrandDesc.Title, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            //Tỉnh
            case Common.UtilityLocal.List.Province:
                ProvinceBLL provinceBLL = new ProvinceBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_Province> lstProvince = provinceBLL.GetProvinceAll();

                if (lstProvince != null && lstProvince.Count > 0)
                {
                    foreach (PNK_Province item in lstProvince)
                    {
                        drp.Items.Add(new ListItem(item.Name, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            //Đơn vị đo lường
            case Common.UtilityLocal.List.UnitMeasure:
                UnitMeasureBLL unitMeasureBLL = new UnitMeasureBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_UnitMeasure> lstUnitMeasure = unitMeasureBLL.GetUnitMeasureAll();

                if (lstUnitMeasure != null && lstUnitMeasure.Count > 0)
                {
                    foreach (PNK_UnitMeasure item in lstUnitMeasure)
                    {
                        drp.Items.Add(new ListItem(item.Name, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            //Loại giá
            case Common.UtilityLocal.List.SalesPriceType:
                SalesPriceTypeBLL salesPriceTypeBLL = new SalesPriceTypeBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_SalesPriceType> lstSalesPriceType = salesPriceTypeBLL.GetSalesPriceTypeAll();

                if (lstSalesPriceType != null && lstSalesPriceType.Count > 0)
                {
                    foreach (PNK_SalesPriceType item in lstSalesPriceType)
                    {
                        drp.Items.Add(new ListItem(item.Name, DBConvert.ParseString(item.Id)));
                    }
                }
                break;

            //VAT
            case Common.UtilityLocal.List.VatGroup:
                VatGroupBLL vatGroupBLL = new VatGroupBLL();
                drp.Items.Clear();
                if (isFirstRow)
                {
                    drp.Items.Add(new ListItem(emptyFirstRow, "-1"));
                }
                IList <PNK_VatGroup> lstVatGroup = vatGroupBLL.GetVatGroupAll();

                if (lstVatGroup != null && lstVatGroup.Count > 0)
                {
                    foreach (PNK_VatGroup item in lstVatGroup)
                    {
                        drp.Items.Add(new ListItem(item.Name, DBConvert.ParseString(item.Id)));
                    }
                }
                break;
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int infoid = 0;
                Int32.TryParse(CommonLibrary.CommOperate.GetStrFromRequestQueryString("id"), out infoid);
                TInformation tinfo   = new TInformation();
                InfoBLL      infobll = new InfoBLL();
                AdminBLL     adinbll = new AdminBLL();
                tinfo = infobll.GetInfo(infoid);

                tbx_title.Text      = tinfo.InfoTitle;
                Tbx_SubMemo.Text    = tinfo.InfoSubMemo;
                ContentHolder.Value = tinfo.InfoMemo;
                #region 图片列表
                L_selpic.Text = ImageOperate.GetImageSelect(tinfo.InfoMemo, tinfo.InfoPic);
                #endregion

                #region  信息类型
                if (tinfo.InfoType == 1)
                {
                    L_selinfotype.Text = "<select id='sel_SelInfoType' name='sel_SelInfoType' > <option value=\"1\" selected=selected> 新闻 </option> <option value=\"2\"> 产品 </option></select>";
                }
                else if (tinfo.InfoType == 2)
                {
                    L_selinfotype.Text = "<select id='sel_SelInfoType' name='sel_SelInfoType' > <option value=\"1\" > 新闻 </option> <option value=\"2\" selected=selected> 产品</option></select>";
                    //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "InitInfoType", "$('.dazhe').hide();", true);
                    L_js.Text = @"<script type='text/javascript'>
                                 $(document).ready( function()
                                  {  $('.dazhe').hide();}
                                 );
                         </script>";
                }


                #endregion

                #region  商家id
                int shopid = tinfo.ShopID;
                L_shopid.Text = "<input type=\"hidden\" id=\"h_shopid\" name=\"h_shopid\"  value=\"" + shopid + "\"/>";
                if (shopid == -1)
                {
                    tbx_ShopID.Text = "暂无商家";
                }
                else
                {
                    ShopBLL shopbll = new ShopBLL();
                    tbx_ShopID.Text = shopbll.GetShop(shopid).ShopTitle;
                }
                #endregion


                #region 品牌信息
                int brandid = tinfo.BrandID;
                L_brandid.Text = "<input type=\"hidden\" id=\"h_brandid\" name=\"h_brandid\"  value=\"" + brandid + "\"/>";
                if (brandid == -1)
                {
                    tbx_brand.Text = "暂无品牌信息";
                }
                else
                {
                    BrandBLL brandbll = new BrandBLL();
                    tbx_brand.Text = brandbll.GetBrandByID(brandid).BrandName;
                }
                #endregion

                tbx_SortId.Text   = tinfo.SortID.ToString();
                tbx_Etitle.Text   = tinfo.InfoETitle;
                Tbx_modifier.Text = this.LoginUser.Admin_RealName;
                H_Modifier.Value  = LoginUser.Admin_ID.ToString();

                Tbx_modifytime.Text = tinfo.ModifyTime.ToString("yyyy-MM-dd hh:mm:ss");
                //Tbx_Adder.Text = this.LoginUser.Admin_RealName;
                //H_Adder.Value = LoginUser.Admin_ID.ToString();
                int Adder = 0;
                Int32.TryParse(tinfo.InfoAdder, out Adder);
                Tbx_Adder.Text     = adinbll.GetAdmin(Adder).Admin_RealName;
                H_Adder.Value      = Adder.ToString();
                Tbx_BeginTime.Text = tinfo.InfoStartTime;
                Tbx_EndTime.Text   = tinfo.InfoEndTime;
                Tbx_from.Text      = tinfo.InfoFrom;
                Tbx_Addtime.Text   = tinfo.InfoAddTime.ToString("yyyy-MM-dd hh:mm:ss");
                Tbx_clicknum.Text  = tinfo.InfoClicks.ToString();

                if (tinfo.IsRecom == true)
                {
                    L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\"  Checked=Checked  value=\"true\" />";
                }
                else
                {
                    L_IsRecoom.Text = "<input type=\"checkbox\" id=\"Chk_tuijian\" name=\"Chk_tuijian\"    value=\"true\" />";
                }
                if (tinfo.IsRemote == true)
                {
                    L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" Checked=Checked />";
                }
                else
                {
                    L_isRemote.Text = "<input type=\"checkbox\" id=\"Chk_Remote\" name=\"Chk_Remote\" value=\"true\" />";
                }

                Tbx_tag.Text = tinfo.InfoTag;

                NodeBLL   nodebll = new NodeBLL();
                DataTable dt      = nodebll.GetAllNode();
                L_CateTree.Text = "<select  id='sel' name='sel'><option value='-1'>请选择类别...</option>";
                if (dt.Rows.Count > 0)
                {
                    L_CateTree.Text += tool.NodeTree.GetNodeTree(dt, 0, 0, tinfo.InfoCateID);
                }
                L_CateTree.Text += "</Select>";
            }
        }
Example #25
0
 public BrandController(BrandBLL db)
 {
     _dB = db;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                string userId = Session["UserId"].ToString();
            }
            else
            {
                //If the session value for userid is not set, redirect the user to the loginpage
                //see the ReturnUrl querystring value, it will be the page, that the ASP.NEt
                //infrastructure will redirect to after successful validation of the user

                //See the <Authentication node in web.config
                FormsAuthentication.RedirectToLoginPage();
            }
            CategoryBLL categoryBLL = new CategoryBLL();
            BrandBLL    brandBLL    = new BrandBLL();

            spec = Request.QueryString["spec"];
            id   = Convert.ToInt32(Request.QueryString["id"]);
            switch (spec)
            {
            case "prod":
                disableCategory();
                disableBrand();
                bindProducts(id);
                break;

            case "brand":
                disableProduct();
                disableCategory();
                bindBrands(id);
                break;

            case "cat":
                disableProduct();
                disableBrand();
                bindCategories(id);
                break;
                // default:
            }
            ;
            if (!IsPostBack)
            {
                Collection <CategoryCL> categoriesInProduct = categoryBLL.viewCategory();
                //Initialises the Categories from the DataBase.
                lstPCategoryName.DataSource     = from x in categoriesInProduct select x;
                lstPCategoryName.DataTextField  = "name";
                lstPCategoryName.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstPCategoryName.DataBind();
                //Binds the data in the DropDown List.
                Collection <BrandCL> brandsInProduct = brandBLL.viewBrand();
                //Initialises the Brands from the DataBase.
                lstPBrandName.DataSource     = from x in brandsInProduct select x;
                lstPBrandName.DataTextField  = "name";
                lstPBrandName.DataValueField = "id";
                //Adds the Names of Brands in the DropDown List.
                lstPBrandName.DataBind();
                //Binds the data in the DropDown List.
                lstCParentCategory.DataSource     = from x in categoriesInProduct select x;
                lstCParentCategory.DataTextField  = "name";
                lstCParentCategory.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstCParentCategory.DataBind();
            }
        }