Пример #1
0
        public PromoTypeDetails Details(Int32 PromoTypeID)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "SELECT " +
                             "PromoTypeID, " +
                             "PromoTypeCode, " +
                             "PromoTypeName " +
                             "FROM tblPromoType a " +
                             "WHERE a.PromoTypeID = @PromoTypeID;";

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

                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);

                PromoTypeDetails Details = new PromoTypeDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.PromoTypeID   = Int32.Parse(dr["PromoTypeID"].ToString());
                    Details.PromoTypeCode = dr["PromoTypeCode"].ToString();
                    Details.PromoTypeName = dr["PromoTypeName"].ToString();
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #2
0
		public void Update(PromoTypeDetails Details)
		{
			try 
			{
                Save(Details);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #3
0
 public void Update(PromoTypeDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
Пример #4
0
		public Int32 Insert(PromoTypeDetails Details)
		{
			try 
			{
                Save(Details);

                return Int32.Parse(base.getLAST_INSERT_ID(this));
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #5
0
        public Int32 Insert(PromoTypeDetails Details)
        {
            try
            {
                Save(Details);

                return(Int32.Parse(base.getLAST_INSERT_ID(this)));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #6
0
        public Int32 Save(PromoTypeDetails Details)
        {
            try
            {
                string SQL = "CALL procSavePromoType(@PromoTypeID, @PromoTypeCode, @PromoTypeName, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("PromoTypeID", Details.PromoTypeID);
                cmd.Parameters.AddWithValue("PromoTypeCode", Details.PromoTypeCode);
                cmd.Parameters.AddWithValue("PromoTypeName", Details.PromoTypeName);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #7
0
        public Int32 Save(PromoTypeDetails Details)
        {
            try
            {
                string SQL = "CALL procSavePromoType(@PromoTypeID, @PromoTypeCode, @PromoTypeName, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("PromoTypeID", Details.PromoTypeID);
                cmd.Parameters.AddWithValue("PromoTypeCode", Details.PromoTypeCode);
                cmd.Parameters.AddWithValue("PromoTypeName", Details.PromoTypeName);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return(base.ExecuteNonQuery(cmd));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #8
0
		public PromoTypeDetails Details(Int32 PromoTypeID)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
				
				string SQL=	"SELECT " +
					            "PromoTypeID, " +
					            "PromoTypeCode, " +
					            "PromoTypeName " +
					        "FROM tblPromoType a " +
					        "WHERE a.PromoTypeID = @PromoTypeID;";

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

                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);

                PromoTypeDetails Details = new PromoTypeDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.PromoTypeID = Int32.Parse(dr["PromoTypeID"].ToString());
                    Details.PromoTypeCode = dr["PromoTypeCode"].ToString();
                    Details.PromoTypeName = dr["PromoTypeName"].ToString();
                }

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