Exemple #1
0
        public Int32 Save(DiscountDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveDiscount(@DiscountID, @DiscountCode, @DiscountType, @DiscountPrice, @InPercent, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("DiscountID", Details.DiscountID);
                cmd.Parameters.AddWithValue("DiscountCode", Details.DiscountCode);
                cmd.Parameters.AddWithValue("DiscountType", Details.DiscountType);
                cmd.Parameters.AddWithValue("DiscountPrice", Details.DiscountPrice);
                cmd.Parameters.AddWithValue("InPercent", Details.InPercent);
                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);
            }
        }
Exemple #2
0
        public Int32 Save(DiscountDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveDiscount(@DiscountID, @DiscountCode, @DiscountType, @DiscountPrice, @InPercent, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("DiscountID", Details.DiscountID);
                cmd.Parameters.AddWithValue("DiscountCode", Details.DiscountCode);
                cmd.Parameters.AddWithValue("DiscountType", Details.DiscountType);
                cmd.Parameters.AddWithValue("DiscountPrice", Details.DiscountPrice);
                cmd.Parameters.AddWithValue("InPercent", Details.InPercent);
                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);
            }
        }
Exemple #3
0
        public DiscountDetails Details(string DiscountCode)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect() + "WHERE DiscountCode = @DiscountCode;";

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

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

                DiscountDetails Details = new DiscountDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.DiscountID    = Int32.Parse(dr["DiscountID"].ToString());
                    Details.DiscountCode  = "" + dr["DiscountCode"].ToString();
                    Details.DiscountType  = "" + dr["DiscountType"].ToString();
                    Details.DiscountPrice = Decimal.Parse(dr["DiscountPrice"].ToString());
                    Details.InPercent     = bool.Parse(dr["InPercent"].ToString());
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #4
0
		public void Update(DiscountDetails Details)
		{
			try 
			{
                Save(Details);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemple #5
0
 public void Update(DiscountDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
Exemple #6
0
		public Int32 Insert(DiscountDetails Details)
		{
			try 
			{
                Save(Details);

                return Int32.Parse(base.getLAST_INSERT_ID(this));
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemple #7
0
        public Int32 Insert(DiscountDetails Details)
        {
            try
            {
                Save(Details);

                return(Int32.Parse(base.getLAST_INSERT_ID(this)));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #8
0
		public DiscountDetails Details(string DiscountCode)
		{
			try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL=	SQLSelect() + "WHERE DiscountCode = @DiscountCode;";
				  
                cmd.Parameters.AddWithValue("@DiscountCode", DiscountCode);

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

                DiscountDetails Details = new DiscountDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.DiscountID = Int32.Parse(dr["DiscountID"].ToString());
                    Details.DiscountCode = "" + dr["DiscountCode"].ToString();
                    Details.DiscountType = "" + dr["DiscountType"].ToString();
                    Details.DiscountPrice = Decimal.Parse(dr["DiscountPrice"].ToString());
                    Details.InPercent = bool.Parse(dr["InPercent"].ToString());
                }

				return Details;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemple #9
0
		private Int32 SaveRecord()
		{
			Discount clsDiscount = new Discount();
			DiscountDetails clsDetails = new DiscountDetails();

			clsDetails.DiscountCode = txtDiscountCode.Text;
			clsDetails.DiscountType = txtDiscountType.Text;
			clsDetails.DiscountPrice = Convert.ToDecimal(txtDiscountPrice.Text);
			clsDetails.InPercent = Convert.ToBoolean(chkInPercent.Checked);

			int id = clsDiscount.Insert(clsDetails);
			
			clsDiscount.CommitAndDispose();

			return id;
		}
Exemple #10
0
		private void SaveRecord()
		{
			Discount clsDiscount = new Discount();
			DiscountDetails clsDetails = new DiscountDetails();

			clsDetails.DiscountID = Convert.ToInt16(lblDiscountID.Text);
			clsDetails.DiscountCode = txtDiscountCode.Text;
			clsDetails.DiscountType = txtDiscountType.Text;
			clsDetails.DiscountPrice = Convert.ToDecimal(txtDiscountPrice.Text);
			clsDetails.InPercent = Convert.ToBoolean(chkInPercent.Checked);

			clsDiscount.Update(clsDetails);
			clsDiscount.CommitAndDispose();
		}