Example #1
0
        public Int32 Insert(AccountCategoryDetails 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);
            }
        }
Example #2
0
		public Int32 Insert(AccountCategoryDetails 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);
			}	
		}
Example #3
0
        public Int32 Save(AccountCategoryDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveAccountCategory(@AccountCategoryID, @AccountSummaryID, @AccountCategoryCode, @AccountCategoryName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryID);
                cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryDetails.AccountSummaryID);
                cmd.Parameters.AddWithValue("AccountCategoryCode", Details.AccountCategoryCode);
                cmd.Parameters.AddWithValue("AccountCategoryName", Details.AccountCategoryName);
                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);
            }
        }
Example #4
0
        public void Update(AccountCategoryDetails Details)
        {
            try
            {
                Save(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Example #5
0
		private void SaveRecord()
		{
			AccountCategoryDetails clsDetails = new AccountCategoryDetails();

			clsDetails.AccountCategoryID = Convert.ToInt16(lblAccountCategoryID.Text);
            clsDetails.AccountSummaryDetails = new AccountSummaryDetails
            {
                AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value)
            };
			clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text;
			clsDetails.AccountCategoryName = txtAccountCategoryName.Text;
			
			AccountCategories clsAccountCategory = new AccountCategories();
			clsAccountCategory.Update(clsDetails);
			clsAccountCategory.CommitAndDispose();
		}
Example #6
0
        public AccountCategoryDetails Details(Int32 AccountCategoryID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE AccountCategoryID = @AccountCategoryID;";

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

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

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

                AccountCategoryDetails Details = new AccountCategoryDetails();

                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.AccountCategoryID     = AccountCategoryID;
                    Details.AccountCategoryCode   = "" + dr["AccountCategoryCode"].ToString();
                    Details.AccountCategoryName   = "" + dr["AccountCategoryName"].ToString();
                    Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString()));
                    //Details.AccountClassificationDetails = Details.AccountSummaryDetails.AccountClassificationDetails;
                }

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Example #7
0
		public void Update(AccountCategoryDetails Details)
		{
			try 
			{
                Save(Details);
			}

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

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

                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);
				
				AccountCategoryDetails Details = new AccountCategoryDetails();

                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.AccountCategoryID = AccountCategoryID;
					Details.AccountCategoryCode = "" + dr["AccountCategoryCode"].ToString();
					Details.AccountCategoryName = "" + dr["AccountCategoryName"].ToString();
                    Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString()));
                    //Details.AccountClassificationDetails = Details.AccountSummaryDetails.AccountClassificationDetails;
				}

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #9
0
        public Int32 Save(AccountCategoryDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveAccountCategory(@AccountCategoryID, @AccountSummaryID, @AccountCategoryCode, @AccountCategoryName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryID);
                cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryDetails.AccountSummaryID);
                cmd.Parameters.AddWithValue("AccountCategoryCode", Details.AccountCategoryCode);
                cmd.Parameters.AddWithValue("AccountCategoryName", Details.AccountCategoryName);
                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);
            }
        }
Example #10
0
		private Int32 SaveRecord()
		{
			AccountCategoryDetails clsDetails = new AccountCategoryDetails();

            clsDetails.AccountSummaryDetails = new AccountSummaryDetails
            {
                AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value)
            };
			clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text;
			clsDetails.AccountCategoryName = txtAccountCategoryName.Text;
			
			AccountCategories clsAccountCategory = new AccountCategories();
			Int32 id = clsAccountCategory.Insert(clsDetails);
			clsAccountCategory.CommitAndDispose();

			return id;
		}