Exemplo n.º 1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                SpaMaster MyMasterPage = (SpaMaster)Page.Master;
                if (!string.IsNullOrEmpty(hdnitmID.Value.ToString()))
                {
                    AdminBLL ws = new AdminBLL();
                    DeleteInventoryRequest _req = new DeleteInventoryRequest();

                    _req.InventoryItemId = hdnitmID.Value.ToString();
                    ws.DeleteInventory(_req);
                    ModalPopupDelete.Hide();
                    BindGridTelerik();
                    MyMasterPage.ShowErrorMessage("Record Deleted Successfully..!");
                    // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "AlertMessage", " alert('Record Deleted Successfully..!');", true);

                    //HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "DELETE");
                    //Server.Transfer("CompleteForm.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
Exemplo n.º 2
0
        // [RequiresAnyRole("")]
        public DeleteInventoryResponse Delete(DeleteInventoryRequest request)
        {
            var Validation = new ValidateDeleteInventory();
            var Valid      = Validation.Validate(request);

            if (!Valid.IsValid)
            {
                return(new DeleteInventoryResponse()
                {
                    Message = Valid.Errors.Select(A => A.ErrorMessage).Join("\n"),
                    Success = false
                });
            }
            var User = this.GetCurrentAppUser();
            var ExistingInventory = Db.Single <Inventory>(A => A.Id == request.InventoryId && A.UserId == User.Id);

            if (ExistingInventory == null)
            {
                return(new DeleteInventoryResponse()
                {
                    Success = false,
                    Message = "No Such Inventory"
                });
            }

            var Deleted = Db.DeleteById <Inventory>(request.InventoryId);

            return(new DeleteInventoryResponse()
            {
                TotalDeleted = Deleted,
                Success = true,
            });
        }
Exemplo n.º 3
0
 public void DeleteInventory(DeleteInventoryRequest argObj)
 {
     try
     {
         AdminDAL ws = new AdminDAL();
         ws.DeleteInventoryUser(argObj);
     }
     catch (Exception ex)
     {
     }
 }