Beispiel #1
0
 protected void lnk_Delete_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         int       @int     = WebUtils.GetInt((sender as LinkButton).CommandArgument);
         BrandInfo dataById = Brand.GetDataById(@int);
         if (dataById == null)
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa");
         }
         else if (Brand.Delete(@int))
         {
             this.BindData();
             PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除品牌[" + dataById.BrandName + "] thành công");
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
         }
         else
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại");
         }
     }
 }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvBrand.SelectedRows.Count <= 0)
            {
                MessageBox.Show(@"Please Select One");
                return;
            }

            DialogResult dr = MessageBox.Show(@"R U Sure?", @"Delete Confirmation", MessageBoxButtons.YesNoCancel,
                                              MessageBoxIcon.Warning);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            DAL.Brand br = new Brand();
            br.Id = Convert.ToInt32(dgvBrand.SelectedRows[0].Cells["colId"].Value);

            if (br.Delete())
            {
                MessageBox.Show(@"Data deleted");
                btnSearch.PerformClick();
            }
            else
            {
                MessageBox.Show(br.Error);
            }
        }
        public async Task DeleteAsync(Brand brand)
        {
            brand.Delete();
            await Task.FromResult(_context.Brands.Update(brand));

            await _context.SaveChangesAsync();
        }
Beispiel #4
0
        public HttpResponseMessage Delete([FromUri] int id, [FromBody] int modifiedBy)
        {
            Brand brand = new Brand();

            brand.ID         = id;
            brand.ModifiedBy = modifiedBy;
            return(Request.CreateResponse(HttpStatusCode.OK, brand.Delete()));
        }
        protected void lnkEvet_Click(object sender, EventArgs e)
        {
            int Id = int.Parse(Session["Id"].ToString());

            Brand b = new Brand(Id);

            b.Delete();

            Response.Redirect("List.aspx");
        }
Beispiel #6
0
        public void DeleteItself()
        {
            //Arrange
            Brand sut = new Brand("Brand", new DateTime(2000, 10, 5), null);

            //Act
            sut.Delete();

            //Assert
            Assert.True(sut.Deleted);
        }
Beispiel #7
0
        public void EliminarMarca()
        {
            string ultimaId = ObtenerUltimaID();
            Brand  marca    = new Brand(ultimaId);

            bool seElimino = marca.Delete();
            // confirmamos
            Brand marcaEliminada = new Brand(ultimaId);

            bool noExiste = marcaEliminada.Id == "";

            Assert.IsTrue(seElimino && noExiste, $"No elimino de la base de datos");
        }
        public string DelBrand(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(MessageContent.Submit_InvalidRow);
            }
            Guid gId = Guid.Empty;

            Guid.TryParse(id, out gId);
            if (gId.Equals(Guid.Empty))
            {
                return(MessageContent.GetString(MessageContent.Submit_Params_GetInvalidRegex, "对应标识值"));
            }
            Brand bll = new Brand();

            bll.Delete(gId);

            return("1");
        }
Beispiel #9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Brand brand = new Brand();

            if (myGrid2.SelectedRows.Count <= 0)
            {
                return;
            }
            brand.Id = Convert.ToInt32(myGrid2.SelectedRows[0].Cells["colId"].Value);

            if (brand.Delete())
            {
                MessageBox.Show("Brand Deleted");
                btnSearch.PerformClick();
            }
            else
            {
                MessageBox.Show(brand.Error);
            }
        }
Beispiel #10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvBrand.SelectedRows.Count <= 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show(@"Are you Sure", @"Confirmation", MessageBoxButtons.YesNoCancel);

            if (dr != DialogResult.Yes)
            {
                return;
            }
            brand.Id = Convert.ToInt32(dgvBrand.SelectedRows[0].Cells["colId"].Value);

            if (brand.Delete())
            {
                MessageBox.Show(@"Brand Deleted");
                btnSearch.PerformClick();
            }
        }
Beispiel #11
0
 protected void btn_DelBat_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         string repeaterCheckIDs = base.GetRepeaterCheckIDs(this.Repeater1, "chk", "autoid");
         if (!string.IsNullOrEmpty(repeaterCheckIDs))
         {
             if (Brand.Delete(repeaterCheckIDs))
             {
                 this.BindData();
                 PageBase.log.AddEvent(base.LoginAccount.AccountName, "批量删除品牌成功");
                 base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
             }
             else
             {
                 base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại");
             }
         }
     }
 }