Exemplo n.º 1
0
        private static void fill_mem_apostacy(ref xing xd)
        {
            string _str = "select * from apostacy_tb";

            try
            {
                if (DATA_APOSTACY == null)
                {
                    DATA_APOSTACY = new SortedList <int, MTOMS.ic.apostacyC>();
                }
                if (DATA_APOSTACY.Keys.Count > 0)
                {
                    return;
                }
                using (var _dr = xd.SelectCommand(_str))
                {
                    ic.apostacyC obj = null;
                    while (_dr.Read())
                    {
                        obj                = new MTOMS.ic.apostacyC();
                        obj.mem_id         = _dr["mem_id"].ToInt32();
                        obj.un_id          = _dr["un_id"].ToInt32();
                        obj.reason         = _dr["reason"] == null ? string.Empty : _dr["reason"].ToStringNullable();
                        obj.comment        = _dr["comment"] == null ? string.Empty : _dr["comment"].ToStringNullable();
                        obj.apostacy_date  = _dr.GetMySqlDateTime("apos_date").Value;
                        obj.apostacy_fs_id = fn.GetFSID(obj.apostacy_date);
                        obj.pc_us_id       = _dr["pc_us_id"].ToInt32();
                        if (_dr["lch_id"] != null)
                        {
                            obj.lch_id = _dr["lch_id"].ToInt32();
                        }
                        if (_dr["lch_type_id"] != null)
                        {
                            obj.lch_type_id = _dr["lch_type_id"].ToInt32();
                        }
                        DATA_APOSTACY.Add(obj.un_id, obj);
                        datam.DATA_MEMBER[obj.mem_id].objApostacy = obj;
                    }
                    _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);
            }
        }
        private void buttonsave_Click(object sender, EventArgs e)
        {
            string _str = "Are You Sure You Want To Carry Out This Operation ??";

            if (!dbm.WarningMessage(_str, "Apostacy Warning"))
            {
                return;
            }
            ic.apostacyC _tc   = new MTOMS.ic.apostacyC();
            string[]     _cols = new string[]
            {
                "mem_id",
                "apos_date",
                "apos_fs_id",
                "cat_id",
                "reason",
                "comment",
                "edate",
                "exp_type",
                "pc_us_id",
                "lch_id",
                "lch_type_id",
                "fs_time_stamp"
            };
            object[] _row = new object[]
            {
                _tc.mem_id         = mem_obj.mem_id,
                _tc.apostacy_date  = Convert.ToDateTime(fGrid.Rows["apostacy_date"].Cells["desc"].AuxValue),
                _tc.apostacy_fs_id = fn.GetFSID(_tc.apostacy_date),
                0,
                _tc.reason  = fnn.GetIGridCellValue(fGrid, "reason", "desc"),
                _tc.comment = fnn.GetIGridCellValue(fGrid, "comment", "desc"),
                datam.CURR_DATE,
                emm.export_type.insert.ToByte(),
                datam.PC_US_ID,
                _tc.lch_id      = datam.LCH_ID,
                _tc.lch_type_id = datam.LCH_TYPE_ID,
                0//fs_time_stamp
            };
            using (xing xd = new xing())
            {
                _tc.un_id = xd.SingleInsertCommandTSPInt("apostacy_tb", _cols, _row);
                xd.InsertUpdateDelete(string.Format("update member_tb set mem_status_type_id={0},{1},pc_us_id={2} where mem_id={3}", em.xmem_status.Apostacy.ToByte(), dbm.ETS, datam.PC_US_ID, mem_obj.mem_id));
                xd.CommitTransaction();
            }
            datam.DATA_APOSTACY.Add(_tc.un_id, _tc);
            mem_obj.mem_status_id = em.xmem_status.Apostacy.ToByte();
            mem_obj.objApostacy   = _tc;
            this.Close();
        }