public bool AddMQualification(MQualification mqualification) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddMQualification"; cmd.Parameters.AddWithValue("@QualificationNo", mqualification.QualificationNo); cmd.Parameters.AddWithValue("@QualificationName", mqualification.QualificationName); cmd.Parameters.AddWithValue("@ShortName", mqualification.ShortName); cmd.Parameters.AddWithValue("@IsActive", mqualification.IsActive); cmd.Parameters.AddWithValue("@UserID", mqualification.UserID); cmd.Parameters.AddWithValue("@UserDate", mqualification.UserDate); cmd.Parameters.AddWithValue("@CompanyNo", mqualification.CompanyNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mqualification.msg = ObjTrans.ErrorMessage; return(false); } }
public MQualification ModifyMQualificationByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MQualification where QualificationNo =" + ID; cmd = new SqlCommand(sql, Con); cmd.Connection = Con; Con.Open(); cmd.CommandType = CommandType.Text; SqlDataReader dr; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.HasRows) { MQualification MM = new MQualification(); while (dr.Read()) { MM.QualificationNo = Convert.ToInt32(dr["QualificationNo"]); if (!Convert.IsDBNull(dr["QualificationName"])) { MM.QualificationName = Convert.ToString(dr["QualificationName"]); } if (!Convert.IsDBNull(dr["ShortName"])) { MM.ShortName = Convert.ToString(dr["ShortName"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } if (!Convert.IsDBNull(dr["UserDate"])) { MM.UserDate = Convert.ToDateTime(dr["UserDate"]); } if (!Convert.IsDBNull(dr["ModifiedBy"])) { MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new MQualification()); }
public bool DeleteMQualification(MQualification mqualification) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteMQualification"; cmd.Parameters.AddWithValue("@QualificationNo", mqualification.QualificationNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mqualification.msg = ObjTrans.ErrorMessage; return(false); } }