public Int32 Insert(AccountSummaryDetails 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);
			}	
		}
Exemple #2
0
        public Int32 Insert(AccountSummaryDetails 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);
            }
        }
Exemple #3
0
        public Int32 Save(AccountSummaryDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveAccountSummary(@AccountSummaryID, @AccountClassificationID, @AccountSummaryCode, @AccountSummaryName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryID);
                cmd.Parameters.AddWithValue("AccountClassificationID", Details.AccountClassificationDetails.AccountClassificationID);
                cmd.Parameters.AddWithValue("AccountSummaryCode", Details.AccountSummaryCode);
                cmd.Parameters.AddWithValue("AccountSummaryName", Details.AccountSummaryName);
                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);
            }
        }
Exemple #4
0
        public void Update(AccountSummaryDetails Details)
        {
            try
            {
                Save(Details);
            }

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

			clsDetails.AccountSummaryID = Convert.ToInt16(lblAccountSummaryID.Text);
            clsDetails.AccountClassificationDetails = new AccountClassificationDetails
            {
                AccountClassificationID = Convert.ToInt16(cboAccountClassification.SelectedItem.Value)
            };
			clsDetails.AccountSummaryCode = txtAccountSummaryCode.Text;
			clsDetails.AccountSummaryName = txtAccountSummaryName.Text;
			
			AccountSummaries clsAccountSummary = new AccountSummaries();
			clsAccountSummary.Update(clsDetails);
			clsAccountSummary.CommitAndDispose();
		}
Exemple #6
0
        public AccountSummaryDetails Details(Int32 AccountSummaryID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE AccountSummaryID = @AccountSummaryID;";

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

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

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

                AccountSummaryDetails  Details = new AccountSummaryDetails();
                AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction);

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.AccountSummaryID             = AccountSummaryID;
                    Details.AccountSummaryCode           = "" + dr["AccountSummaryCode"].ToString();
                    Details.AccountSummaryName           = "" + dr["AccountSummaryName"].ToString();
                    Details.AccountClassificationDetails = clsAccountClassification.Details(Int16.Parse(dr["AccountClassificationID"].ToString()));
                }

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
		public void Update(AccountSummaryDetails Details)
		{
			try 
			{
                Save(Details);
			}

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

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

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

                AccountSummaryDetails Details = new AccountSummaryDetails();
                AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction);
 
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.AccountSummaryID = AccountSummaryID;
                    Details.AccountSummaryCode = "" + dr["AccountSummaryCode"].ToString();
                    Details.AccountSummaryName = "" + dr["AccountSummaryName"].ToString();
                    Details.AccountClassificationDetails = clsAccountClassification.Details(Int16.Parse(dr["AccountClassificationID"].ToString()));
                }

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
        public Int32 Save(AccountSummaryDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveAccountSummary(@AccountSummaryID, @AccountClassificationID, @AccountSummaryCode, @AccountSummaryName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryID);
                cmd.Parameters.AddWithValue("AccountClassificationID", Details.AccountClassificationDetails.AccountClassificationID);
                cmd.Parameters.AddWithValue("AccountSummaryCode", Details.AccountSummaryCode);
                cmd.Parameters.AddWithValue("AccountSummaryName", Details.AccountSummaryName);
                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);
            }
        }
Exemple #10
0
		private Int32 SaveRecord()
		{
			AccountSummaryDetails clsDetails = new AccountSummaryDetails();

            clsDetails.AccountClassificationDetails = new AccountClassificationDetails
            {
                AccountClassificationID = Convert.ToInt16(cboAccountClassification.SelectedItem.Value)
            };
			clsDetails.AccountSummaryCode = txtAccountSummaryCode.Text;
			clsDetails.AccountSummaryName = txtAccountSummaryName.Text;
			
			AccountSummaries clsAccountSummary = new AccountSummaries();
			Int32 id = clsAccountSummary.Insert(clsDetails);
			clsAccountSummary.CommitAndDispose();

			return id;
		}