protected void gvStock_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { _currentStock = new StockDL(); _currentStock.StockID = Convert.ToInt32(gvStock.DataKeys[e.RowIndex].Value); _currentStock.ScreenMode = ScreenMode.Delete; TransactionResult transactionResult = _currentStock.Commit(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');")); stringBuilder.Append("</script>"); ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false); if (transactionResult.Status == TransactionStatus.Success) { GetStockDetails(); } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageStock.aspx", "", "gvStock_RowDeleting", exception1.Message.ToString(), new ACEConnection()); throw; } }
protected void btnStockAdd_Click(object sender, ImageClickEventArgs e) { try { _currentStock = new StockDL(); bool bl = lblStockID.Text.ToString() == "0"; _currentStock.AddEditOption = !bl ? 1 : 0; _currentStock.StockID = Convert.ToInt32(lblStockID.Text.ToString()); _currentStock.MaterialID = Convert.ToInt32(ddlMaterial.SelectedValue); _currentStock.AuditID = Convert.ToInt32(hfUserID.Value); _currentStock.AvailableCount = Convert.ToInt32(txtAvailablecount.Text); _currentStock.ScreenMode = ScreenMode.Add; TransactionResult transactionResult = _currentStock.Commit(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');")); stringBuilder.Append("</script>"); ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false); bl = transactionResult.Status != TransactionStatus.Success; if (!bl) { GetStockDetails(); txtAvailablecount.Text = "0"; lblStockID.Text = "0"; } else { txtAvailablecount.Text = "0"; lblStockID.Text = "0"; } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageStock.aspx", "", "btnStockAdd_Click", exception1.Message.ToString(), new ACEConnection()); throw; } }