Exemplo n.º 1
0
        private void LoadCboCategories()
        {
            BLLCategory categoryBLL = new BLLCategory();

            cboCategories.DisplayMember = "CategoryName";
            cboCategories.ValueMember   = "CategoryId";
            cboCategories.DataSource    = categoryBLL.GetCategoriesByTypeId(TypeId);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        int categoryId = Convert.ToInt32(Request.QueryString["CategoryID"].ToString());

        category = BLLCategory.getCategoryByID(categoryId)[0];
        if (!Page.IsPostBack)
        {
            CategoryName.Text = category.CategoryName;
            cbStatus.Checked  = category.Status;
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// 分类列表
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public ActionResult CateList(int cid)
        {
            List <ht_category> model = BLLCategory.GetCateList(cid);

            if (Request.IsAjaxRequest())
            {
                apiResp.status = true;
                apiResp.result = model;
                return(Json(apiResp));
            }
            return(View(apiResp));
        }
Exemplo n.º 4
0
        public static MvcCategory GetMVCEntity(BLLCategory category)
        {
            MvcCategory res = new MvcCategory()
            {
                Id   = category.Id,
                Name = category.Name
            };

            foreach (var sphere in category.Sphere)
            {
                res.Sphere.Add(SphereMapper.GetMVCEntity(sphere));
            }
            return(res);
        }
Exemplo n.º 5
0
        public static BLLCategory GetBLLEntity(MvcCategory category)
        {
            BLLCategory result = new BLLCategory()
            {
                Id   = category.Id,
                Name = category.Name,
            };

            foreach (var sphere in category.Sphere)
            {
                result.Sphere.Add(SphereMapper.GetBLLEntity(sphere));
            }
            return(result);
        }
Exemplo n.º 6
0
        public static DALCategory GetDALEntity(BLLCategory category)
        {
            DALCategory result = new DALCategory()
            {
                Id   = category.Id,
                Name = category.Name
            };

            foreach (var sphere in category.Sphere)
            {
                result.Sphere.Add(SphereMapper.GetDALEntity(sphere));
            }
            return(result);
        }
Exemplo n.º 7
0
    protected void LoadData()
    {
        DataTable dt = BLLCategory.getAllData();

        dv         = new DataView(dt);
        dv.Sort    = "CategoryID ASC";
        total.Text = dv.Count.ToString();
        gvCategoryList.DataSource = dv;
        gvCategoryList.DataBind();
        if (gvCategoryList.HeaderRow != null)
        {
            gvCategoryList.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// Fill data to dropdownlist
    /// </summary>
    private void fillData()
    {
        DataTable busType = BLLBusType.getAllBusTypeByStatus(true);

        ddlBusType.DataSource     = busType;
        ddlBusType.DataTextField  = "Type";
        ddlBusType.DataValueField = "BusTypeID";
        ddlBusType.DataBind();
        DataTable category = BLLCategory.getAllDataByStatus(true);

        ddlCategory.DataSource     = category;
        ddlCategory.DataTextField  = "CategoryName";
        ddlCategory.DataValueField = "CategoryID";
        ddlCategory.DataBind();
    }
Exemplo n.º 9
0
    protected void lnkBtnSave_Click(object sender, EventArgs e)
    {
        string name = CategoryName.Text.Trim();

        if (BLLCategory.checkCategoryExistName(name) != 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Category Name existed. Please try again');", true);
        }
        else
        {
            Category cat = new Category();
            cat.CategoryName = name;
            cat.Status       = true;
            BLLCategory.InsertCategory(cat);
            Response.Redirect("CategoryList.aspx");
        }
    }
Exemplo n.º 10
0
    protected void gvBusList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label       lblBusType  = (Label)e.Row.FindControl("lblBusType");
            Label       lblCategory = (Label)e.Row.FindControl("lblCategory");
            HiddenField hfBusType   = (HiddenField)e.Row.FindControl("hfBusType");
            HiddenField hfCategory  = (HiddenField)e.Row.FindControl("hfCategory");

            int busTypeID  = Int32.Parse(hfBusType.Value);
            int categoryID = Int32.Parse(hfCategory.Value);

            BusType  busType = BLLBusType.getBusTypeByID(busTypeID)[0];
            Category cat     = BLLCategory.getCategoryByID(categoryID)[0];

            lblBusType.Text  = busType.Type;
            lblCategory.Text = cat.CategoryName;
        }
    }
Exemplo n.º 11
0
 protected void lnkUpdate_Click(object sender, EventArgs e)
 {
     if ((!category.CategoryName.Equals(CategoryName.Text.Trim())) && (BLLCategory.checkCategoryExistName(CategoryName.Text) != 0))
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Category Name existed. Please try again');", true);
     }
     else
     {
         Category newCat = new Category();
         newCat.CategoryID   = category.CategoryID;
         newCat.CategoryName = CategoryName.Text.Trim();
         if (cbStatus.Checked)
         {
             newCat.Status = true;
         }
         else
         {
             newCat.Status = false;
         }
         int k = BLLCategory.UpdateCategory(newCat);
         Response.Redirect("CategoryList.aspx");
     }
 }
Exemplo n.º 12
0
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        int test = 0;

        foreach (GridViewRow row in gvCategoryList.Rows)
        {
            CheckBox cb = (CheckBox)row.FindControl("chkSel");
            if (cb.Checked)
            {
                ++test;
                int id = int.Parse(row.Cells[1].Text);
                int k  = BLLCategory.DeleteCategory(id);
            }
        }
        if (test == 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Please select a Category from the list to delete');", true);
        }
        else
        {
            Response.Redirect("CategoryList.aspx");
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// Fill data to Form
    /// </summary>
    private void FillData()
    {
        BusPlate.Text    = bus.BusPlate;
        BusName.Text     = bus.BusName;
        Seat.Text        = bus.Seat.ToString();
        cbStatus.Checked = bus.Status;

        DataTable busType = BLLBusType.getAllBusTypeByStatus(true);

        ddlBusType.DataSource     = busType;
        ddlBusType.DataTextField  = "Type";
        ddlBusType.DataValueField = "BusTypeID";
        ddlBusType.DataBind();
        ddlBusType.SelectedValue = bus.BusTypeID.ToString();

        DataTable category = BLLCategory.getAllDataByStatus(true);

        ddlCategory.DataSource     = category;
        ddlCategory.DataTextField  = "CategoryName";
        ddlCategory.DataValueField = "CategoryID";
        ddlCategory.DataBind();
        ddlCategory.SelectedValue = bus.CategoryID.ToString();
    }
Exemplo n.º 14
0
 public void Update(BLLCategory category)
 {
     uow.Categories.UpDate(CategoryMapper.GetDALEntity(category));
     uow.Commit();
 }