public static void fill_church_groups(xing xd)
        {
            string _str        = string.Empty;
            string _table_name = "church_group_tb";

            if (DATA_CHURCH_GROUPS == null)
            {
                datam.DATA_CHURCH_GROUPS = new SortedList <int, ic.church_groupC>();
            }
            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool is_new   = false;
            bool load_all = false;
            var  _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_CHURCH_GROUPS.Keys.Count == 0)
            {
                _str     = "select * from " + _table_name;
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return;
                }
                _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.church_groupC _obj = null;

            try
            {
                using (var _dr = xd.SelectCommand(_str))
                {
                    while (_dr.Read())
                    {
                        _obj = null;
                        if (load_all)
                        {
                            _obj   = new ic.church_groupC();
                            is_new = true;
                        }
                        else
                        {
                            try
                            {
                                _obj   = datam.DATA_CHURCH_GROUPS[_dr["cg_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception ex)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.church_groupC();
                                    is_new = true;
                                }
                            }
                        }
                        if (is_new)
                        {
                            _obj.cg_type_id = _dr["cg_type_id"].ToInt32();
                            _obj.cg_id      = _dr["cg_id"].ToInt32();
                            _obj.cg_type_id = _dr["cg_type_id"].ToInt16();
                            datam.DATA_CHURCH_GROUPS.Add(_obj.cg_id, _obj);
                        }
                        _obj.cg_name        = _dr["cg_name"].ToStringNullable();
                        _obj.sys_account_id = _dr["sys_account_id"].ToInt32();
                    }
                    _dr.Close(); _dr.Dispose();
                }
                if (load_all)
                {
                    _str = "select * from church_group_members_tb where mem_status=1";
                    using (var _dr = xd.SelectCommand(_str))
                    {
                        while (_dr.Read())
                        {
                            try
                            {
                                datam.DATA_MEMBER[_dr["mem_id"].ToInt32()].ChurchGroupCollection.Add(datam.DATA_CHURCH_GROUPS[_dr["cg_id"].ToInt32()]);
                            }
                            catch (Exception)
                            {
                                continue;
                            }
                        }
                        _dr.Close(); _dr.Dispose();
                    }
                }
            }
            catch (VistaDB.Diagnostic.VistaDBException ex)
            {
                MessageBox.Show(ex.Message);
                throw new Exception("Data Loading Failed");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public static void fill_church_group_types(xing xd)
        {
            string _str        = string.Empty;
            string _table_name = "church_group_types_tb";

            if (DATA_CG_TYPES == null)
            {
                datam.DATA_CG_TYPES = new SortedList <int, ic.church_group_typeC>();
            }
            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool is_new   = false;
            bool load_all = false;
            var  _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_CG_TYPES.Keys.Count == 0)
            {
                _str     = "select * from " + _table_name;
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return;
                }
                _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.church_group_typeC _obj = null;
            #region database fill
            try
            {
                using (var _dr = xd.SelectCommand(_str))
                {
                    while (_dr.Read())
                    {
                        _obj = null;
                        if (load_all)
                        {
                            _obj   = new ic.church_group_typeC();
                            is_new = true;
                        }
                        else
                        {
                            try
                            {
                                _obj   = datam.DATA_CG_TYPES[_dr["cg_type_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception ex)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.church_group_typeC();
                                    is_new = true;
                                }
                            }
                        }
                        if (is_new)
                        {
                            _obj.cg_type_id = _dr["cg_type_id"].ToInt32();
                            datam.DATA_CG_TYPES.Add(_obj.cg_type_id, _obj);
                        }
                        _obj.cg_type_name   = _dr["cg_type_name"].ToStringNullable();
                        _obj.sys_account_id = _dr["sys_account_id"].ToInt32();
                        _obj.is_default     = _dr["is_default"].ToInt32() == 0 ? false : true;
                    }
                    _dr.Close(); _dr.Dispose();
                }



                #endregion
                if (datam.DATA_CG_TYPES.Count == 0)
                {
                    //no db records
                    datam.DATA_CG_TYPES = new SortedList <int, ic.church_group_typeC>();
                    string[] _types = new string[] { "Family", "City", "Building Class", "Lesson Class", "Prayer Group", "FellowShip Group", "Cell", "Bible Class", "Cooking Class" };
                    int      j      = -200;
                    foreach (var k in _types)
                    {
                        datam.DATA_CG_TYPES.Add(j, new ic.church_group_typeC()
                        {
                            cg_type_id   = j,
                            cg_type_name = k
                        });

                        xd.SingleInsertCommandOnDuplicate(_table_name, new string[]
                        {
                            "cg_type_id",
                            "cg_type_name",
                            "fs_time_stamp",
                            "lch_id"
                        }, new object[] { datam.DATA_CG_TYPES[j].cg_type_id, datam.DATA_CG_TYPES[j].cg_type_name, 0, sdata.ChurchID },
                                                          string.Format("ON DUPLICATE KEY UPDATE fs_time_stamp={0}", SQLH.UnixStamp));
                        j++;
                    }
                }
                if (load_all)
                {
                    var _keys = (from k in xso.xso.DATA_MEM_COL_DET.Values
                                 where k.col_cat_id == 13
                                 select k.col_id).ToList();
                    foreach (var k in _keys)
                    {
                        xso.xso.DATA_MEM_COL_DET.Remove(k);
                    }
                    int   j          = -1000;
                    short disp_index = 1;
                    foreach (var t in datam.DATA_CG_TYPES.Values)
                    {
                        xso.xso.DATA_MEM_COL_DET.Add(j, new xso.ic.Mem_col_det()
                        {
                            col_cat_id = 13,
                            col_id     = j,
                            col_name   = t.cg_type_name,
                            disp_index = disp_index
                        });
                        t.col_id = j;
                        disp_index++;
                        j++;
                    }
                }
                else
                {
                    var _col = (from k in xso.xso.DATA_MEM_COL_DET.Values
                                where k.col_cat_id == 13
                                orderby k.col_id descending
                                select k).FirstOrDefault();
                    int   j          = _col.col_id + 1;
                    short disp_index = (_col.disp_index + 1).ToInt16();
                    foreach (var t in datam.DATA_CG_TYPES.Values.Where(f => f.col_id == 0))
                    {
                        xso.xso.DATA_MEM_COL_DET.Add(j, new xso.ic.Mem_col_det()
                        {
                            col_cat_id = 13,
                            col_id     = j,
                            col_name   = t.cg_type_name,
                            disp_index = disp_index
                        });
                        t.col_id = j;
                        disp_index++;
                        j++;
                    }
                }
            }
            catch (VistaDB.Diagnostic.VistaDBException ex)
            {
                MessageBox.Show(ex.Message);
                throw new Exception("Data Loading Failed");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public static void GetPendingPledges()
        {
            if (DATA_PENDING_PLEDGES == null)
            {
                DATA_PENDING_PLEDGES = new SortedList <int, MTOMS.ic.pledgeC>();
            }
            bool is_new = false;

            using (var xd = new xing())
            {
                string _str      = string.Empty;
                bool   load_all  = false;
                var    _temp_val = xd.GetTimeStamp("pledge_master_tb");
                if (DATA_PENDING_PLEDGES.Keys.Count == 0)
                {
                    _str     = "select * from pledge_master_tb where pl_status=0";
                    is_new   = true;
                    load_all = true;
                }
                else
                {
                    if (Last_Pending_pledge_Stamp == _temp_val)
                    {
                        return;
                    }
                    _str = string.Format("select * from pledge_master_tb where fs_time_stamp > {0}", Last_Pending_pledge_Stamp);
                }
                Last_Pending_pledge_Stamp = _temp_val;;
                using (var _dr = xd.SelectCommand(_str))
                {
                    if (_dr == null)
                    {
                        return;
                    }

                    ic.pledgeC _pledge = null;
                    while (_dr.Read())
                    {
                        _pledge = null;
                        if (load_all)
                        {
                            _pledge = new MTOMS.ic.pledgeC();
                            is_new  = true;
                        }
                        else
                        {
                            try
                            {
                                _pledge = datam.DATA_PENDING_PLEDGES[_dr["pl_id"].ToInt32()];
                                is_new  = false;
                            }
                            catch (Exception ex)
                            {
                                if (_pledge == null)
                                {
                                    _pledge = new MTOMS.ic.pledgeC();
                                    is_new  = true;
                                }
                            }
                        }
                        if (is_new)
                        {
                            _pledge.pl_id          = _dr["pl_id"].ToInt32();
                            _pledge.account_id     = _dr["account_id"].ToInt32();
                            _pledge.source_type    = (em.off_source_typeS)_dr["source_type_id"].ToByte();
                            _pledge.source_id      = _dr["source_id"].ToInt32();
                            _pledge.source_name    = _dr["source_name"].ToStringNullable();
                            _pledge.source_phone   = _dr["source_phone"].ToStringNullable();
                            _pledge.amount_pledged = _dr["amount_pledged"].ToInt32();
                            _pledge.pls_id         = _dr["pls_id"].ToInt32();
                            _pledge.cg_id          = _dr["cg_id"].ToInt32();
                            _pledge.pledge_mode    = (em.pledge_modeS)_dr["pl_mode"].ToByte();
                            //
                            if (_dr["fs_date"] != null)
                            {
                                _pledge.fs_date = _dr.GetDateTime("fs_date");
                                _pledge.fs_id   = _dr["fs_id"].ToInt32();
                            }
                            if (_dr["collect_date"] != null)
                            {
                                _pledge.fs_date = _dr.GetDateTime("collect_date");
                            }
                            DATA_PENDING_PLEDGES.Add(_pledge.pl_id, _pledge);
                        }
                        _pledge.amount_paid         = _dr["amount_paid"].ToInt32();
                        _pledge.pledge_status       = (em.pledge_statusS)_dr["pl_status"].ToInt16();
                        _pledge.added_pledge_amount = _dr["added_pledge_amount"].ToInt32();
                    }
                }

                xd.CommitTransaction();
            }
        }
        public static void FillChurchSubUnits(xing xd)
        {
            if (DATA_CHURCH_SUB_UNIT == null)
            {
                DATA_CHURCH_SUB_UNIT = new SortedList <int, MTOMS.ic.church_sub_unitC>();
            }
            bool   is_new   = false;
            bool   load_all = false;
            string _str     = string.Empty;

            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            string _table_name = "church_sub_unit_tb";

            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            var _stamp = xd.GetTimeStamp(_table_name);

            if (DATA_CHURCH_SUB_UNIT.Keys.Count == 0)
            {
                _str     = "select * from church_sub_unit_tb";
                load_all = true;
            }
            else
            {
                if (_stamp == wdata.TABLE_STAMP[_table_name])
                {
                    return;
                }
                _str = string.Format("select * from church_sub_unit_tb where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.church_sub_unitC _obj = null;
            #region database fill
            using (var _dr = xd.SelectCommand(_str))
            {
                while (_dr.Read())
                {
                    _obj = null;
                    if (load_all)
                    {
                        _obj   = new MTOMS.ic.church_sub_unitC();
                        is_new = true;
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_CHURCH_SUB_UNIT[_dr["sb_unit_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception ex)
                        {
                            if (_obj == null)
                            {
                                _obj   = new MTOMS.ic.church_sub_unitC();
                                is_new = true;
                            }
                        }
                    }
                    if (is_new)
                    {
                        _obj.sb_unit_id        = _dr["sb_unit_id"].ToInt32();
                        _obj.sb_unit_category  = (em.sb_unit_categoryS)_dr["sb_unit_cat_id"].ToInt32();
                        _obj.sb_unit_name      = _dr["sb_unit_name"].ToStringNullable();
                        _obj.sys_gp_account_id = _dr["sys_gp_account_id"].ToInt32();
                        datam.DATA_CHURCH_SUB_UNIT.Add(_obj.sb_unit_id, _obj);
                    }
                    _obj.sb_unit_name = _dr["sb_unit_name"].ToStringNullable();
                }
                _dr.Close(); _dr.Dispose();
            }


            #endregion
        }
Exemple #5
0
        public static bool GetMonthBankReconcilition(int m_partition_id)
        {
            if (DATA_MONTH_BANK_RECONCILIATION == null)
            {
                DATA_MONTH_BANK_RECONCILIATION = new SortedList <int, SortedList <int, ic.bank_reconc_transC> >();
            }
            if (DATA_MONTH_BANK_RECONCILIATION.Keys.IndexOf(m_partition_id) == -1)
            {
                DATA_MONTH_BANK_RECONCILIATION.Add(m_partition_id, new SortedList <int, ic.bank_reconc_transC>());
            }
            if (wdata.DATA_MONTH_STAMP == null)
            {
                wdata.DATA_MONTH_STAMP = new SortedList <string, SortedList <int, long> >();
            }

            string _table_name = "acc_bank_reconc_trans_tb";

            if (wdata.DATA_MONTH_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.DATA_MONTH_STAMP.Add(_table_name, new SortedList <int, long>());
                wdata.DATA_MONTH_STAMP[_table_name].Add(m_partition_id, 0);
            }
            string _str       = null;
            bool   load_all   = false;
            bool   is_new     = false;
            bool   is_updated = false;
            long   _stamp     = 0;

            using (var xd = new xing())
            {
                _stamp = xd.GetTimeStamp(_table_name);
                if (datam.DATA_MONTH_BANK_RECONCILIATION[m_partition_id].Keys.Count == 0)
                {
                    _str     = string.Format("select * from " + _table_name + " where m_partition_id={0} and status={1}", m_partition_id, em.voucher_statusS.valid.ToByte());
                    load_all = true;
                    is_new   = true;
                }
                else
                {
                    if (_stamp == wdata.DATA_MONTH_STAMP[_table_name][m_partition_id])
                    {
                        xd.RollBackTransaction();
                        return(false);
                    }
                    _str = string.Format("select * from " + _table_name + " where m_partition_id={0} and fs_time_stamp > {1}", m_partition_id, wdata.DATA_MONTH_STAMP[_table_name][m_partition_id]);
                }
                wdata.DATA_MONTH_STAMP[_table_name][m_partition_id] = _stamp;
                using (var _dr = xd.SelectCommand(_str))
                {
                    if (_dr == null)
                    {
                        return(false);
                    }
                    ic.bank_reconc_transC _obj = null;
                    while (_dr.Read())
                    {
                        if (!is_updated)
                        {
                            is_updated = true;
                        }
                        _obj = null;
                        if (load_all)
                        {
                            _obj = new ic.bank_reconc_transC();
                        }
                        else
                        {
                            try
                            {
                                _obj   = DATA_MONTH_BANK_RECONCILIATION[m_partition_id][_dr["un_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.bank_reconc_transC();
                                    is_new = true;
                                }
                            }
                        }
                        //
                        if (is_new)
                        {
                            _obj.un_id           = _dr["un_id"].ToInt32();
                            _obj.br_acc_id       = _dr["br_acc_id"].ToInt32();
                            _obj.br_acc_type     = (em.bank_reconc_typeS)_dr["br_acc_type_id"].ToInt32();
                            _obj.bank_account_id = _dr["bank_account_id"].ToInt32();
                            _obj.amount          = _dr["amount"].ToInt32();
                            _obj.desc            = _dr["description"].ToStringNullable();
                            _obj.status          = (em.voucher_statusS)_dr["status"].ToInt16();
                            _obj.m_partition_id  = _dr["m_partition_id"].ToInt32();
                            _obj.sys_account_id  = _dr["sys_account_id"].ToInt32();
                            _obj.fs_id           = _dr["fs_id"].ToInt32();
                            _obj.fs_date         = _dr.GetDateTime("fs_date");
                            //
                            _obj.objReconcAccount = datam.DATA_BANK_RECONCILIATION_ACCOUNTS[_obj.br_acc_id];
                            _obj.objBankAccount   = datam.DATA_BANK_ACCOUNTS[_obj.bank_account_id];
                        }
                        _obj.status     = (em.voucher_statusS)_dr["status"].ToInt16();
                        _obj.is_updated = true;
                        //if (_dr["del_fs_date"] != null)
                        //{
                        //    //if (_obj.objDelInfo == null) { _obj.objDelInfo = new ic.deleteBaseC(); }
                        //    //_obj.objDelInfo.del_fs_date = _dr.GetDateTime("del_fs_date");
                        //    //_obj.objDelInfo.del_fs_id = fn.GetFSID(_obj.objDelInfo.del_fs_date.Value);
                        //    //_obj.objDelInfo.del_fs_time = _dr["del_fs_time"].ToString()Nullable()();
                        //    //_obj.objDelInfo.del_pc_us_id = _dr["del_pc_us_id"].ToInt32();
                        //}
                        if (is_new)
                        {
                            DATA_MONTH_BANK_RECONCILIATION[m_partition_id].Add(_obj.un_id, _obj);
                        }
                    }
                }

                xd.CommitTransaction();
            }
            return(is_updated);
        }
Exemple #6
0
        public static bool fill_Bank_Reconciliation_Accounts(xing xd)
        {
            // if(datam.)
            //  InitBankReconciliation(xd);
            if (datam.DATA_BANK_RECONCILIATION_ACCOUNTS == null)
            {
                datam.DATA_BANK_RECONCILIATION_ACCOUNTS = new SortedList <int, ic.bank_reconc_accountC>();
            }
            string _table_name = "acc_bank_reconc_accounts_tb";

            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool   is_new   = false;
            bool   load_all = false;
            string _str     = string.Empty;
            long   _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_BANK_RECONCILIATION_ACCOUNTS.Keys.Count == 0)
            {
                _str     = "select * from " + _table_name;
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return(false);
                }
                _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.bank_reconc_accountC _obj = null;

            using (var _dr = xd.SelectCommand(_str))
            {
                while (_dr.Read())
                {
                    _obj = null;
                    if (load_all)
                    {
                        _obj   = new ic.bank_reconc_accountC();
                        is_new = true;
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_BANK_RECONCILIATION_ACCOUNTS[_dr["br_acc_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception ex)
                        {
                            if (_obj == null)
                            {
                                _obj   = new ic.bank_reconc_accountC();
                                is_new = true;
                            }
                        }
                    }
                    if (is_new)
                    {
                        _obj.br_acc_id      = _dr["br_acc_id"].ToInt32();
                        _obj.sys_account_id = _dr["sys_account_id"].ToInt32();
                        _obj.br_acc_name    = _dr["br_acc_name"].ToStringNullable();
                        _obj.br_acc_type    = (em.bank_reconc_typeS)_dr["br_acc_type_id"].ToInt16();
                        datam.DATA_BANK_RECONCILIATION_ACCOUNTS.Add(_obj.br_acc_id, _obj);
                    }
                }
                _dr.Close();
            }
            return(true);
        }
        public static bool fill_batch_no_sabbath(xing xd, int sab_fs_id)
        {
            if (DATA_BATCH_NO_SETTINGS == null)
            {
                DATA_BATCH_NO_SETTINGS = new SortedList <int, SortedList <int, ic.batch_no_SettingC> >();
            }
            if (sab_fs_id == 0)
            {
                return(false);
            }
            if (DATA_BATCH_NO_SETTINGS.IndexOfKey(sab_fs_id) == -1)
            {
                DATA_BATCH_NO_SETTINGS.Add(sab_fs_id, new SortedList <int, ic.batch_no_SettingC>());
            }
            string _table_name = "off_batch_no_settings_tb";

            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool   is_new   = false;
            bool   load_all = false;
            string _str     = string.Empty;
            long   _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_BATCH_NO_SETTINGS[sab_fs_id].Keys.Count == 0)
            {
                _str     = string.Format("select * from {0} where sab_fs_id={1}", _table_name, sab_fs_id);
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return(false);
                }
                _str     = string.Format("select * from {0} where sab_fs_id={1} and fs_time_stamp > {2}", _table_name, sab_fs_id, wdata.TABLE_STAMP[_table_name]);
                load_all = false;
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.batch_no_SettingC _obj = null;
            #region database fill
            using (var _dr = xd.SelectCommand(_str))
            {
                while (_dr.Read())
                {
                    _obj = null;
                    if (load_all)
                    {
                        _obj   = new ic.batch_no_SettingC();
                        is_new = true;
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_BATCH_NO_SETTINGS[sab_fs_id][_dr["un_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception ex)
                        {
                            if (_obj == null)
                            {
                                _obj   = new ic.batch_no_SettingC();
                                is_new = true;
                            }
                        }
                    }
                    if (is_new)
                    {
                        _obj.un_id       = _dr["un_id"].ToInt32();
                        _obj.entrant_id  = _dr["entrant_id"].ToInt32();
                        _obj.sab_fs_id   = _dr["sab_fs_id"].ToInt32();
                        _obj.batch_count = _dr["batch_count"].ToInt32();
                        _obj.batch_no    = _dr["batch_no"].ToStringNullable();
                        _obj.batch_total = _dr["batch_total"].ToInt32();

                        datam.DATA_BATCH_NO_SETTINGS[sab_fs_id].Add(_obj.un_id, _obj);
                    }
                    //
                    _obj.entrant_count = _dr["entrant_count"].ToInt32();
                    _obj.entrant_total = _dr["entrant_total"].ToInt32();
                }
                _dr.Close(); _dr.Dispose();
            }
            return(true);

            #endregion
        }
Exemple #8
0
        public static bool GetMonthCashTransfers(int m_partition_id)
        {
            if (DATA_MONTH_CASH_TRANSFERS == null)
            {
                DATA_MONTH_CASH_TRANSFERS = new SortedList <int, SortedList <int, ic.cash_transferC> >();
            }
            if (DATA_MONTH_CASH_TRANSFERS.Keys.IndexOf(m_partition_id) == -1)
            {
                DATA_MONTH_CASH_TRANSFERS.Add(m_partition_id, new SortedList <int, ic.cash_transferC>());
            }
            if (wdata.DATA_MONTH_STAMP == null)
            {
                wdata.DATA_MONTH_STAMP = new SortedList <string, SortedList <int, long> >();
            }
            string _table_name = "acc_cash_transfer_tb";
            string _key        = "_key34" + _table_name;

            if (wdata.DATA_MONTH_STAMP.IndexOfKey(_key) == -1)
            {
                wdata.DATA_MONTH_STAMP.Add(_key, new SortedList <int, long>());
                wdata.DATA_MONTH_STAMP[_key].Add(m_partition_id, 0);
            }
            string _str       = null;
            bool   load_all   = false;
            bool   is_new     = false;
            bool   is_updated = false;
            long   _stamp     = 0;

            using (var xd = new xing())
            {
                _stamp = xd.GetTimeStamp(_table_name);
                if (datam.DATA_MONTH_CASH_TRANSFERS[m_partition_id].Keys.Count == 0)
                {
                    _str     = string.Format("select * from " + _table_name + " where m_partition_id={0} and status={1}", m_partition_id, em.cashTransferStatus.valid.ToInt16());
                    load_all = true;
                    is_new   = true;
                }
                else
                {
                    if (_stamp == wdata.DATA_MONTH_STAMP[_key][m_partition_id])
                    {
                        xd.RollBackTransaction();
                        return(false);
                    }
                    _str = string.Format("select * from " + _table_name + " where m_partition_id={0} and fs_time_stamp > {1}", m_partition_id, wdata.DATA_MONTH_STAMP[_key][m_partition_id]);
                }
                wdata.DATA_MONTH_STAMP[_key][m_partition_id] = _stamp;
                using (var _dr = xd.SelectCommand(_str))
                {
                    if (_dr == null)
                    {
                        return(false);
                    }
                    ic.cash_transferC _obj = null;
                    while (_dr.Read())
                    {
                        if (!is_updated)
                        {
                            is_updated = true;
                        }
                        _obj = null;
                        if (load_all)
                        {
                            _obj = new ic.cash_transferC();
                        }
                        else
                        {
                            try
                            {
                                _obj   = datam.DATA_MONTH_CASH_TRANSFERS[m_partition_id][_dr["un_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.cash_transferC();
                                    is_new = true;
                                }
                            }
                        }
                        //
                        if (is_new)
                        {
                            _obj.un_id = _dr["un_id"].ToInt32();

                            _obj.pc_us_id            = _dr["pc_us_id"].ToInt32();
                            _obj.amount              = _dr["amount"].ToInt32();
                            _obj.destination_id      = _dr["destination_id"].ToInt32();
                            _obj.destination_type_id = _dr["destination_type_id"].ToInt32();
                            //
                            _obj.fs_date         = _dr.GetDateTime("fs_date");
                            _obj.fs_id           = fn.GetFSID(_obj.fs_date.Value);
                            _obj.source_id       = _dr["source_id"].ToInt32();
                            _obj.source_type_id  = _dr["source_type_id"].ToInt32();
                            _obj.transfer_reason = _dr["transfer_reason"].ToStringNullable();
                            _obj.pc_us_id        = _dr["pc_us_id"].ToInt32();
                        }
                        _obj.status     = (em.cashTransferStatus)_dr["status"].ToInt16();
                        _obj.is_updated = true;
                        if (_dr["delete_fs_date"] != null)
                        {
                            if (_obj.objDelInfo == null)
                            {
                                _obj.objDelInfo = new ic.deleteBaseC();
                            }
                            _obj.objDelInfo.del_fs_date = _dr.GetDateTime("delete_fs_date");
                            _obj.objDelInfo.del_fs_id   = fn.GetFSID(_obj.objDelInfo.del_fs_date.Value);
                            // _obj.objDelInfo.del_fs_time = _dr["del_fs_time"].ToStringNullable();
                            //  _obj.objDelInfo.del_pc_us_id = _dr["del_pc_us_id"].ToInt32();
                        }
                        if (is_new)
                        {
                            datam.DATA_MONTH_CASH_TRANSFERS[m_partition_id].Add(_obj.un_id, _obj);
                        }
                    }
                }

                xd.CommitTransaction();
            }
            return(is_updated);
        }
Exemple #9
0
        public static void FillExpenseCategories(xing xd)
        {
            if (DATA_EXPENSE_CATEGORY == null)
            {
                DATA_EXPENSE_CATEGORY = new SortedList <int, ic.expense_catC>();
            }
            string _table_name = "acc_expense_cat_tb";

            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool   is_new   = false;
            bool   load_all = false;
            string _str     = string.Empty;
            long   _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_EXPENSE_CATEGORY.Keys.Count == 0)
            {
                _str     = "select * from " + _table_name;
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return;
                }
                _str = string.Format("select * from " + _table_name + " where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.expense_catC _obj = null;
            #region database fill
            using (var _dr = xd.SelectCommand(_str))
            {
                while (_dr.Read())
                {
                    _obj = null;
                    if (load_all)
                    {
                        _obj   = new ic.expense_catC();
                        is_new = true;
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_EXPENSE_CATEGORY[_dr["exp_cat_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception ex)
                        {
                            if (_obj == null)
                            {
                                _obj   = new ic.expense_catC();
                                is_new = true;
                            }
                        }
                    }
                    if (is_new)
                    {
                        _obj.exp_cat_id = _dr["exp_cat_id"].ToInt32();
                        datam.DATA_EXPENSE_CATEGORY.Add(_obj.exp_cat_id, _obj);
                    }
                    _obj.exp_cat_name = _dr["exp_cat_name"].ToStringNullable();
                }
                _dr.Close(); _dr.Dispose();
            }


            #endregion
        }
Exemple #10
0
        public static void FillExpenseAccounts(xing xd)
        {
            if (DATA_EXPENSE_ACCOUNTS == null)
            {
                DATA_EXPENSE_ACCOUNTS = new SortedList <int, ic.expense_accountC>();
            }
            string _table_name = "acc_expense_accounts_tb";

            if (wdata.TABLE_STAMP == null)
            {
                wdata.TABLE_STAMP = new SortedList <string, long>();
            }
            if (wdata.TABLE_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.TABLE_STAMP.Add(_table_name, 0);
            }
            bool   is_new   = false;
            bool   load_all = false;
            string _str     = string.Empty;
            long   _stamp   = xd.GetTimeStamp(_table_name);

            if (DATA_EXPENSE_ACCOUNTS.Keys.Count == 0)
            {
                _str     = "select * from acc_expense_accounts_tb";
                load_all = true;
            }
            else
            {
                if (wdata.TABLE_STAMP[_table_name] == _stamp)
                {
                    return;
                }
                _str     = string.Format("select * from acc_expense_accounts_tb where fs_time_stamp > {0}", wdata.TABLE_STAMP[_table_name]);
                load_all = false;
            }
            wdata.TABLE_STAMP[_table_name] = _stamp;
            ic.expense_accountC _obj = null;
            #region database fill
            using (var _dr = xd.SelectCommand(_str))
            {
                while (_dr.Read())
                {
                    _obj = null;
                    if (load_all)
                    {
                        _obj   = new ic.expense_accountC();
                        is_new = true;
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_EXPENSE_ACCOUNTS[_dr["exp_acc_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception ex)
                        {
                            if (_obj == null)
                            {
                                _obj   = new ic.expense_accountC();
                                is_new = true;
                            }
                        }
                    }
                    if (is_new)
                    {
                        _obj.exp_acc_id = _dr["exp_acc_id"].ToInt32();

                        _obj.exp_acc_type = (em.exp_acc_typeS)_dr["exp_acc_type_id"].ToByte();
                        datam.DATA_EXPENSE_ACCOUNTS.Add(_obj.exp_acc_id, _obj);
                    }
                    //
                    _obj.sys_account_id = _dr["sys_account_id"].ToInt32();
                    _obj.cr_account_id  = _dr["cr_account_id"].ToInt32();
                    _obj.inc_cg_id      = _dr["cr_cg_id"].ToInt32();
                    _obj.cr_un_id       = _dr["cr_un_id"].ToInt32();
                    //
                    _obj.inc_sys_account_id = _dr["inc_sys_account_id"].ToInt32();
                    _obj.cuc_account_id     = _dr["cuc_account_id"].ToInt32();
                    _obj.exp_acc_name       = _dr["exp_acc_name"].ToStringNullable();
                    _obj.exp_cat_id         = _dr["exp_cat_id"].ToInt32();
                    if (datam.DATA_EXPENSE_CATEGORY.IndexOfKey(_obj.exp_cat_id) > -1)
                    {
                        _obj.objCategory = (_obj.exp_cat_id == 0) ? null : datam.DATA_EXPENSE_CATEGORY[_obj.exp_cat_id];
                    }

                    _obj.exp_acc_status      = (em.exp_acc_statusS)_dr["exp_acc_status"].ToByte();
                    _obj.dept_id             = _dr["dept_id"].ToInt32();
                    _obj.dept_parent_id      = _dr["dept_parent_id"].ToInt32();
                    _obj.dept_sys_account_id = _dr["dept_sys_account_id"].ToInt32();
                    _obj.objDepartment       = (_obj.dept_id == 0) ? null : datam.DATA_DEPARTMENT[_obj.dept_id];
                    _obj.is_updated          = true;
                }
                _dr.Close(); _dr.Dispose();
            }


            #endregion
        }
Exemple #11
0
        public static bool GetYearExpenses(int year, xing xd)
        {
            if (DATA_YEAR_EXPENSES == null)
            {
                DATA_YEAR_EXPENSES = new SortedList <int, SortedList <int, ic.expense_transC> >();
            }
            if (DATA_YEAR_EXPENSES.Keys.IndexOf(year) == -1)
            {
                DATA_YEAR_EXPENSES.Add(year, new SortedList <int, ic.expense_transC>());
            }
            if (wdata.DATA_MONTH_STAMP == null)
            {
                wdata.DATA_MONTH_STAMP = new SortedList <string, SortedList <int, long> >();
            }
            string _table_name = "acc_expense_trans_tb";
            string _key        = string.Format("{0}{1}", _table_name, year);

            if (wdata.TABLE_STAMP.IndexOfKey(_key) == -1)
            {
                wdata.TABLE_STAMP.Add(_key, 0);
            }
            string _str       = null;
            bool   load_all   = false;
            bool   is_new     = false;
            bool   is_updated = false;
            long   _stamp     = 0;

            _stamp = xd.GetTimeStamp(_table_name);
            if (datam.DATA_YEAR_EXPENSES[year].Keys.Count == 0)
            {
                _str     = string.Format("select * from " + _table_name + " where YEAR(exp_date)={0} and voucher_status={1}", year, em.voucher_statusS.valid.ToByte());
                load_all = true;
                is_new   = true;
            }
            else
            {
                if (_stamp == wdata.TABLE_STAMP[_key])
                {
                    xd.RollBackTransaction();
                    return(false);
                }
                _str = string.Format("select * from " + _table_name + " where YEAR(exp_date)={0} and fs_time_stamp > {1}", year, wdata.TABLE_STAMP[_key]);
            }
            wdata.TABLE_STAMP[_key] = _stamp;
            using (var _dr = xd.SelectCommand(_str))
            {
                if (_dr == null)
                {
                    return(false);
                }
                ic.expense_transC _obj = null;
                while (_dr.Read())
                {
                    if (!is_updated)
                    {
                        is_updated = true;
                    }
                    _obj = null;
                    if (load_all)
                    {
                        _obj = new ic.expense_transC();
                    }
                    else
                    {
                        try
                        {
                            _obj   = datam.DATA_YEAR_EXPENSES[year][_dr["un_id"].ToInt32()];
                            is_new = false;
                        }
                        catch (Exception)
                        {
                            if (_obj == null)
                            {
                                _obj   = new ic.expense_transC();
                                is_new = true;
                            }
                        }
                    }
                    //
                    if (is_new)
                    {
                        _obj.un_id             = _dr["un_id"].ToInt32();
                        _obj.voucher_no        = _dr["voucher_no"].ToStringNullable();
                        _obj.voucher_id        = _dr["voucher_id"].ToInt32();
                        _obj.exp_acc_id        = _dr["exp_acc_id"].ToInt32();
                        _obj.exp_amount        = _dr["exp_amount"].ToInt32();
                        _obj.exp_details       = _dr["exp_details"].ToStringNullable();
                        _obj.exp_date          = _dr.GetDateTime("exp_date");
                        _obj.exp_fs_id         = _dr["exp_fs_id"].ToInt32();
                        _obj.pc_us_id          = _dr["pc_us_id"].ToInt32();
                        _obj.exp_cat_id        = _dr["exp_cat_id"].ToInt32();
                        _obj.dept_id           = _dr["dept_id"].ToInt32();
                        _obj.dept_parent_id    = _dr["dept_parent_id"].ToInt32();
                        _obj.pay_mode          = (em.voucher_Paymode)_dr["pay_mode"].ToByte();
                        _obj.cheque_no         = _dr["cheque_no"].ToStringNullable();
                        _obj.source_type       = (em.exp_inc_src_typeS)_dr["source_type_id"].ToByte();
                        _obj.source_account_id = _dr["source_account_id"].ToInt32();
                        _obj.sys_account_id    = _dr["sys_account_id"].ToInt32();
                        _obj.source_id         = _dr["source_id"].ToInt32();
                        try
                        {
                            _obj.objExpenseAccount = datam.DATA_EXPENSE_ACCOUNTS[_obj.exp_acc_id];
                        }
                        catch (Exception)
                        {
                        }
                        //
                    }
                    _obj.voucher_status = (em.voucher_statusS)_dr["voucher_status"].ToInt16();
                    _obj.is_updated     = true;
                    if (is_new)
                    {
                        datam.DATA_YEAR_EXPENSES[year].Add(_obj.un_id, _obj);
                    }
                }
            }


            return(is_updated);
        }
Exemple #12
0
        public static bool GetMonthExpenses(int m_partition_id)
        {
            if (DATA_MONTH_EXPENSES == null)
            {
                DATA_MONTH_EXPENSES = new SortedList <int, SortedList <int, ic.expense_transC> >();
            }
            if (DATA_MONTH_EXPENSES.Keys.IndexOf(m_partition_id) == -1)
            {
                DATA_MONTH_EXPENSES.Add(m_partition_id, new SortedList <int, ic.expense_transC>());
            }
            if (wdata.DATA_MONTH_STAMP == null)
            {
                wdata.DATA_MONTH_STAMP = new SortedList <string, SortedList <int, long> >();
            }
            string _table_name = "acc_expense_trans_tb";

            if (wdata.DATA_MONTH_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.DATA_MONTH_STAMP.Add(_table_name, new SortedList <int, long>());
                wdata.DATA_MONTH_STAMP[_table_name].Add(m_partition_id, 0);
            }
            string _str       = null;
            bool   load_all   = false;
            bool   is_new     = false;
            bool   is_updated = false;
            long   _stamp     = 0;

            using (var xd = new xing())
            {
                _stamp = xd.GetTimeStamp(_table_name);
                if (datam.DATA_MONTH_EXPENSES[m_partition_id].Keys.Count == 0)
                {
                    _str     = string.Format("select * from " + _table_name + " where m_partition_id={0} and voucher_status={1}", m_partition_id, em.voucher_statusS.valid.ToByte());
                    load_all = true;
                    is_new   = true;
                }
                else
                {
                    if (_stamp == wdata.DATA_MONTH_STAMP[_table_name][m_partition_id])
                    {
                        xd.RollBackTransaction();
                        return(false);
                    }
                    _str = string.Format("select * from " + _table_name + " where m_partition_id={0} and fs_time_stamp > {1}", m_partition_id, wdata.DATA_MONTH_STAMP[_table_name][m_partition_id]);
                }
                wdata.DATA_MONTH_STAMP[_table_name][m_partition_id] = _stamp;
                using (var _dr = xd.SelectCommand(_str))
                {
                    if (_dr == null)
                    {
                        return(false);
                    }
                    ic.expense_transC _obj = null;
                    while (_dr.Read())
                    {
                        if (!is_updated)
                        {
                            is_updated = true;
                        }
                        _obj = null;
                        if (load_all)
                        {
                            _obj = new ic.expense_transC();
                        }
                        else
                        {
                            try
                            {
                                _obj   = datam.DATA_MONTH_EXPENSES[m_partition_id][_dr["un_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.expense_transC();
                                    is_new = true;
                                }
                            }
                        }
                        //
                        if (is_new)
                        {
                            _obj.un_id             = _dr["un_id"].ToInt32();
                            _obj.voucher_no        = _dr["voucher_no"].ToStringNullable();
                            _obj.voucher_id        = _dr["voucher_id"].ToInt32();
                            _obj.exp_acc_id        = _dr["exp_acc_id"].ToInt32();
                            _obj.exp_amount        = _dr["exp_amount"].ToInt32();
                            _obj.exp_details       = _dr["exp_details"].ToStringNullable();
                            _obj.exp_date          = _dr.GetDateTime("exp_date");
                            _obj.exp_fs_id         = _dr["exp_fs_id"].ToInt32();
                            _obj.pc_us_id          = _dr["pc_us_id"].ToInt32();
                            _obj.exp_cat_id        = _dr["exp_cat_id"].ToInt32();
                            _obj.dept_id           = _dr["dept_id"].ToInt32();
                            _obj.dept_parent_id    = _dr["dept_parent_id"].ToInt32();
                            _obj.pay_mode          = (em.voucher_Paymode)_dr["pay_mode"].ToByte();
                            _obj.cheque_no         = _dr["cheque_no"].ToStringNullable();
                            _obj.source_type       = (em.exp_inc_src_typeS)_dr["source_type_id"].ToByte();
                            _obj.source_account_id = _dr["source_account_id"].ToInt32();
                            _obj.sys_account_id    = _dr["sys_account_id"].ToInt32();
                            _obj.source_id         = _dr["source_id"].ToInt32();
                            if (_dr["w_dr_data"] != null)
                            {
                                _obj.w_dr_data = _dr["w_dr_data"].ToStringNullable();
                            }
                            if (_dr["tf_string"] != null)
                            {
                                _obj.tf_string = _dr["tf_string"].ToStringNullable();
                            }
                            //
                            try
                            {
                                _obj.objExpenseAccount = datam.DATA_EXPENSE_ACCOUNTS[_obj.exp_acc_id];
                            }
                            catch (Exception)
                            {
                            }
                            //
                        }
                        _obj.voucher_status = (em.voucher_statusS)_dr["voucher_status"].ToInt16();
                        _obj.is_updated     = true;
                        if (_dr["del_fs_date"] != null)
                        {
                            if (_obj.objDelInfo == null)
                            {
                                _obj.objDelInfo = new ic.deleteBaseC();
                            }
                            _obj.objDelInfo.del_fs_date  = _dr.GetDateTime("del_fs_date");
                            _obj.objDelInfo.del_fs_id    = fn.GetFSID(_obj.objDelInfo.del_fs_date.Value);
                            _obj.objDelInfo.del_fs_time  = _dr["del_fs_time"].ToStringNullable();
                            _obj.objDelInfo.del_pc_us_id = _dr["del_pc_us_id"].ToInt32();
                        }
                        if (is_new)
                        {
                            datam.DATA_MONTH_EXPENSES[m_partition_id].Add(_obj.un_id, _obj);
                        }
                    }
                }

                xd.CommitTransaction();
            }
            return(is_updated);
        }
        public static bool GetMonthForeignExchange(int m_partition_id)
        {
            if (DATA_MONTH_FOREIGN_EXCHANGE == null)
            {
                DATA_MONTH_FOREIGN_EXCHANGE = new SortedList <int, SortedList <int, ic.foreign_exchange_convC> >();
            }
            if (DATA_MONTH_FOREIGN_EXCHANGE.Keys.IndexOf(m_partition_id) == -1)
            {
                DATA_MONTH_FOREIGN_EXCHANGE.Add(m_partition_id, new SortedList <int, ic.foreign_exchange_convC>());
            }
            if (wdata.DATA_MONTH_STAMP == null)
            {
                wdata.DATA_MONTH_STAMP = new SortedList <string, SortedList <int, long> >();
            }

            string _table_name = "acc_foreign_exchange_tb";

            if (wdata.DATA_MONTH_STAMP.IndexOfKey(_table_name) == -1)
            {
                wdata.DATA_MONTH_STAMP.Add(_table_name, new SortedList <int, long>());
                wdata.DATA_MONTH_STAMP[_table_name].Add(m_partition_id, 0);
            }
            string _str       = null;
            bool   load_all   = false;
            bool   is_new     = false;
            bool   is_updated = false;
            long   _stamp     = 0;

            using (var xd = new xing())
            {
                _stamp = xd.GetTimeStamp(_table_name);
                datam.FillForeignCurrency(xd);
                if (datam.DATA_MONTH_FOREIGN_EXCHANGE[m_partition_id].Keys.Count == 0)
                {
                    _str     = string.Format("select * from " + _table_name + " where m_partition_id={0} and status={1}", m_partition_id, em.foreign_exch_statusS.valid.ToByte());
                    load_all = true;
                    is_new   = true;
                }
                else
                {
                    if (_stamp == wdata.DATA_MONTH_STAMP[_table_name][m_partition_id])
                    {
                        xd.RollBackTransaction();
                        return(false);
                    }
                    _str = string.Format("select * from " + _table_name + " where m_partition_id={0} and fs_time_stamp > {1}", m_partition_id, wdata.DATA_MONTH_STAMP[_table_name][m_partition_id]);
                }
                wdata.DATA_MONTH_STAMP[_table_name][m_partition_id] = _stamp;
                using (var _dr = xd.SelectCommand(_str))
                {
                    if (_dr == null)
                    {
                        return(false);
                    }
                    ic.foreign_exchange_convC _obj = null;
                    while (_dr.Read())
                    {
                        if (!is_updated)
                        {
                            is_updated = true;
                        }
                        _obj = null;
                        if (load_all)
                        {
                            _obj = new ic.foreign_exchange_convC();
                        }
                        else
                        {
                            try
                            {
                                _obj   = DATA_MONTH_FOREIGN_EXCHANGE[m_partition_id][_dr["un_id"].ToInt32()];
                                is_new = false;
                            }
                            catch (Exception)
                            {
                                if (_obj == null)
                                {
                                    _obj   = new ic.foreign_exchange_convC();
                                    is_new = true;
                                }
                            }
                        }
                        //
                        if (is_new)
                        {
                            _obj.un_id              = _dr["un_id"].ToInt32();
                            _obj.used_exch_rate     = _dr.GetFloat("used_exch_rate");
                            _obj.exchanged_amount   = _dr["exchanged_amount"].ToInt32();
                            _obj.curr_sys_amount    = _dr["curr_sys_amount"].ToInt32();
                            _obj.curr_sys_exch_rate = _dr.GetFloat("curr_sys_exch_rate");
                            _obj.m_partition_id     = _dr["m_partition_id"].ToInt32();
                            _obj.sys_account_id     = _dr["sys_account_id"].ToInt32();
                            _obj.currency_id        = _dr["currency_id"].ToInt32();
                            _obj.fs_id              = _dr["fs_id"].ToInt32();
                            _obj.fs_date            = _dr.GetDateTime("fs_date");
                            //
                        }
                        _obj.status     = (em.foreign_exch_statusS)_dr["status"].ToInt16();
                        _obj.is_updated = true;
                        if (_dr["del_fs_date"] != null)
                        {
                            if (_obj.objDelInfo == null)
                            {
                                _obj.objDelInfo = new ic.deleteBaseC();
                            }
                            _obj.objDelInfo.del_fs_date  = _dr.GetDateTime("del_fs_date");
                            _obj.objDelInfo.del_fs_id    = fn.GetFSID(_obj.objDelInfo.del_fs_date.Value);
                            _obj.objDelInfo.del_fs_time  = _dr["del_fs_time"].ToStringNullable();
                            _obj.objDelInfo.del_pc_us_id = _dr["del_pc_us_id"].ToInt32();
                        }
                        if (is_new)
                        {
                            DATA_MONTH_FOREIGN_EXCHANGE[m_partition_id].Add(_obj.un_id, _obj);
                        }
                    }
                }

                xd.CommitTransaction();
            }
            return(is_updated);
        }