Пример #1
0
        public Int64 Insert(ProductGroupChargeDetails Details)
        {
            try
            {
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

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

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);


                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

                return(iID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #2
0
        public void Update(ProductGroupChargeDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblProductGroupCharges SET " +
                             "ChargeTypeID	=	@ChargeTypeID, "+
                             "ChargeAmount	=	@ChargeAmount, "+
                             "InPercent		=	@InPercent "+
                             "WHERE GroupID		=	@GroupID "+
                             "AND ChargeID		=	@ChargeID;";

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

                cmd.Parameters.AddWithValue("@ChargeTypeID", Details.ChargeTypeID);
                cmd.Parameters.AddWithValue("@ChargeAmount", Details.ChargeAmount);
                cmd.Parameters.AddWithValue("@InPercent", Details.InPercent);
                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@ChargeID", Details.ChargeID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #3
0
        public Int32 Save(ProductGroupChargeDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupCharges(@ChargeID, @GroupID, @ChargeTypeID, @ChargeAmount, @InPercent, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ChargeID", Details.ChargeID);
                cmd.Parameters.AddWithValue("GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("ChargeTypeID", Details.ChargeTypeID);
                cmd.Parameters.AddWithValue("ChargeAmount", Details.ChargeAmount);
                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);
            }
        }
Пример #4
0
		public Int64 Insert(ProductGroupChargeDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

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

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);
                

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #5
0
        public ProductGroupChargeDetails Details(Int64 ChargeID)
        {
            try
            {
                string SQL = "SELECT " +
                             "a.ChargeID, " +
                             "a.GroupID, " +
                             "a.ChargeTypeID, " +
                             "b.ChargeType, " +
                             "a.ChargeAmount, " +
                             "a.InPercent " +
                             "FROM tblProductGroupCharges a " +
                             "LEFT JOIN tblChargeType b ON a.ChargeTypeID = b.ChargeTypeID " +
                             "WHERE ChargeID = @ChargeID ";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmChargeID = new MySqlParameter("@ChargeID", MySqlDbType.Int64);
                prmChargeID.Value = ChargeID;
                cmd.Parameters.Add(prmChargeID);

                ProductGroupChargeDetails Details = new ProductGroupChargeDetails();

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
                while (myReader.Read())
                {
                    Details.ChargeID     = myReader.GetInt64("ChargeID");
                    Details.GroupID      = myReader.GetInt64("GroupID");
                    Details.ChargeTypeID = myReader.GetInt32("ChargeTypeID");
                    Details.ChargeType   = "" + myReader["ChargeType"].ToString();
                    Details.ChargeAmount = myReader.GetDecimal("ChargeAmount");
                    Details.InPercent    = myReader.GetBoolean("InPercent");
                }

                myReader.Close();

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #6
0
		private void SaveRecord()
		{
			ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges();
			ProductGroupChargeDetails clsDetails = new ProductGroupChargeDetails();

			clsDetails.ChargeID = Convert.ToInt64(lblChargeID.Text);
			clsDetails.GroupID = Convert.ToInt64(lblProductGroupID.Text);
			clsDetails.ChargeTypeID = Convert.ToInt32(cboChargeType.SelectedItem.Value);
			clsDetails.ChargeType = cboChargeType.SelectedItem.Text;
			clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text);
			clsDetails.InPercent = chkInPercent.Checked;

			clsProductGroupCharge.Update(clsDetails);
			
			clsProductGroupCharge.CommitAndDispose();
		}
Пример #7
0
		public void Update(ProductGroupChargeDetails Details)
		{
			try 
			{
				string SQL = "UPDATE tblProductGroupCharges SET " + 
								"ChargeTypeID	=	@ChargeTypeID, " +
								"ChargeAmount	=	@ChargeAmount, " +
								"InPercent		=	@InPercent " + 
							"WHERE GroupID		=	@GroupID " +
							    "AND ChargeID		=	@ChargeID;";
				 
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@ChargeTypeID", Details.ChargeTypeID);
                cmd.Parameters.AddWithValue("@ChargeAmount", Details.ChargeAmount);
                cmd.Parameters.AddWithValue("@InPercent", Details.InPercent);
                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@ChargeID", Details.ChargeID);

				base.ExecuteNonQuery(cmd);

			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #8
0
		public ProductGroupChargeDetails Details(Int64 ChargeID)
		{
			try
			{
				string SQL = "SELECT " +
								"a.ChargeID, " +
								"a.GroupID, " +
								"a.ChargeTypeID, " +
								"b.ChargeType, " +
								"a.ChargeAmount, " +
								"a.InPercent " +
							"FROM tblProductGroupCharges a " +
							"LEFT JOIN tblChargeType b ON a.ChargeTypeID = b.ChargeTypeID " +
							"WHERE ChargeID = @ChargeID ";

				

				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				MySqlParameter prmChargeID = new MySqlParameter("@ChargeID",MySqlDbType.Int64);			
				prmChargeID.Value = ChargeID;
				cmd.Parameters.Add(prmChargeID);

				ProductGroupChargeDetails Details = new ProductGroupChargeDetails();

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				while (myReader.Read())
				{
					Details.ChargeID = myReader.GetInt64("ChargeID");
					Details.GroupID = myReader.GetInt64("GroupID");
					Details.ChargeTypeID = myReader.GetInt32("ChargeTypeID");
					Details.ChargeType = "" + myReader["ChargeType"].ToString();
					Details.ChargeAmount = myReader.GetDecimal("ChargeAmount");
					Details.InPercent = myReader.GetBoolean("InPercent");
				}

				myReader.Close();

				return Details;			
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #9
0
        public Int32 Save(ProductGroupChargeDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupCharges(@ChargeID, @GroupID, @ChargeTypeID, @ChargeAmount, @InPercent, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ChargeID", Details.ChargeID);
                cmd.Parameters.AddWithValue("GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("ChargeTypeID", Details.ChargeTypeID);
                cmd.Parameters.AddWithValue("ChargeAmount", Details.ChargeAmount);
                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);
            }
        }