Exemple #1
0
        public GJournalsDebitDetails Details(long GJournalDebitID)
        {
            try
            {
                string SQL = "SELECT " +
                             "GJournalDebitID, " +
                             "GJournalID, " +
                             "a.ChartOfAccountID, " +
                             "ChartOfAccountCode, " +
                             "ChartOfAccountName, " +
                             "Amount " +
                             "FROM tblGJournalDebit a INNER JOIN tblChartOfAccount b " +
                             "ON a.ChartOfAccountID = b.ChartOfAccountID " +
                             "WHERE GJournalDebitID = @GJournalDebitID;";



                MySqlCommand cmd = new MySqlCommand();


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

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

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

                GJournalsDebitDetails Details = new GJournalsDebitDetails();

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

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Exemple #2
0
        public void Update(GJournalsDebitDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblGJournalDebit SET " +
                             "GJournalID			=	@GJournalID, "+
                             "ChartOfAccountID	=	@ChartOfAccountID, "+
                             "Amount				=	@Amount "+
                             "WHERE GJournalDebitID	=	@GJournalDebitID;";



                MySqlCommand cmd = new MySqlCommand();


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

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

                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 prmGJournalDebitID = new MySqlParameter("@GJournalDebitID", MySqlDbType.Int64);
                prmGJournalDebitID.Value = Details.GJournalDebitID;
                cmd.Parameters.Add(prmGJournalDebitID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
		public long Insert(GJournalsDebitDetails Details)
		{
			try 
			{
				string SQL = "INSERT INTO tblGJournalDebit (" +
								"GJournalID, " +
								"ChartOfAccountID, " +
								"Amount" +
							") VALUES (" +
								"@GJournalID, " +
								"@ChartOfAccountID, " +
								"@Amount" +
							");";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

				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);
			}	
		}
		public GJournalsDebitDetails Details(long GJournalDebitID)
		{
			try
			{
				string SQL =	"SELECT " +
									"GJournalDebitID, " +
									"GJournalID, " +
									"a.ChartOfAccountID, " +
									"ChartOfAccountCode, " +
									"ChartOfAccountName, " +
									"Amount " +
								"FROM tblGJournalDebit a INNER JOIN tblChartOfAccount b " +
									"ON a.ChartOfAccountID = b.ChartOfAccountID " +
								"WHERE GJournalDebitID = @GJournalDebitID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

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

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

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					 
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
		public void Update(GJournalsDebitDetails Details)
		{
			try 
			{
				string SQL = "UPDATE tblGJournalDebit SET " + 
								"GJournalID			=	@GJournalID, " +
								"ChartOfAccountID	=	@ChartOfAccountID, " +
								"Amount				=	@Amount " +
							"WHERE GJournalDebitID	=	@GJournalDebitID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

				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 prmGJournalDebitID = new MySqlParameter("@GJournalDebitID",MySqlDbType.Int64);				
				prmGJournalDebitID.Value = Details.GJournalDebitID;
				cmd.Parameters.Add(prmGJournalDebitID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				
				
				{
					
					 
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
Exemple #6
0
		private void SaveDebit()
		{
			GJournalsDebitDetails clsDetails = new GJournalsDebitDetails();
			
			clsDetails.GJournalID = Convert.ToInt64(lblGJournalID.Text);
			clsDetails.ChartOfAccountID = Convert.ToInt32(cboAccount.SelectedItem.Value);
			clsDetails.Amount = Convert.ToDecimal(txtAmount.Text);

			GJournalsDebit clsGJournalsDebit = new GJournalsDebit();
			clsGJournalsDebit.Insert(clsDetails);
			clsGJournalsDebit.CommitAndDispose();
		}
Exemple #7
0
        public long Insert(GJournalsDebitDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblGJournalDebit (" +
                             "GJournalID, " +
                             "ChartOfAccountID, " +
                             "Amount" +
                             ") VALUES (" +
                             "@GJournalID, " +
                             "@ChartOfAccountID, " +
                             "@Amount" +
                             ");";



                MySqlCommand cmd = new MySqlCommand();


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

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

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