Exemplo n.º 1
0
        private static jpexperience ReaderDatajpexperience(MySqlDataReader reader)
        {
            jpexperience objjpexperience = new jpexperience();

            objjpexperience.experienceID     = Utility.IsValidInt(reader["experienceID"]);
            objjpexperience.cvID             = Utility.IsValidInt(reader["cvID"]);
            objjpexperience.organizationName = Utility.IsValidString(reader["organizationName"]);
            objjpexperience.startingYear     = Utility.IsValidDateTime(reader["startingYear"]);
            objjpexperience.endingYear       = Utility.IsValidDateTime(reader["endingYear"]);
            objjpexperience.designation      = Utility.IsValidString(reader["designation"]);
            return(objjpexperience);
        }
Exemplo n.º 2
0
        public static List <jpexperience> Getjpexperience(string whereclause, MySqlConnection conn = null)
        {
            jpexperience        objjpexperience = null;
            List <jpexperience> lstjpexperience = new List <jpexperience>();

            try
            {
                bool            isConnArgNull = (conn != null) ? false : true;
                MySqlConnection connection    = (conn != null) ? conn : PrimaryConnection();
                tryOpenConnection(connection);
                string sql = "";
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = sql;
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                objjpexperience = ReaderDatajpexperience(reader);
                                lstjpexperience.Add(objjpexperience);
                            }
                        }
                        else
                        {
                        }
                    }
                }

                if (isConnArgNull == true)
                {
                    connection.Dispose();
                }
            }
            catch (Exception ex)
            {
            }

            return(lstjpexperience);
        }
Exemplo n.º 3
0
        public static string Savejpexperience(jpexperience objjpexperience, MySqlConnection conn = null)
        {
            string returnMessage = "";
            string sexperienceID = "";

            sexperienceID = objjpexperience.experienceID.ToString();
            var templstjpexperience = Getjpexperience("experienceID = '" + sexperienceID + "'", 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 (templstjpexperience.Count <= 0)
                    {
                        isEdit = false;
                        sql    = @"INSERT INTO jpexperience(
cvID,
organizationName,
startingYear,
endingYear,
designation
)
VALUES(
@cvID,
@organizationName,
@startingYear,
@endingYear,
@designation
)";
                    }
                    else
                    {
                        sql = @"Update jpexperience set
experienceID=@experienceID,
cvID=@cvID,
organizationName=@organizationName,
startingYear=@startingYear,
endingYear=@endingYear,
designation=@designation

Where experienceID=@experienceID";
                    }

                    command.Connection  = connection;
                    command.CommandType = CommandType.Text;
                    command.CommandText = sql;
                    if (isEdit)
                    {
                        command.Parameters.AddWithValue("@experienceID", objjpexperience.experienceID);
                    }

                    command.Parameters.AddWithValue("@cvID", objjpexperience.cvID);
                    command.Parameters.AddWithValue("@organizationName", objjpexperience.organizationName);
                    command.Parameters.AddWithValue("@startingYear", objjpexperience.startingYear);
                    command.Parameters.AddWithValue("@endingYear", objjpexperience.endingYear);
                    command.Parameters.AddWithValue("@designation", objjpexperience.designation);
                    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)
            {
            }

            return(returnMessage);
        }