예제 #1
0
        private void btnOpenFolder_Click(object sender, EventArgs e)
        {
            DialogSelectComp selcomp = new DialogSelectComp(this);

            if (selcomp.ShowDialog() != DialogResult.OK)
            {
                if (this.selected_comp == null)
                {
                    Application.Exit();
                }
                return;
            }

            this.selected_comp = selcomp.selected_comp;
            this.glacc_list    = DbfTable.GetGlaccList(this.selected_comp);

            if (this.selected_comp != null)
            {
                SQLiteDbPrepare.EnsureDbCreated(this.selected_comp);
                options opt = HelperClass.GetOptions(OPTIONS.EFILING_TMP_DIR, this.selected_comp);
                if (opt.value_str != null && opt.value_str.Trim().Length > 0 && File.Exists(opt.value_str.Trim()))
                {
                    this.cZipFilePath.Text = opt.value_str.Trim();
                }
                else
                {
                    this.cZipFilePath.Text = string.Empty;
                }
            }

            this.FillForm();
        }
예제 #2
0
        public static int SaveOptions(this options options_to_save, SccompDbf selected_comp)
        {
            try
            {
                using (LocalDbEntities db = DBX.DataSet(selected_comp))
                {
                    options option = db.options.Where(o => o.key == options_to_save.key).FirstOrDefault();
                    if (option != null) // update
                    {
                        option.value_datetime = options_to_save.value_datetime;
                        option.value_num      = options_to_save.value_num;
                        option.value_str      = options_to_save.value_str;

                        return(db.SaveChanges());
                    }
                    else // add new
                    {
                        db.options.Add(options_to_save);
                        return(db.SaveChanges());
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return(0);
            }
        }
예제 #3
0
        public static options GetOptions(this OPTIONS options_key, SccompDbf selected_comp)
        {
            try
            {
                using (LocalDbEntities db = DBX.DataSet(selected_comp))
                {
                    options opt = db.options.Where(o => o.key == options_key.ToString()).FirstOrDefault();

                    if (opt != null)
                    {
                        return(opt);
                    }
                    else
                    {
                        options o = new options {
                            key = options_key.ToString()
                        };
                        db.options.Add(o);
                        db.SaveChanges();
                        return(o);
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
                return(null);
            }
        }
예제 #4
0
        private void dgv_CurrentCellChanged(object sender, EventArgs e)
        {
            if (((XDatagrid)sender).CurrentCell == null)
            {
                this.selected_comp = null;
                return;
            }

            this.selected_comp = (SccompDbf)((XDatagrid)sender).Rows[((XDatagrid)sender).CurrentCell.RowIndex].Cells[this.col_sccomp.Name].Value;
        }
예제 #5
0
        public static SccompDbfVM ToViewModel(this SccompDbf sccomp)
        {
            if (sccomp == null)
            {
                return(null);
            }

            SccompDbfVM s = new SccompDbfVM
            {
                sccomp = sccomp
            };

            return(s);
        }
예제 #6
0
        public static string GetAbsolutePath(this SccompDbf sccomp)
        {
            string path_txt = string.Empty;

            string p = sccomp.path;

            if (sccomp.path.Contains("("))
            {
                p = sccomp.path.Substring(0, sccomp.path.IndexOf("("));
            }

            if (p.Contains(@":\") || p.StartsWith(@"\\"))
            {
                path_txt = p.Trim();
            }
            else
            {
                DirectoryInfo dir_info      = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
                string        absolute_path = dir_info.Parent.FullName + @"\" + p.Trim();
                path_txt = absolute_path;
            }

            return(path_txt.TrimEnd('\\') + @"\");
        }