protected void btnMaterialAdd_Click(object sender, ImageClickEventArgs e) { try { _currentMaterial = new MaterialDL(); bool bl = txtMaterialID.Text.ToString() == "0"; _currentMaterial.AddEditOption = !bl ? 1 : 0; _currentMaterial.MaterialID = Convert.ToInt32(txtMaterialID.Text.ToString()); _currentMaterial.MaterialDescription = txtMaterial.Text.ToString(); _currentMaterial.ScreenMode = ScreenMode.Add; TransactionResult transactionResult = _currentMaterial.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) { GetMaterialDetails(); txtMaterial.Text = ""; txtMaterialID.Text = "0"; } else { txtMaterial.Text = ""; txtMaterialID.Text = "0"; } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageMaterial.aspx", "", "btnMaterialAdd_Click", exception1.Message.ToString(), new ACEConnection()); throw; } }
protected void gvMaterial_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { _currentMaterial = new MaterialDL(); _currentMaterial.MaterialID = Convert.ToInt32(gvMaterial.DataKeys[e.RowIndex].Value); _currentMaterial.ScreenMode = ScreenMode.Delete; TransactionResult transactionResult = _currentMaterial.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) { GetMaterialDetails(); } } catch (Exception exception1) { ErrorLog.LogErrorMessageToDB("ManageMaterial.aspx", "", "gvMaterial_RowDeleting", exception1.Message.ToString(), new ACEConnection()); throw; } }