public MessageModel UpdatePathology(DAL.Model.PathologyMaster Pathology) { int UpdatePathology = new ServiceGateway().PathologyUpdate(Pathology); if (UpdatePathology > 0) { messageModel.MessageBody = "Update successfully."; messageModel.MessageTitle = "Successfull"; } return(messageModel); }
public int PathologyUpdate(DAL.Model.PathologyMaster Pathology) { Command = new SqlCommand("Update tblPathology set PathologyName=@PathologyName ,Address=@Address,Alias=@Alias,UserID= @UserID where PathId=@PathId ", Connection); Command.CommandType = CommandType.Text; Command.Parameters.AddWithValue("@PathologyName", Pathology.PathologyName); Command.Parameters.AddWithValue("@Address", Pathology.Address); Command.Parameters.AddWithValue("@Alias", Pathology.Alias); Command.Parameters.AddWithValue("@PathId", Pathology.PathId); Command.Parameters.AddWithValue("@UserID", Pathology.UserId); int count = Command.ExecuteNonQuery(); return(count); }
private void UpdatePathology() { try { DAL.Model.PathologyMaster Pathology = new DAL.Model.PathologyMaster(); Pathology.PathId = txtID.Text;; Pathology.PathologyName = Convert.ToString(txtName.Text); Pathology.Address = Convert.ToString(txtAddress.Text); Pathology.Alias = Convert.ToString(txtAlias.Text); Pathology.UserId = MainWindow.userName; MessageModel messageModel = new BAL.Manager.ServiceManager().UpdatePathology(Pathology); MessageBox.Show(messageModel.MessageBody, messageModel.MessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); SetNew(); } catch (Exception error) { MessageBox.Show("Failed to save Pathology! " + error.Message.ToString(), "Failed", MessageBoxButtons.OK, MessageBoxIcon.Information); } }