Example #1
0
        private void bbiDeleteProductGroup_ItemClick(object sender, ItemClickEventArgs e)
        {
            DialogResult result = XtraMessageBox.Show("Bạn có chắc muốn xóa không?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                foreach (var rowHandle in gridView1.GetSelectedRows())
                {
                    var productGroupId = gridView1.GetRowCellValue(rowHandle, "ProductGroupID");
                    if (productGroupId != null)
                    {
                        ProductGroup productGroup = _productGroupService.GetProductGrouprById(productGroupId.ToString());
                        if (productGroup != null)
                        {
                            try
                            {
                                _productGroupService.Delete(productGroupId.ToString());
                            }
                            catch (Exception ex)
                            {
                                MessageBoxHelper.ShowMessageBoxError(ex.Message);
                            }
                        }
                    }
                }
                LoadData();
            }
            else
            {
                EnableButtonUpdateAndDelete(false);
            }
        }
        public ActionResult DeleteProductGroup(int GroupID, short RowVersion)
        {
            if (!CheckIsLogin())
            {
                return(Redirect(res.Pageviews.PvMemberSignIn));
            }

            var svProductGroup = new ProductGroupService();

            try
            {
                svProductGroup.Delete(GroupID, LogonCompID);
                return(Json(new { IsResult = svProductGroup.IsResult, MsgError = GenerateMsgError(svProductGroup.MsgError) }));
            }
            catch (Exception ex)
            {
                CreateLogFiles(ex);
            }
            return(Json(new { IsResult = svProductGroup.IsResult, MsgError = GenerateMsgError(svProductGroup.MsgError) }));
        }
Example #3
0
        /// <summary>
        /// Xóa
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItemDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            DialogResult result = XtraMessageBox.Show("Bạn có chắc muốn xóa không?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                foreach (var rowHandle in gridView1.GetSelectedRows())
                {
                    var productGroupId = gridView1.GetRowCellValue(rowHandle, "ProductGroupID");
                    if (productGroupId != null)
                    {
                        ProductGroup productGroup = _productGroupService.GetProductGrouprById(productGroupId.ToString());
                        if (productGroup != null)
                        {
                            try
                            {
                                _productGroupService.Delete(productGroupId.ToString());
                            }
                            catch (Exception ex)
                            {
                                XtraMessageBox.Show(string.Format("Lỗi! \n {0}", ex.Message), "THÔNG BÁO",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                LoadProductGroups();
            }
            else
            {
                EnableButtonUpdateAndDelete(false);
            }


            //if (!string.IsNullOrEmpty(ProductGroupId))
            //{
            //    ProductGroup productGroup = _productGroupService.GetProductGrouprById(ProductGroupId);
            //    if (productGroup != null)
            //    {
            //        DialogResult result = XtraMessageBox.Show("Bạn có chắc muốn xóa thông tin Nhóm Hàng : " + productGroup.ProductGroupName +" này không?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            //        if (result == DialogResult.Yes)
            //        {
            //            try
            //            {
            //                _productGroupService.Delete(ProductGroupId);
            //                LoadProductGroups();

            //                // ProductGroupId == null
            //                EnableButtonUpdateAndDelete(false);
            //            }
            //            catch (Exception ex)
            //            {
            //                XtraMessageBox.Show(string.Format("Lỗi! \n {0}", ex.Message), "THÔNG BÁO",
            //                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            //            }

            //        }
            //    }
            //}
            //else
            //    XtraMessageBox.Show("Vui lòng chọn một Nhóm Hàng cần sửa!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }