Example #1
0
        public BankDepositDetails Details(long BankDepositID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE BankDepositID = @BankDepositID;";



                MySqlCommand cmd = new MySqlCommand();


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

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

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

                BankDepositDetails Details = new BankDepositDetails();

                while (myReader.Read())
                {
                    Details.BankDepositID          = BankDepositID;
                    Details.TransactionDate        = myReader.GetDateTime("TransactionDate");
                    Details.DepositStatus          = (BankDepositStatus)Enum.Parse(typeof(BankDepositStatus), myReader.GetString("DepositStatus"));
                    Details.DepositInAccountID     = myReader.GetInt32("DepositInAccountID");
                    Details.DepositInAccountName   = "" + myReader["DepositInAccountName"].ToString();
                    Details.DepositMemo            = "" + myReader["DepositMemo"].ToString();
                    Details.DepositItemDate        = myReader.GetDateTime("DepositItemDate");
                    Details.DepositItemType        = (BankDepositType)Enum.Parse(typeof(BankDepositType), myReader.GetString("DepositItemType"));
                    Details.DepositItemAccountID   = myReader.GetInt32("DepositItemAccountID");
                    Details.DepositItemAccountName = "" + myReader["DepositItemAccountName"].ToString();
                    Details.DepositItemReference   = "" + myReader["DepositItemReference"].ToString();
                    Details.DepositItemAmount      = myReader.GetDecimal("DepositItemAmount");
                    Details.CashBackAccountID      = myReader.GetInt32("CashBackAccountID");
                    Details.CashBackAccountName    = "" + myReader["CashBackAccountName"].ToString();
                    Details.CashBackAmount         = myReader.GetDecimal("CashBackAmount");
                    Details.CashBackMemo           = "" + myReader["CashBackMemo"].ToString();
                    Details.CreatedByID            = myReader.GetInt64("CreatedByID");
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Example #2
0
        public void Update(BankDepositDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblBankDeposit SET " +
                             "TransactionDate        = @TransactionDate, " +
                             "DepositStatus          = @DepositStatus, " +
                             "DepositInAccountID     = @DepositInAccountID, " +
                             "DepositMemo            = @DepositMemo, " +
                             "DepositItemDate        = @DepositItemDate, " +
                             "DepositItemType        = @DepositItemType, " +
                             "DepositItemAccountID   = @DepositItemAccountID, " +
                             "DepositItemReference   = @DepositItemReference, " +
                             "DepositItemAmount      = @DepositItemAmount, " +
                             "CashBackAccountID      = @CashBackAccountID, " +
                             "CashBackAmount         = @CashBackAmount, " +
                             "CashBackMemo           = @CashBackMemo " +
                             "WHERE BankDepositID = @BankDepositID;";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@TransactionDate", Details.TransactionDate);
                cmd.Parameters.AddWithValue("@DepositStatus", Details.DepositStatus.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositInAccountID", Details.DepositInAccountID);
                cmd.Parameters.AddWithValue("@DepositMemo", Details.DepositMemo);
                cmd.Parameters.AddWithValue("@DepositItemDate", Details.DepositItemDate);
                cmd.Parameters.AddWithValue("@DepositItemType", Details.DepositItemType.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositItemAccountID", Details.DepositItemAccountID);
                cmd.Parameters.AddWithValue("@DepositItemReference", Details.DepositItemReference);
                cmd.Parameters.AddWithValue("@DepositItemAmount", Details.DepositItemAmount);
                cmd.Parameters.AddWithValue("@CashBackAccountID", Details.CashBackAccountID);
                cmd.Parameters.AddWithValue("@CashBackAmount", Details.CashBackAmount);
                cmd.Parameters.AddWithValue("@CashBackMemo", Details.CashBackMemo);
                cmd.Parameters.AddWithValue("@CreatedByID", Details.CreatedByID);
                cmd.Parameters.AddWithValue("@BankDepositID", Details.BankDepositID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Example #3
0
        public void Post(long BankDepositID, decimal Amount)
        {
            try
            {
                string SQL = "UPDATE tblBankDeposit SET " +
                             "DepositStatus      = @DepositStatus " +
                             "WHERE BankDepositID    = @BankDepositID;";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@DepositStatus", BankDepositStatus.Posted.ToString("d"));
                cmd.Parameters.AddWithValue("@BankDepositID", BankDepositID);

                base.ExecuteNonQuery(cmd);

                BankDepositDetails clsBankDepositDetails = Details(BankDepositID);
                ChartOfAccounts    clsChartOfAccount     = new ChartOfAccounts(base.Connection, base.Transaction);

                clsChartOfAccount.UpdateDebit(clsBankDepositDetails.DepositInAccountID, clsBankDepositDetails.DepositItemAmount);
                clsChartOfAccount.UpdateCredit(clsBankDepositDetails.DepositInAccountID, clsBankDepositDetails.CashBackAmount);

                clsChartOfAccount.UpdateDebit(clsBankDepositDetails.CashBackAccountID, clsBankDepositDetails.CashBackAmount);

                clsChartOfAccount.UpdateCredit(clsBankDepositDetails.DepositItemAccountID, clsBankDepositDetails.DepositItemAmount);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Example #4
0
		public Int32 Insert(BankDepositDetails Details)
		{
			try 
			{
				string SQL = "INSERT INTO tblBankDeposit (" +
                                "TransactionDate, " +
								"DepositStatus, " +
								"DepositInAccountID, " +
                                "DepositMemo, " +
                                "DepositItemDate, " +
                                "DepositItemType, " +
                                "DepositItemAccountID, " +
                                "DepositItemReference, " +
                                "DepositItemAmount, " +
                                "CashBackAccountID, " +
                                "CashBackAmount, " +
                                "CashBackMemo, " +
                                "CreatedByID" +
							") VALUES (" +
                                "@TransactionDate, " +
                                "@DepositStatus, " +
                                "@DepositInAccountID, " +
                                "@DepositMemo, " +
                                "@DepositItemDate, " +
                                "@DepositItemType, " +
                                "@DepositItemAccountID, " +
                                "@DepositItemReference, " +
                                "@DepositItemAmount, " +
                                "@CashBackAccountID, " +
                                "@CashBackAmount, " +
                                "@CashBackMemo, " +
                                "@CreatedByID" +
							");";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				cmd.Parameters.AddWithValue("@TransactionDate", Details.TransactionDate);
                cmd.Parameters.AddWithValue("@DepositStatus", Details.DepositStatus.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositInAccountID", Details.DepositInAccountID);
                cmd.Parameters.AddWithValue("@DepositMemo", Details.DepositMemo);
                cmd.Parameters.AddWithValue("@DepositItemDate", Details.DepositItemDate);
                cmd.Parameters.AddWithValue("@DepositItemType", Details.DepositItemType.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositItemAccountID", Details.DepositItemAccountID);
                cmd.Parameters.AddWithValue("@DepositItemReference", Details.DepositItemReference);
                cmd.Parameters.AddWithValue("@DepositItemAmount", Details.DepositItemAmount);
                cmd.Parameters.AddWithValue("@CashBackAccountID", Details.CashBackAccountID);
                cmd.Parameters.AddWithValue("@CashBackAmount", Details.CashBackAmount);
                cmd.Parameters.AddWithValue("@CashBackMemo", Details.CashBackMemo);
                cmd.Parameters.AddWithValue("@CreatedByID", Details.CreatedByID);

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

                Int32 iID = 0;

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

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #5
0
		public BankDepositDetails Details(long BankDepositID)
		{
			try
			{
				string SQL = SQLSelect() + "WHERE BankDepositID = @BankDepositID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

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

				while (myReader.Read()) 
				{
					Details.BankDepositID = BankDepositID;
                    Details.TransactionDate = myReader.GetDateTime("TransactionDate");
					Details.DepositStatus = (BankDepositStatus) Enum.Parse(typeof(BankDepositStatus), myReader.GetString("DepositStatus"));
                    Details.DepositInAccountID = myReader.GetInt32("DepositInAccountID");
                    Details.DepositInAccountName = "" + myReader["DepositInAccountName"].ToString();
					Details.DepositMemo = "" + myReader["DepositMemo"].ToString();
					Details.DepositItemDate = myReader.GetDateTime("DepositItemDate");
                    Details.DepositItemType = (BankDepositType)Enum.Parse(typeof(BankDepositType), myReader.GetString("DepositItemType"));
                    Details.DepositItemAccountID = myReader.GetInt32("DepositItemAccountID");
                    Details.DepositItemAccountName = "" + myReader["DepositItemAccountName"].ToString();
                    Details.DepositItemReference = "" + myReader["DepositItemReference"].ToString();
                    Details.DepositItemAmount = myReader.GetDecimal("DepositItemAmount");
                    Details.CashBackAccountID = myReader.GetInt32("CashBackAccountID");
                    Details.CashBackAccountName = "" + myReader["CashBackAccountName"].ToString();
                    Details.CashBackAmount = myReader.GetDecimal("CashBackAmount");
                    Details.CashBackMemo = "" + myReader["CashBackMemo"].ToString();
                    Details.CreatedByID = myReader.GetInt64("CreatedByID");
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					 
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
Example #6
0
		public void Update(BankDepositDetails Details)
		{
			try 
			{
				string SQL = "UPDATE tblBankDeposit SET " +
                                "TransactionDate        = @TransactionDate, " +
                                "DepositStatus          = @DepositStatus, " +
                                "DepositInAccountID     = @DepositInAccountID, " +
                                "DepositMemo            = @DepositMemo, " +
                                "DepositItemDate        = @DepositItemDate, " +
                                "DepositItemType        = @DepositItemType, " +
                                "DepositItemAccountID   = @DepositItemAccountID, " +
                                "DepositItemReference   = @DepositItemReference, " +
                                "DepositItemAmount      = @DepositItemAmount, " +
                                "CashBackAccountID      = @CashBackAccountID, " +
                                "CashBackAmount         = @CashBackAmount, " +
                                "CashBackMemo           = @CashBackMemo " +
							"WHERE BankDepositID = @BankDepositID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@TransactionDate", Details.TransactionDate);
                cmd.Parameters.AddWithValue("@DepositStatus", Details.DepositStatus.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositInAccountID", Details.DepositInAccountID);
                cmd.Parameters.AddWithValue("@DepositMemo", Details.DepositMemo);
                cmd.Parameters.AddWithValue("@DepositItemDate", Details.DepositItemDate);
                cmd.Parameters.AddWithValue("@DepositItemType", Details.DepositItemType.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositItemAccountID", Details.DepositItemAccountID);
                cmd.Parameters.AddWithValue("@DepositItemReference", Details.DepositItemReference);
                cmd.Parameters.AddWithValue("@DepositItemAmount", Details.DepositItemAmount);
                cmd.Parameters.AddWithValue("@CashBackAccountID", Details.CashBackAccountID);
                cmd.Parameters.AddWithValue("@CashBackAmount", Details.CashBackAmount);
                cmd.Parameters.AddWithValue("@CashBackMemo", Details.CashBackMemo);
                cmd.Parameters.AddWithValue("@CreatedByID", Details.CreatedByID);
                cmd.Parameters.AddWithValue("@BankDepositID", Details.BankDepositID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				
				
				{
					
					 
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
Example #7
0
        public Int32 Insert(BankDepositDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblBankDeposit (" +
                             "TransactionDate, " +
                             "DepositStatus, " +
                             "DepositInAccountID, " +
                             "DepositMemo, " +
                             "DepositItemDate, " +
                             "DepositItemType, " +
                             "DepositItemAccountID, " +
                             "DepositItemReference, " +
                             "DepositItemAmount, " +
                             "CashBackAccountID, " +
                             "CashBackAmount, " +
                             "CashBackMemo, " +
                             "CreatedByID" +
                             ") VALUES (" +
                             "@TransactionDate, " +
                             "@DepositStatus, " +
                             "@DepositInAccountID, " +
                             "@DepositMemo, " +
                             "@DepositItemDate, " +
                             "@DepositItemType, " +
                             "@DepositItemAccountID, " +
                             "@DepositItemReference, " +
                             "@DepositItemAmount, " +
                             "@CashBackAccountID, " +
                             "@CashBackAmount, " +
                             "@CashBackMemo, " +
                             "@CreatedByID" +
                             ");";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@TransactionDate", Details.TransactionDate);
                cmd.Parameters.AddWithValue("@DepositStatus", Details.DepositStatus.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositInAccountID", Details.DepositInAccountID);
                cmd.Parameters.AddWithValue("@DepositMemo", Details.DepositMemo);
                cmd.Parameters.AddWithValue("@DepositItemDate", Details.DepositItemDate);
                cmd.Parameters.AddWithValue("@DepositItemType", Details.DepositItemType.ToString("d"));
                cmd.Parameters.AddWithValue("@DepositItemAccountID", Details.DepositItemAccountID);
                cmd.Parameters.AddWithValue("@DepositItemReference", Details.DepositItemReference);
                cmd.Parameters.AddWithValue("@DepositItemAmount", Details.DepositItemAmount);
                cmd.Parameters.AddWithValue("@CashBackAccountID", Details.CashBackAccountID);
                cmd.Parameters.AddWithValue("@CashBackAmount", Details.CashBackAmount);
                cmd.Parameters.AddWithValue("@CashBackMemo", Details.CashBackMemo);
                cmd.Parameters.AddWithValue("@CreatedByID", Details.CreatedByID);

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

                Int32 iID = 0;

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

                return(iID);
            }

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