示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!dbm.InsertToDatabaseWarning())
            {
                return;
            }
            ic.displineC obj = new MTOMS.ic.displineC();
            obj.cat_id = selected_cat.cat_id;
            obj.mem_id = selected_mem_obj.mem_id;
            if (txt_details.Text.Trim().Length != 0)
            {
                obj.reason = txt_details.Text.Trim();
            }
            if (txt_action.Text.Trim().Length != 0)
            {
                obj.action = txt_action.Text.Trim();
            }
            obj.start_date  = selected_start_date;
            obj.start_fs_id = selected_start_fs_id;
            obj.end_date    = selected_end_date;
            obj.end_fs_id   = selected_end_fs_id;
            obj.e_date      = datam.CURR_DATE;
            obj.pc_us_id    = datam.PC_US_ID;
            obj.pc_us_name  = datam.PC_US_NAME;
            obj.lch_id      = datam.LCH_ID;
            obj.lch_type_id = datam.LCH_TYPE_ID;
            xing xd = new xing();

            save_Mem_displine(obj, ref xd);
            xd.CommitTransaction();
            dbm.RecordInsertedMessage();
            btnCancel.PerformClick();
        }
示例#2
0
        private static void fill_mem_displine(ref xing xd)
        {
            string _str = "select * from discpline_tb";

            try
            {
                if (DATA_DISPLINE == null)
                {
                    DATA_DISPLINE = new SortedList <int, MTOMS.ic.displineC>();
                }
                if (DATA_DISPLINE.Keys.Count > 0)
                {
                    return;
                }
                using (var _dr = xd.SelectCommand(_str))
                {
                    ic.displineC obj = null;
                    while (_dr.Read())
                    {
                        obj        = new MTOMS.ic.displineC();
                        obj.un_id  = _dr["un_id"].ToInt32();
                        obj.mem_id = _dr["mem_id"].ToInt32();
                        //obj.cat_id = _dr["cat_id"].ToInt32();
                        obj.reason     = _dr["reason"] == null ? string.Empty : _dr["reason"].ToStringNullable();
                        obj.start_date = Convert.ToDateTime(_dr["start_date"]);
                        obj.end_date   = Convert.ToDateTime(_dr["end_date"]);
                        //obj.action = _dr["action"] == null ? string.Empty : _dr["action"].ToStringNullable();
                        //obj.e_date = Convert.ToDateTime(_dr["edate"]);
                        obj.pc_us_id = _dr["pc_us_id"].ToInt32();
                        //obj.pc_us_name = _dr["pc_us_name"].ToStringNullable();
                        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_DISPLINE.Add(obj.un_id, 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);
            }
        }