private void GetOperations()
        {
            try
            {
                if (Request["id"] != null)
                {
                    int resourceID            = int.Parse(Request["id"]);
                    OperationManager    opMan = new OperationManager();
                    OperationCollection ops   = opMan.FindOperationsByResources(resourceID);

                    cbxListOperation.Items.Clear();
                    foreach (Operation op in ops)
                    {
                        OperationCategoryManager opCatMan = new OperationCategoryManager();
                        OperationCategory        opCat    = opCatMan.GetOperationCategory(op.OperationCode);
                        ListItem cbxOperation             = new ListItem(opCat.Name, op.OperationCode.ToString());
                        ListItem cbxDenyOperation         = new ListItem(opCat.Name, op.OperationCode.ToString());
                        cbxListOperation.Items.Add(cbxOperation);
                        cbxListDenyOperation.Items.Add(cbxDenyOperation);
                    }
                }
            }
            catch (Exception ex)
            {
                ucErrorBox.Message = ex.Message;
                CurrentFormState   = FormState.ErrorState;
            }
        }
Beispiel #2
0
        private void LoadOperations(string resourceTypeCode)
        {
            try
            {
                OperationCategoryManager    opCatMan = new OperationCategoryManager();
                OperationCategoryCollection opCats   = opCatMan.GetAllOperationCategories();

                OperationManager    opMan = new OperationManager();
                OperationCollection ops   = opMan.FindOperationsByResourceType(resourceTypeCode);

                cbxListOperations.Items.Clear();
                foreach (OperationCategory opCat in opCats)
                {
                    ListItem cbxOperation = new ListItem(opCat.Name, opCat.OperationCode.ToString());
                    foreach (Operation op in ops)
                    {
                        if (op.OperationCode == opCat.OperationCode)
                        {
                            cbxOperation.Selected = true;
                        }
                    }
                    cbxListOperations.Items.Add(cbxOperation);
                }
            }
            catch (Exception ex)
            {
                ucErrorBox.Message = ex.Message;
                CurrentFormState   = FormState.ErrorState;
                this.SaveErrorLog(ex);
            }
        }
        protected void LoadOperationCat()
        {
            if (Request.QueryString["code"] == string.Empty)
            {
                return;
            }
            OperationCategoryManager operationCatManager = new OperationCategoryManager();
            OperationCategory        operationCat        = new OperationCategory();

            operationCat        = operationCatManager.GetOperationCategory(int.Parse(Request.QueryString["code"]));
            txtName.Text        = operationCat.Name;
            txtDescription.Text = operationCat.Description;
        }
        private void LoadOperationCatList()
        {
            OperationCategoryCollection operationCats    = new OperationCategoryCollection();
            OperationCategoryManager    operationManager = new OperationCategoryManager();

            operationCats = operationManager.GetAllOperationCategories();

            dgridOperationCatList.DataSource = operationCats;
            dgridOperationCatList.DataBind();
            if (dgridOperationCatList.Rows.Count <= 0)
            {
                uctErrorBox.Visible = true;
                uctErrorBox.Message = "Không có dữ liệu";
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            OperationCategoryManager operationManager = new OperationCategoryManager();

            try
            {
                operationManager.Create(txtName.Text.Trim(), txtDescription.Text.Trim());
                this.SaveActionLog("Tạo mới", "Tạo mới loại thao tác " + txtName.Text);
                uctConfirmBox.Visible        = true;
                uctConfirmBox.ConfirmMessage = "Tạo thành công. <br/> Bạn tiếp tục tạo thao tác mới không ?";
            }
            catch (Exception ex)
            {
                this.uctErrorBox.Visible = true;
                this.uctErrorBox.Message = "Hệ thống có lỗi: " + ex.Message;
                this.SaveErrorLog(ex);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            OperationCategoryManager OperationCatManager = new OperationCategoryManager();

            try
            {
                OperationCategory operationCat =
                    new OperationCategory(int.Parse(Request.QueryString["code"]), txtName.Text.Trim(), txtDescription.Text.Trim());
                OperationCatManager.Update(operationCat);
                Response.Redirect("../Manage/");
            }
            catch (Exception ex)
            {
                uctErrorBox.Visible = true;
                uctErrorBox.Message = "Hệ thống có lỗi: " + ex.Message;

                this.SaveErrorLog(ex);
            }
        }
        protected void lBtnDelete_Click(object sender, EventArgs e)
        {
            LinkButton imgBtn = (LinkButton)sender;
            OperationCategoryManager operCatManager = new OperationCategoryManager();

            OperationCategory operCat = new OperationCategory();

            try
            {
                operCat.OperationCode = int.Parse(imgBtn.CommandArgument);
                operCatManager.Remove(operCat);
                SaveActionLog("Xóa Loại thao tác", "OperationCode: " + imgBtn.CommandArgument);
                LoadOperationCatList();
            }
            catch (Exception ex)
            {
                uctErrorBox.Visible = true;
                uctErrorBox.Message = "Xóa không thành công ";
                this.SaveErrorLog(ex);
            }
        }
Beispiel #8
0
        /// <summary>
        ///     初始化商品类目树
        /// </summary>
        public void CreateTree(int id = 0)
        {
            ViewBag.id = id;
            var manager     = new OperationCategoryManager();
            var cateItems   = manager.SelectProductCategories();
            var productList = manager.SelectOperationCategoryProducts(id);

            if (productList != null && productList.Count() > 0)
            {
                foreach (var pitem in productList)
                {
                    foreach (var citem in cateItems)
                    {
                        if (pitem.CorrelId.Equals(citem.id))
                        {
                            citem.open      = true;
                            citem.isChecked = true;
                        }
                    }
                }
            }

            ViewBag.CategoryTagManager = JsonConvert.SerializeObject(cateItems).Replace("isChecked", "checked");
        }