コード例 #1
0
        private static jpqualification ReaderDatajpqualification(MySqlDataReader reader)
        {
            jpqualification objjpqualification = new jpqualification();

            objjpqualification.QUALIFICATIONID = Utility.IsValidInt(reader["QUALIFICATIONID"]);
            objjpqualification.PROFILEID       = Utility.IsValidInt(reader["PROFILEID"]);
            objjpqualification.DEGREENAME      = Utility.IsValidString(reader["DEGREENAME"]);
            objjpqualification.PASSINGYEAR     = Utility.IsValidDateTime(reader["PASSINGYEAR"]);
            objjpqualification.GRADES          = Utility.IsValidString(reader["GRADES"]);
            objjpqualification.INSTITUTIONNAME = Utility.IsValidString(reader["INSTITUTIONNAME"]);
            objjpqualification.DEGREETYPE      = Utility.IsValidString(reader["DEGREETYPE"]);
            return(objjpqualification);
        }
コード例 #2
0
        public static List <jpqualification> Getjpqualification(string whereclause, MySqlConnection conn = null)
        {
            jpqualification        objjpqualification = null;
            List <jpqualification> lstjpqualification = new List <jpqualification>();

            try
            {
                bool            isConnArgNull = (conn != null) ? false : true;
                MySqlConnection connection    = (conn != null) ? conn : PrimaryConnection();
                tryOpenConnection(connection);
                string sql = "select * from jpqualification ";
                if (!string.IsNullOrEmpty(whereclause))
                {
                    sql += " where " + whereclause;
                }
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = sql;
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                objjpqualification = ReaderDatajpqualification(reader);
                                lstjpqualification.Add(objjpqualification);
                            }
                        }
                        else
                        {
                        }
                    }
                }

                if (isConnArgNull == true)
                {
                    connection.Dispose();
                }
            }
            catch (Exception ex)
            {
                Logger._log.Error(ex.Message + "\n" + ex.StackTrace);
            }

            return(lstjpqualification);
        }
コード例 #3
0
        public static string Savejpqualification(jpqualification objjpqualification, MySqlConnection conn = null, MySqlTransaction trans = null)
        {
            string returnMessage    = "";
            string sQUALIFICATIONID = "";

            sQUALIFICATIONID = objjpqualification.QUALIFICATIONID.ToString();
            var templstjpqualification = Getjpqualification("QUALIFICATIONID = '" + sQUALIFICATIONID + "'", conn);

            try
            {
                bool            isConnArgNull = (conn != null) ? false : true;
                MySqlConnection connection    = (conn != null) ? conn : PrimaryConnection();
                tryOpenConnection(connection);
                using (MySqlCommand command = new MySqlCommand())
                {
                    string sql;
                    bool   isEdit = true;
                    if (templstjpqualification.Count <= 0)
                    {
                        isEdit = false;
                        sql    = @"INSERT INTO jpqualification(
PROFILEID,
DEGREENAME,
PASSINGYEAR,
GRADES,
INSTITUTIONNAME,
DEGREETYPE
)
VALUES(
@PROFILEID,
@DEGREENAME,
@PASSINGYEAR,
@GRADES,
@INSTITUTIONNAME,
@DEGREETYPE
)";
                    }
                    else
                    {
                        sql = @"Update jpqualification set
QUALIFICATIONID=@QUALIFICATIONID,
PROFILEID=@PROFILEID,
DEGREENAME=@DEGREENAME,
PASSINGYEAR=@PASSINGYEAR,
GRADES=@GRADES,
INSTITUTIONNAME=@INSTITUTIONNAME,
DEGREETYPE=@DEGREETYPE

Where QUALIFICATIONID=@QUALIFICATIONID";
                    }
                    if (trans != null)
                    {
                        command.Transaction = trans;
                    }
                    command.Connection  = connection;
                    command.CommandType = CommandType.Text;
                    command.CommandText = sql;
                    if (isEdit)
                    {
                        command.Parameters.AddWithValue("@QUALIFICATIONID", objjpqualification.QUALIFICATIONID);
                    }

                    command.Parameters.AddWithValue("@PROFILEID", objjpqualification.PROFILEID);
                    command.Parameters.AddWithValue("@DEGREENAME", objjpqualification.DEGREENAME);
                    command.Parameters.AddWithValue("@PASSINGYEAR", objjpqualification.PASSINGYEAR);
                    command.Parameters.AddWithValue("@GRADES", objjpqualification.GRADES);
                    command.Parameters.AddWithValue("@INSTITUTIONNAME", objjpqualification.INSTITUTIONNAME);
                    command.Parameters.AddWithValue("@DEGREETYPE", objjpqualification.DEGREETYPE);
                    int affectedRows = command.ExecuteNonQuery();
                    if (affectedRows > 0)
                    {
                        returnMessage = "OK";
                    }
                    else
                    {
                        returnMessage = "Unable to save, Please contact ISD";
                    }
                }

                if (isConnArgNull == true)
                {
                    connection.Dispose();
                }
            }
            catch (Exception ex)
            {
                Logger._log.Error(ex.Message + "\n" + ex.StackTrace);
            }

            return(returnMessage);
        }