예제 #1
0
        public Int32 Save(ChartOfAccountDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveChartOfAccount(@ChartOfAccountID, @AccountCategoryID, @ChartOfAccountCode, @ChartOfAccountName, " +
                             "@Debit, @Credit, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ChartOfAccountID", Details.ChartOfAccountID);
                cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryDetails.AccountCategoryID);
                cmd.Parameters.AddWithValue("ChartOfAccountCode", Details.ChartOfAccountCode);
                cmd.Parameters.AddWithValue("ChartOfAccountName", Details.ChartOfAccountName);
                cmd.Parameters.AddWithValue("Debit", Details.Debit);
                cmd.Parameters.AddWithValue("Credit", Details.Credit);
                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);
            }
        }
예제 #2
0
        public Int32 Insert(ChartOfAccountDetails Details)
        {
            try
            {
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                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);
            }
        }
예제 #3
0
		public Int32 Insert(ChartOfAccountDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				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);
			}	
		}
예제 #4
0
        public void Update(ChartOfAccountDetails Details)
        {
            try
            {
                Save(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #5
0
        public ChartOfAccountDetails Details(Int32 ChartOfAccountID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE ChartOfAccountID = @ChartOfAccountID;";

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

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

                System.Data.DataTable dt      = new System.Data.DataTable("ChartOfAccount");
                MySqlDataAdapter      adapter = new MySqlDataAdapter(cmd);
                adapter.Fill(dt);

                ChartOfAccountDetails Details = new ChartOfAccountDetails();

                AccountCategories      clsAccountCategory       = new AccountCategories(this.Connection, this.Transaction);
                AccountSummaries       clsAccountSummary        = new AccountSummaries(this.Connection, this.Transaction);
                AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction);

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.ChartOfAccountID   = ChartOfAccountID;
                    Details.ChartOfAccountCode = "" + dr["ChartOfAccountCode"].ToString();
                    Details.ChartOfAccountName = "" + dr["ChartOfAccountName"].ToString();
                    Details.Debit  = decimal.Parse(dr["Debit"].ToString());
                    Details.Credit = decimal.Parse(dr["Credit"].ToString());

                    Details.AccountCategoryDetails = clsAccountCategory.Details(Int32.Parse(dr["AccountCategoryID"].ToString()));
                    //Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString()));
                    //Details.AccountClassificationDetails = clsAccountClassification.Details(Int16.Parse(dr["AccountClassificationID"].ToString()));
                }

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
예제 #6
0
		private void SaveRecord()
		{
			ChartOfAccountDetails clsDetails = new ChartOfAccountDetails();

			clsDetails.ChartOfAccountID = Convert.ToInt16(lblAccountID.Text);
            clsDetails.AccountCategoryDetails = new AccountCategoryDetails
            {
                AccountCategoryID = Convert.ToInt32(cboAccountCategory.SelectedItem.Value)
            };
			clsDetails.ChartOfAccountCode = txtAccountCode.Text;
			clsDetails.ChartOfAccountName = txtAccountName.Text;
            clsDetails.Debit = Convert.ToDecimal(txtDebit.Text);
            clsDetails.Credit = Convert.ToDecimal(txtCredit.Text);

			ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
			clsChartOfAccount.Update(clsDetails);
			clsChartOfAccount.CommitAndDispose();
		}
예제 #7
0
		private Int32 SaveRecord()
		{
			ChartOfAccountDetails clsDetails = new ChartOfAccountDetails();

            clsDetails.AccountCategoryDetails = new AccountCategoryDetails
            {
                AccountCategoryID = Convert.ToInt32(cboAccountCategory.SelectedItem.Value),
            };
			clsDetails.ChartOfAccountCode = txtAccountCode.Text;
			clsDetails.ChartOfAccountName = txtAccountName.Text;
			
			ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
			Int32 id = clsChartOfAccount.Insert(clsDetails);
			clsChartOfAccount.CommitAndDispose();

			return id;
		}
예제 #8
0
		public void Update(ChartOfAccountDetails Details)
		{
			try 
			{
                Save(Details);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
예제 #9
0
		public ChartOfAccountDetails Details(Int32 ChartOfAccountID)
		{
			try
			{
				string SQL = SQLSelect() + "WHERE ChartOfAccountID = @ChartOfAccountID;";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

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

                System.Data.DataTable dt = new System.Data.DataTable("ChartOfAccount");
                MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
                adapter.Fill(dt);
				
				ChartOfAccountDetails Details = new ChartOfAccountDetails();

                AccountCategories clsAccountCategory = new AccountCategories(this.Connection, this.Transaction);
                AccountSummaries clsAccountSummary = new AccountSummaries(this.Connection, this.Transaction);
                AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction);

				foreach(System.Data.DataRow dr in dt.Rows)
				{
					Details.ChartOfAccountID = ChartOfAccountID;
					Details.ChartOfAccountCode = "" + dr["ChartOfAccountCode"].ToString();
					Details.ChartOfAccountName = "" + dr["ChartOfAccountName"].ToString();
                    Details.Debit = decimal.Parse(dr["Debit"].ToString());
                    Details.Credit = decimal.Parse(dr["Credit"].ToString());
                    
                    Details.AccountCategoryDetails = clsAccountCategory.Details(Int32.Parse(dr["AccountCategoryID"].ToString()));
                    //Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString()));
                    //Details.AccountClassificationDetails = clsAccountClassification.Details(Int16.Parse(dr["AccountClassificationID"].ToString()));
				}

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					 
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
예제 #10
0
        public Int32 Save(ChartOfAccountDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveChartOfAccount(@ChartOfAccountID, @AccountCategoryID, @ChartOfAccountCode, @ChartOfAccountName, " +
                                                    "@Debit, @Credit, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ChartOfAccountID", Details.ChartOfAccountID);
                cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryDetails.AccountCategoryID);
                cmd.Parameters.AddWithValue("ChartOfAccountCode", Details.ChartOfAccountCode);
                cmd.Parameters.AddWithValue("ChartOfAccountName", Details.ChartOfAccountName);
                cmd.Parameters.AddWithValue("Debit", Details.Debit);
                cmd.Parameters.AddWithValue("Credit", Details.Credit);
                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);
            }
        }