public long Insert(PaymentsCreditDetails Details)
		{
			try 
			{
				string SQL = "INSERT INTO tblPaymentCredit (" +
								"PaymentID, " +
								"ChartOfAccountID, " +
								"Amount" +
							") VALUES (" +
								"@PaymentID, " +
								"@ChartOfAccountID, " +
								"@Amount" +
							");";
	 			
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID",MySqlDbType.Int64);			
				prmPaymentID.Value = Details.PaymentID;
				cmd.Parameters.Add(prmPaymentID);

				MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID",MySqlDbType.Int64);			
				prmChartOfAccountID.Value = Details.ChartOfAccountID;
				cmd.Parameters.Add(prmChartOfAccountID);

				MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal);			
				prmAmount.Value = Details.Amount;
				cmd.Parameters.Add(prmAmount);
     
				base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                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);

                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);
			}	
		}
Exemple #2
0
        public long Insert(PaymentsCreditDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblPaymentCredit (" +
                             "PaymentID, " +
                             "ChartOfAccountID, " +
                             "Amount" +
                             ") VALUES (" +
                             "@PaymentID, " +
                             "@ChartOfAccountID, " +
                             "@Amount" +
                             ");";

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

                MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID", MySqlDbType.Int64);
                prmPaymentID.Value = Details.PaymentID;
                cmd.Parameters.Add(prmPaymentID);

                MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID", MySqlDbType.Int64);
                prmChartOfAccountID.Value = Details.ChartOfAccountID;
                cmd.Parameters.Add(prmChartOfAccountID);

                MySqlParameter prmAmount = new MySqlParameter("@Amount", MySqlDbType.Decimal);
                prmAmount.Value = Details.Amount;
                cmd.Parameters.Add(prmAmount);

                base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                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);

                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);
            }
        }
Exemple #3
0
        public PaymentsCreditDetails Details(long PaymentCreditID)
        {
            try
            {
                string SQL = "SELECT " +
                             "PaymentCreditID, " +
                             "PaymentID, " +
                             "a.ChartOfAccountID, " +
                             "ChartOfAccountCode, " +
                             "ChartOfAccountName, " +
                             "Amount " +
                             "FROM tblPaymentCredit a INNER JOIN tblChartOfAccount b " +
                             "ON a.ChartOfAccountID = b.ChartOfAccountID " +
                             "WHERE PaymentCreditID = @PaymentCreditID;";

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

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

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                PaymentsCreditDetails Details = new PaymentsCreditDetails();

                while (myReader.Read())
                {
                    Details.PaymentCreditID  = PaymentCreditID;
                    Details.PaymentID        = myReader.GetInt64("PaymentID");
                    Details.ChartOfAccountID = myReader.GetInt32("ChartOfAccountID");
                    Details.Amount           = myReader.GetDecimal("Amount");
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #4
0
        public void Update(PaymentsCreditDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblPaymentCredit SET " +
                             "PaymentID			=	@PaymentID, "+
                             "ChartOfAccountID	=	@ChartOfAccountID, "+
                             "Amount				=	@Amount "+
                             "WHERE PaymentCreditID	=	@PaymentCreditID;";

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

                MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID", MySqlDbType.Int64);
                prmPaymentID.Value = Details.PaymentID;
                cmd.Parameters.Add(prmPaymentID);

                MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID", MySqlDbType.Int64);
                prmChartOfAccountID.Value = Details.ChartOfAccountID;
                cmd.Parameters.Add(prmChartOfAccountID);

                MySqlParameter prmAmount = new MySqlParameter("@Amount", MySqlDbType.Decimal);
                prmAmount.Value = Details.Amount;
                cmd.Parameters.Add(prmAmount);

                MySqlParameter prmPaymentCreditID = new MySqlParameter("@PaymentCreditID", MySqlDbType.Int64);
                prmPaymentCreditID.Value = Details.PaymentCreditID;
                cmd.Parameters.Add(prmPaymentCreditID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
		public PaymentsCreditDetails Details(long PaymentCreditID)
		{
			try
			{
				string SQL =	"SELECT " +
									"PaymentCreditID, " +
									"PaymentID, " +
									"a.ChartOfAccountID, " +
									"ChartOfAccountCode, " +
									"ChartOfAccountName, " +
									"Amount " +
								"FROM tblPaymentCredit a INNER JOIN tblChartOfAccount b " +
									"ON a.ChartOfAccountID = b.ChartOfAccountID " +
								"WHERE PaymentCreditID = @PaymentCreditID;";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				PaymentsCreditDetails Details = new PaymentsCreditDetails();

				while (myReader.Read()) 
				{
					Details.PaymentCreditID = PaymentCreditID;
					Details.PaymentID = myReader.GetInt64("PaymentID");
					Details.ChartOfAccountID = myReader.GetInt32("ChartOfAccountID");
					Details.Amount = myReader.GetDecimal("Amount");
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
		public void Update(PaymentsCreditDetails Details)
		{
			try 
			{
				string SQL = "UPDATE tblPaymentCredit SET " + 
								"PaymentID			=	@PaymentID, " +
								"ChartOfAccountID	=	@ChartOfAccountID, " +
								"Amount				=	@Amount " +
							"WHERE PaymentCreditID	=	@PaymentCreditID;";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID",MySqlDbType.Int64);			
				prmPaymentID.Value = Details.PaymentID;
				cmd.Parameters.Add(prmPaymentID);

				MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID",MySqlDbType.Int64);			
				prmChartOfAccountID.Value = Details.ChartOfAccountID;
				cmd.Parameters.Add(prmChartOfAccountID);

				MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal);			
				prmAmount.Value = Details.Amount;
				cmd.Parameters.Add(prmAmount);

				MySqlParameter prmPaymentCreditID = new MySqlParameter("@PaymentCreditID",MySqlDbType.Int64);				
				prmPaymentCreditID.Value = Details.PaymentCreditID;
				cmd.Parameters.Add(prmPaymentCreditID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemple #7
0
		private void SaveCredit()
		{
			PaymentsCreditDetails clsDetails = new PaymentsCreditDetails();
			
			clsDetails.PaymentID = Convert.ToInt64(lblPaymentID.Text);
			clsDetails.ChartOfAccountID = Convert.ToInt32(cboAccount.SelectedItem.Value);
			clsDetails.Amount = Convert.ToDecimal(txtAmount.Text);

			PaymentsCredit clsPaymentsCredit = new PaymentsCredit();
			clsPaymentsCredit.Insert(clsDetails);
			clsPaymentsCredit.CommitAndDispose();
		}