public static void GetMemberID(xing xd) { mem_id = xd.IDCtrlGet(mem_id_tb, 2012, 1001); if (mem_id == 666 || mem_id == 1000) { xd.IDCtrlDelete(mem_id_tb); mem_id = dbm.IDCtrlGet(mem_id_tb, 2012, 1001); } mem_code = fn.GetMemberCode(mem_id); mem_id = (string.Format("{0}{1}", datam.LCH_ID, mem_id)).ToInt32(); }
private void buttonadd_Click(object sender, EventArgs e) { if (m_action == action_type.create) { #region Insert Region ic.accountC _account = new MTOMS.ic.accountC(); _account.account_status = em.account_statusS.Enabled; _account.a_index = curr_node.Index.ToInt16(); _account.a_level = curr_node.Level.ToInt16(); int gp_id = 0; var _sect = GetRoot(curr_node); _account.account_dept_category = (em.account_d_categoryS)_sect.acc_d_cat_id; _account.account_dept_type = (em.account_d_typeS)_sect.acc_d_type_id; if (curr_node.Level > 1) { _account.p_account_id = curr_node.Parent == null ? 0 : (curr_node.Parent.Tag as ic.accountC).account_id; } using (var xd = new xing()) { switch (m_object) { case object_type.GroupAccount: { #region Add New Types _account.account_type = curr_node.Level == 1 ? em.account_typeS.GroupAccount : em.account_typeS.SubGroupAccount; curr_node.Text = textBox1.Text.Trim().ToProperCase(); _account.account_name = curr_node.Text; curr_node.Style = _folder_style; curr_node.ContextMenu = contextMenuFolder; // curr_node.Image = MUTTICO.Properties.Resources.Folder; m_action = action_type.none; if (_account.account_type == em.account_typeS.SubGroupAccount) { gp_id = (curr_node.Parent.Tag as ic.accountC).account_id; } break; #endregion } case object_type.Account: { if (datam.DuplicateAccountName(textBox1.Text.Trim().ToProperCase(), xd)) { MessageBox.Show("The Account Name You Have Entered Already Exists", "Duplicate Account Name"); buttonclose.PerformClick(); return; } #region Add New Types _account.account_type = em.account_typeS.ActualAccount; curr_node.Text = textBox1.Text.Trim().ToProperCase(); _account.account_name = curr_node.Text; curr_node.Style = _folder_style; curr_node.ContextMenu = contextMenuFile; // curr_node.Image = MUTTICO.Properties.Resources.email; m_action = action_type.none; switch (curr_node.Level) { case 2: case 3: { gp_id = (curr_node.Parent.Tag as ic.accountC).account_id; break; } } break; #endregion } } string[] _cols = new string[] { "account_id", "acc_d_cat_id", "acc_d_type_id", "account_name", "account_type_id", "account_alias", "a_level", "a_index", "p_account_id", "exp_type", "fs_time_stamp", "edate", "pc_us_id", "account_status_id", "search_alias", "is_sys_account", "post_type_id", "owner_type_id", "owner_id", "owner_name", "start_date", "end_date", "opening_balance", "account_short_name", "account_code", "description", "lch_id" }; object[] _row = new object[] { _account.account_id = xd.IDCtrlGet("acc_id_xxx", 2013, -500), _account.account_dept_category.ToByte(), _account.account_dept_type.ToByte(), _account.account_name, _account.account_type.ToByte(), _account.account_alias, _account.a_level, _account.a_index, _account.p_account_id = gp_id, emm.export_type.insert.ToByte(), 0, datam.CURR_DATE, datam.PC_US_ID, _account.account_status.ToByte(), null, //search_alias 0, // is_sys_account 0, //post_type 0, //owner_type 0, //owner_id null, //owner name sdata.CURR_DATE, null, 0, //opening balance null, //account_short_name null, // account_code null, //description sdata.App_station_id }; xd.SingleInsertCommandInt("accounts_tb", _cols, _row); xd.IDCtrlDelete("acc_id_xxx"); curr_node.Name = string.Format("Account{0}", _account.account_id); xd.CommitTransaction(); } #endregion curr_node.Tag = _account; datam.DATA_ACCOUNTS.Add(_account.account_id, _account); labelclient.Text = _account.account_name; if (_account.account_type == em.account_typeS.ActualAccount) { curr_node.Style = _file_style; } else { curr_node.Style = _folder_style; } _account = null; buttonclose.PerformClick(); } if (m_action == action_type.update) { if (curr_node != null && curr_node.Tag != null) { var _folder = curr_node.Tag as ic.accountC; if (_folder != null) { using (var xd = new xing()) { if (datam.DuplicateAccountName(textBox1.Text.Trim().ToProperCase(), xd, _folder.account_id)) { MessageBox.Show("The Account Name You Have Entered Already Exists", "Duplicate Account Name"); buttonclose.PerformClick(); return; } xd.SingleUpdateCommandALL("accounts_tb", new string[] { "account_name", "account_id" }, new object[] { textBox1.Text.Trim().ToProperCase(), _folder.account_id }, 1); xd.CommitTransaction(); } _folder.account_name = textBox1.Text.Trim().ToProperCase(); curr_node.Text = _folder.account_name; buttonclose.PerformClick(); } } } }
private void toolStripMenuItem3_Click(object sender, EventArgs e) { string _str = "Are You Sure You Want To Delete This Transfer"; if (!dbm.WarningMessage(_str, "Delete Transfer Warning")) { return; } var m_partition = string.Format("{0}{1}", m_YEAR, m_MONTH).ToInt32(); var _obj = fGrid.SelectedRows[0].Tag as ic.cash_transferC; _obj.status = em.cashTransferStatus.deleted; if (_obj != null) { using (var xd = new xing()) { long _trans_id = xd.ExecuteScalarInt64(string.Format("select transaction_id from acc_cash_transfer_tb where un_id={0} and status={1}", _obj.un_id, em.cashTransferStatus.valid.ToByte())); if (_trans_id > 0) { _str = string.Format("update acc_cash_transfer_tb set status={0},{1},fs_time_stamp={2} where un_id={3} and status={4}", em.cashTransferStatus.deleted.ToByte(), dbm.ETS, SQLH.UnixStamp, _obj.un_id, em.cashTransferStatus.valid.ToByte()); xd.UpdateFsTimeStamp("acc_cash_transfer_tb"); if (xd.SingleUpdateCommand(_str)) { _str = string.Format("select source_id, destination_id, amount from acc_cash_transfer_tb where transaction_id={0}", _trans_id); int _source_id = 0; int _destination_id = 0; int _amount = 0; using (var _dr = xd.SelectCommand(_str)) { while (_dr.Read()) { _source_id = _dr["source_id"].ToInt32(); _destination_id = _dr["destination_id"].ToInt32(); _amount = _dr["amount"].ToInt32(); } // } #region if (accn.GetAccountBaseParent(_source_id).search_alias == "WITHDRAWN_CHEQUES") { //cheque stuff; int wdr_id = xd.ExecuteScalarInt(string.Format("select wdr_id from acc_bank_withdraw_tb where sys_account_id={0}", _source_id)); if (wdr_id > 0) { xd.UpdateFsTimeStamp("acc_bank_withdraw_tb"); var _st = string.Format("update acc_bank_withdraw_tb set cheque_balance=(cheque_balance+{0}),{1},fs_time_stamp={2} where wdr_id={3}", _amount, dbm.ETS, SQLH.UnixStamp, wdr_id); xd.SingleUpdateCommand(_st); } if (accn.GetAccountBaseParent(_destination_id).search_alias == "WITHDRAWN_CHEQUES") { xd.UpdateFsTimeStamp("acc_bank_withdraw_tb"); wdr_id = xd.ExecuteScalarInt(string.Format("select wdr_id from acc_bank_withdraw_tb where sys_account_id={0}", _destination_id)); if (wdr_id > 0) { xd.UpdateFsTimeStamp("acc_bank_withdraw_tb"); var _st = string.Format("update acc_bank_withdraw_tb set cheque_balance=(cheque_balance-{0}),{1},fs_time_stamp={2} where wdr_id={3}", _amount, dbm.ETS, SQLH.UnixStamp, wdr_id); xd.SingleUpdateCommand(_st); } } } #endregion accn.DeleteJournal(_trans_id, xd); fGrid.Rows.RemoveAt(fGrid.Rows[_obj.un_id.ToString()].Index); var _delete_id = xd.IDCtrlGet("CASH_TRANSFER_DELETE_ID"); xd.SingleUpdateCommandALL("acc_cash_transfer_tb", new string[] { "delete_id", "delete_fs_date", "delete_pc_us_id", "un_id" }, new object[] { _delete_id, sdata.CURR_DATE, sdata.PC_US_ID, _obj.un_id }, 1); xd.CommitTransaction(); } } else { MessageBox.Show("This Transfer Has Already Been Deleted", "Delete Failure"); } } CheckForUpdates(); } }