예제 #1
0
        public Result DownloadFile(ulong attachid)
        {
            Result r = null;

            if (_remote != null)
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description  = "Хавсралт файлыг өөрийн локал хавтаст татаж авах.";
                dialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                DialogResult dr = dialog.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    r = AttachUtility.GetFile(_remote, TablePrivSelect, attachid, dialog.SelectedPath);
                    string s = "";
                    if (r.ResultNo == 0)
                    {
                        string filename = Convert.ToString(r.Param[0]);
                        s = string.Format("Файл амжилттай хадгаллаа.\r\nХавсралт файлын зам: {0}", filename);
                    }
                    else
                    {
                        s = string.Format("{0}: {1}", r.ResultNo, r.ResultDesc);
                    }
                    MessageBox.Show(s, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return(r);
        }
예제 #2
0
        public Result DeleteFile(ulong attachid, string filename)
        {
            Result r = null;

            if (_remote != null)
            {
                string       msg = string.Format("Та дараах хавсралт файлыг устгахдаа итгэлтэй байна уу?\r\nХавсралт файл: {0}[{1}]", filename, attachid);
                DialogResult dr  = MessageBox.Show(msg, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    r = AttachUtility.Delete(_remote, _tableprivremove, attachid);
                    string s = "";
                    if (r.ResultNo == 0)
                    {
                        s = string.Format("Файл амжилттай устгагдлаа.\r\nХавсралт файл: {0}[{1}]", filename, attachid);
                    }
                    else
                    {
                        s = string.Format("{0}: {1}", r.ResultNo, r.ResultDesc);
                    }
                    MessageBox.Show(s, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return(r);
        }
예제 #3
0
        public Result OpenFile(ulong attachid)
        {
            if (attachid == 0)
            {
                attachid = ISM.Lib.Static.ToULong(lblAttachId.Text);
            }

            Result r = AttachUtility.GetFile(_remote, _tableprivselect, attachid, "");

            if (r.ResultNo == 0 && r.AffectedRows > 0)
            {
                string filename = ISM.Lib.Static.ToStr(r.Param[0]);
                // Shell execute
                Process process = new Process();
                process.StartInfo.UseShellExecute = true;
                process.StartInfo.FileName        = filename;
                process.Start();
            }
            return(r);
        }