Beispiel #1
0
        public CharacteristicsDetails Details(Int32 CharacteristicsID)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "SELECT " +
                             "CharacteristicsID, " +
                             "CharacteristicsCode, " +
                             "CharacteristicsName " +
                             "FROM tblCharacteristics " +
                             "WHERE CharacteristicsID = @CharacteristicsID;";

                cmd.Parameters.AddWithValue("@CharacteristicsID", CharacteristicsID);

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                CharacteristicsDetails Details = new CharacteristicsDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.CharacteristicsID   = Int32.Parse(dr["CharacteristicsID"].ToString());
                    Details.CharacteristicsCode = dr["CharacteristicsCode"].ToString();
                    Details.CharacteristicsName = dr["CharacteristicsName"].ToString();
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #2
0
		public Int32 Insert(CharacteristicsDetails Details)
		{
			try 
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL = "INSERT INTO tblCharacteristics (CharacteristicsCode, CharacteristicsName) VALUES (@CharacteristicsCode, @CharacteristicsName);";
				  
				cmd.Parameters.AddWithValue("@CharacteristicsCode", Details.CharacteristicsCode);
                cmd.Parameters.AddWithValue("@CharacteristicsName", Details.CharacteristicsName);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);

                return Int32.Parse(base.getLAST_INSERT_ID(this));
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Beispiel #3
0
        public Int32 Insert(CharacteristicsDetails Details)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "INSERT INTO tblCharacteristics (CharacteristicsCode, CharacteristicsName) VALUES (@CharacteristicsCode, @CharacteristicsName);";

                cmd.Parameters.AddWithValue("@CharacteristicsCode", Details.CharacteristicsCode);
                cmd.Parameters.AddWithValue("@CharacteristicsName", Details.CharacteristicsName);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);

                return(Int32.Parse(base.getLAST_INSERT_ID(this)));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #4
0
		public void Update(CharacteristicsDetails Details)
		{
			try 
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL=	"UPDATE tblCharacteristics SET " + 
							"CharacteristicsCode = @CharacteristicsCode, " +  
							"CharacteristicsName = @CharacteristicsName " +  
							"WHERE CharacteristicsID = @CharacteristicsID;";

                cmd.Parameters.AddWithValue("@CharacteristicsCode", Details.CharacteristicsCode);
                cmd.Parameters.AddWithValue("@CharacteristicsName", Details.CharacteristicsName);
                cmd.Parameters.AddWithValue("@CharacteristicsID", Details.CharacteristicsID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Beispiel #5
0
        public void Update(CharacteristicsDetails Details)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "UPDATE tblCharacteristics SET " +
                             "CharacteristicsCode = @CharacteristicsCode, " +
                             "CharacteristicsName = @CharacteristicsName " +
                             "WHERE CharacteristicsID = @CharacteristicsID;";

                cmd.Parameters.AddWithValue("@CharacteristicsCode", Details.CharacteristicsCode);
                cmd.Parameters.AddWithValue("@CharacteristicsName", Details.CharacteristicsName);
                cmd.Parameters.AddWithValue("@CharacteristicsID", Details.CharacteristicsID);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #6
0
		public CharacteristicsDetails Details(Int32 CharacteristicsID)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL=	"SELECT " +
								"CharacteristicsID, " +
								"CharacteristicsCode, " +
								"CharacteristicsName " +
							"FROM tblCharacteristics " +
							"WHERE CharacteristicsID = @CharacteristicsID;";

                cmd.Parameters.AddWithValue("@CharacteristicsID", CharacteristicsID);

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                CharacteristicsDetails Details = new CharacteristicsDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.CharacteristicsID = Int32.Parse(dr["CharacteristicsID"].ToString());
                    Details.CharacteristicsCode = dr["CharacteristicsCode"].ToString();
                    Details.CharacteristicsName = dr["CharacteristicsName"].ToString();
                }

                return Details;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}