공정 항목 추가 (업무일지, 프로젝트)
구매내역에 s/c 정렬 기능 추가
This commit is contained in:
@@ -116,7 +116,7 @@ namespace FCOMMON
|
||||
cmd.ExecuteNonQuery();
|
||||
retval = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
@@ -269,14 +269,14 @@ namespace FCOMMON
|
||||
/// <returns></returns>
|
||||
public static Boolean addProjectHistory(int ProjectIdx, string pdate, string Message)
|
||||
{
|
||||
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
|
||||
string sql =
|
||||
"insert into ProjectsHistory(pidx,pdate,remark,wuid,wdate)" +
|
||||
string sql =
|
||||
"insert into ProjectsHistory(pidx,pdate,remark,wuid,wdate)" +
|
||||
" values(@pidx,@pdate,@remark,@wuid,@wdate)";
|
||||
|
||||
|
||||
var cmd = new SqlCommand(sql, cn);
|
||||
cmd.Parameters.Add(new SqlParameter("pidx", ProjectIdx));
|
||||
cmd.Parameters.Add(new SqlParameter("pdate", pdate));
|
||||
@@ -519,7 +519,7 @@ namespace FCOMMON
|
||||
retval.svalue = string.Empty;
|
||||
retval.grp = string.Empty;
|
||||
|
||||
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "select isnull(code,''),isnull(memo,'')" +
|
||||
@@ -543,11 +543,11 @@ namespace FCOMMON
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Boolean insertCommonCode(string GroupCode, string code,string memo,string svalue="")
|
||||
|
||||
public static Boolean insertCommonCode(string GroupCode, string code, string memo, string svalue = "")
|
||||
{
|
||||
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "insert into common(gcode,grp,code,svalue,memo,wuid,wdate)" +
|
||||
@@ -557,13 +557,13 @@ namespace FCOMMON
|
||||
var cmd = new SqlCommand(sql, cn);
|
||||
cmd.Parameters.Add(new SqlParameter("gcode", FCOMMON.info.Login.gcode));
|
||||
cmd.Parameters.Add(new SqlParameter("grp", GroupCode));
|
||||
cmd.Parameters.Add(new SqlParameter("code", code));
|
||||
cmd.Parameters.Add(new SqlParameter("code", code));
|
||||
cmd.Parameters.Add(new SqlParameter("memo", memo));
|
||||
cmd.Parameters.Add(new SqlParameter("svalue", svalue));
|
||||
cmd.Parameters.Add(new SqlParameter("wuid", FCOMMON.info.Login.no));
|
||||
cmd.Parameters.Add(new SqlParameter("wuid", FCOMMON.info.Login.no));
|
||||
cmd.Parameters.Add(new SqlParameter("wdate", DateTime.Now));
|
||||
var da = cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
cmd.Dispose();
|
||||
cn.Close();
|
||||
cn.Dispose();
|
||||
@@ -577,7 +577,7 @@ namespace FCOMMON
|
||||
retval.title = string.Empty;
|
||||
retval.svalue = string.Empty;
|
||||
retval.grp = string.Empty;
|
||||
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "select isnull(code,''),isnull(memo,'')" +
|
||||
@@ -652,6 +652,38 @@ namespace FCOMMON
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static System.Data.DataTable getProcessList()
|
||||
{
|
||||
|
||||
System.Data.DataTable retval = new System.Data.DataTable();
|
||||
retval.Columns.Add("Code");
|
||||
retval.Columns.Add("Value");
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "select isnull(processs,'') as process" +
|
||||
" from Users" +
|
||||
" where processs is not null and gcode='{0}'" +
|
||||
" group by processs" +
|
||||
" order by process";
|
||||
|
||||
sql = string.Format(sql, FCOMMON.info.Login.gcode);
|
||||
var cmd = new SqlCommand(sql, cn);
|
||||
var rdr = cmd.ExecuteReader();
|
||||
var cnt = 0;
|
||||
while (rdr.Read())
|
||||
{
|
||||
retval.Rows.Add(new string[] { cnt.ToString(), rdr[0].ToString() });
|
||||
cnt += 1;
|
||||
}
|
||||
rdr.Close();
|
||||
cmd.Dispose();
|
||||
cn.Close();
|
||||
cn.Dispose();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static System.Data.DataTable getUserProjectList(string userName)
|
||||
{
|
||||
@@ -662,7 +694,7 @@ namespace FCOMMON
|
||||
|
||||
var cn = getCn();
|
||||
cn.Open();
|
||||
var sql = "select idx,isnull(name,''),pdate from Projects" +
|
||||
var sql = "select idx,isnull(name,''),pdate from Projects" +
|
||||
" where gcode='{0}'" +
|
||||
" and isnull(userManager,'') like '%{1}%'" +
|
||||
" or isnull(userMain,'') like '%{1}%'" +
|
||||
@@ -740,7 +772,7 @@ namespace FCOMMON
|
||||
cn.Open();
|
||||
var sql = "select isnull(place,'')" +
|
||||
" from Inventory " +
|
||||
" where gcode = '{0}'" +
|
||||
" where gcode = '{0}'" +
|
||||
" order by place";
|
||||
sql = string.Format(sql, gcode);
|
||||
var cmd = new SqlCommand(sql, cn);
|
||||
@@ -832,7 +864,7 @@ namespace FCOMMON
|
||||
cn.Close();
|
||||
cn.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
work = 0;
|
||||
total = 0;
|
||||
@@ -855,7 +887,7 @@ namespace FCOMMON
|
||||
var cmd2 = new SqlCommand("", cn);
|
||||
|
||||
cmd2.CommandText = string.Format("select count(*) from Items " +
|
||||
" where ISNULL(REPLACE(name, ' ', '') + REPLACE(model, ' ', ''), '') = '{0}'", pumname.Replace(" ","").Replace("'", "''") + model.Replace(" ","").Replace("'", "''"));
|
||||
" where ISNULL(REPLACE(name, ' ', '') + REPLACE(model, ' ', ''), '') = '{0}'", pumname.Replace(" ", "").Replace("'", "''") + model.Replace(" ", "").Replace("'", "''"));
|
||||
var cnt = int.Parse(cmd2.ExecuteScalar().ToString());
|
||||
if (cnt == 0)
|
||||
{
|
||||
@@ -896,14 +928,16 @@ namespace FCOMMON
|
||||
//}
|
||||
//else retval = -1;
|
||||
}
|
||||
|
||||
|
||||
//{
|
||||
cmd2.CommandText = string.Format("select min(idx) from Items where gcode='" + FCOMMON.info.Login.gcode +"' and ISNULL(REPLACE(name, ' ', '') + REPLACE(model, ' ', ''), '') = '{0}'", pumname.Replace(" ", "").Replace("'", "''") + model.Replace(" ","").Replace("'", "''"));
|
||||
var itemdata = cmd2.ExecuteScalar();
|
||||
if(itemdata == DBNull.Value || itemdata == null)
|
||||
cmd2.CommandText = string.Format("select min(idx) from Items where gcode='" + FCOMMON.info.Login.gcode + "' and ISNULL(REPLACE(name, ' ', '') + REPLACE(model, ' ', ''), '') = '{0}'", pumname.Replace(" ", "").Replace("'", "''") + model.Replace(" ", "").Replace("'", "''"));
|
||||
var itemdata = cmd2.ExecuteScalar();
|
||||
if (itemdata == DBNull.Value || itemdata == null)
|
||||
{
|
||||
retval = -1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
var strItem = itemdata.ToString();
|
||||
if (strItem == "") retval = -1;
|
||||
else retval = int.Parse(strItem);
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace FCOMMON
|
||||
public string nameK;
|
||||
public string dept;
|
||||
public string email;
|
||||
public string process;
|
||||
public int level;
|
||||
public string gcode;
|
||||
public int gpermission;
|
||||
|
||||
@@ -1,226 +1,226 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fFTPExplorer : Form
|
||||
{
|
||||
string homePath = string.Empty;
|
||||
string curPath = string.Empty;
|
||||
arUtil.FTPClient.FTPClient ftp;
|
||||
string fn = "ftpExplorer.ini";
|
||||
public fFTPExplorer(string title,string path,string ip,string id,string pw,int port=21,Boolean passvie=true)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = string.Format("[FTP] {0}",title);
|
||||
this.KeyPreview = true;
|
||||
this.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Escape) this.Close();
|
||||
};
|
||||
this.listView1.DoubleClick += listView1_DoubleClick;
|
||||
this.tbpath.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Enter)
|
||||
btQuery.PerformClick();
|
||||
};
|
||||
this.FormClosed += __Closed;
|
||||
ftp = new arUtil.FTPClient.FTPClient(ip, id, pw, port, passvie);
|
||||
curPath = path;
|
||||
homePath = path;
|
||||
|
||||
//홈폴더가 없으면 생성을 한다.
|
||||
var list = ftp.directoryListSimple(homePath);
|
||||
if(list.Length == 1)
|
||||
{
|
||||
//폴더를 생성해준다.
|
||||
ftp.createDirectory(homePath);
|
||||
|
||||
//하위폴더
|
||||
string[] subdir = new string[] { "Source","Document","Draw"};
|
||||
foreach (var dir in subdir)
|
||||
ftp.createDirectory(ftp.PathCombine(homePath, dir));
|
||||
}
|
||||
|
||||
this.listView1.DragDrop += listView1_DragDrop;
|
||||
this.listView1.DragEnter += listView1_DragEnter;
|
||||
this.listView1.DragOver += listView1_DragOver;
|
||||
}
|
||||
|
||||
void __Closed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
//listview column width
|
||||
|
||||
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
|
||||
for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
{
|
||||
var curwidth = this.listView1.Columns[i].Width;
|
||||
ini.set_Data("colsize", "index_" + i.ToString(), curwidth.ToString());
|
||||
}
|
||||
ini.Flush();
|
||||
|
||||
//string item = "ftp_lv_col_";
|
||||
//for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
//{
|
||||
// var curwidth = this.listView1.Columns[i].Width;
|
||||
// Pub.setting.Xml.set_Data(item + i.ToString(),curwidth.ToString());
|
||||
//}
|
||||
//Pub.setting.Save();
|
||||
}
|
||||
|
||||
private void __Load(object sender, EventArgs e)
|
||||
{
|
||||
this.tbpath.Text = this.curPath;// Pub.setting.ftp_path;
|
||||
if (this.tbpath.Text == "") tbpath.Text = "/";
|
||||
timer1.Start();
|
||||
|
||||
//listview column width
|
||||
string item = "ftp_lv_col_";
|
||||
|
||||
if (System.IO.File.Exists(fn) == false) return;
|
||||
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
|
||||
for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
{
|
||||
var cwid = ini.get_Data("colsize", "index_" + i.ToString(), "0");
|
||||
this.listView1.Columns[i].Width = int.Parse(cwid);
|
||||
}
|
||||
btQuery.PerformClick();
|
||||
}
|
||||
void listView1_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
void listView1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
void listView1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
|
||||
if (files.Length < 1) return;
|
||||
string msg = string.Format("{0}건의 파일을 업로드 하시겠습니까?",files.Length);
|
||||
if (FCOMMON.Util.MsgQ(msg) != System.Windows.Forms.DialogResult.Yes) return;
|
||||
foreach(var fileName in files)
|
||||
{
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
|
||||
string remote = tbpath.Text + "/" + fi.Name;
|
||||
ftp.Upload(remote, fi.FullName);
|
||||
}
|
||||
btQuery.PerformClick();
|
||||
}
|
||||
|
||||
|
||||
void listView1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
var path = listView1.SelectedItems[0].Text;
|
||||
var newpath = string.Empty;
|
||||
if (path == "..")
|
||||
{
|
||||
if( this.homePath.Replace("/","") == curPath.Replace("/",""))
|
||||
{
|
||||
FCOMMON.Util.MsgE("홈 디렉토리 입니다.");
|
||||
return;
|
||||
} else newpath = ftp.getParent(curPath);
|
||||
}
|
||||
else
|
||||
newpath = ftp.PathCombine(curPath, path);
|
||||
|
||||
search(newpath);
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.tbpath.Text == "/") this.tbpath.Text = homePath;
|
||||
search(this.tbpath.Text);
|
||||
tbpath.Focus();
|
||||
tbpath.SelectAll();
|
||||
}
|
||||
|
||||
void search(string path)
|
||||
{
|
||||
if (path == "") path = "/";
|
||||
curPath = path;
|
||||
tbpath.Text = curPath;
|
||||
|
||||
this.listView1.Items.Clear();
|
||||
this.progressBar1.Value = 0;
|
||||
|
||||
|
||||
// var list = ftp.directoryListSimple("/201");
|
||||
|
||||
var lvup = listView1.Items.Add("..");
|
||||
lvup.SubItems.Add("");
|
||||
lvup.SubItems.Add("");
|
||||
lvup.SubItems.Add("");
|
||||
|
||||
|
||||
var ftpdir = ftp.ListDirectoryDetail(path);
|
||||
if(ftpdir == null)
|
||||
{
|
||||
//Util.MsgE(ftp.errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
this.progressBar1.Maximum = ftpdir.Count;
|
||||
var OrderData = ftpdir.OrderBy(t => t.FileType).OrderBy(t=>t.Filename);
|
||||
|
||||
foreach (var item in OrderData)
|
||||
{
|
||||
this.progressBar1.Value += 1;
|
||||
if (item.Filename == ".") continue;
|
||||
var lv = listView1.Items.Add(item.Filename);
|
||||
lv.SubItems.Add(item.FileType.ToString());
|
||||
lv.SubItems.Add(item.Size.ToString());
|
||||
lv.SubItems.Add(item.FileDateTime.ToString());
|
||||
if (item.FileType == arUtil.FTPClient.FTPfileInfo.DirectoryEntryTypes.Directory) lv.ForeColor = Color.Blue;
|
||||
}
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
this.lbPath.Text = curPath;
|
||||
}
|
||||
|
||||
private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog od = new OpenFileDialog();
|
||||
if (od.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
|
||||
//이파일을 현재 위치에 업로드 한다.
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(od.FileName);
|
||||
string newfile = ftp.PathFileCombine(curPath, fi.Name);
|
||||
if (!ftp.Upload(newfile, od.FileName))
|
||||
Util.MsgE("upload error");
|
||||
search(curPath);
|
||||
}
|
||||
|
||||
private void downLoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.listView1.SelectedItems.Count < 1) return;
|
||||
|
||||
//이파일을 현재 위치에 업로드 한다.
|
||||
var selfile = this.listView1.SelectedItems[0];
|
||||
var remotefile = ftp.PathFileCombine(curPath, selfile.Text);
|
||||
var onlyfilename = remotefile.Substring(remotefile.LastIndexOf("/")+1);
|
||||
|
||||
SaveFileDialog od = new SaveFileDialog();
|
||||
od.Filter = "All files|*.*";
|
||||
od.FilterIndex = 1;
|
||||
od.FileName = onlyfilename;
|
||||
|
||||
if (od.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
|
||||
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(od.FileName);
|
||||
string newfile = ftp.PathFileCombine(curPath, fi.Name);
|
||||
if (!ftp.Download(remotefile,od.FileName))
|
||||
Util.MsgE("Download error");
|
||||
search(curPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fFTPExplorer : Form
|
||||
{
|
||||
string homePath = string.Empty;
|
||||
string curPath = string.Empty;
|
||||
arUtil.FTPClient.FTPClient ftp;
|
||||
string fn = "ftpExplorer.ini";
|
||||
public fFTPExplorer(string title,string path,string ip,string id,string pw,int port=21,Boolean passvie=true)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = string.Format("[FTP] {0}",title);
|
||||
this.KeyPreview = true;
|
||||
this.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Escape) this.Close();
|
||||
};
|
||||
this.listView1.DoubleClick += listView1_DoubleClick;
|
||||
this.tbpath.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Enter)
|
||||
btQuery.PerformClick();
|
||||
};
|
||||
this.FormClosed += __Closed;
|
||||
ftp = new arUtil.FTPClient.FTPClient(ip, id, pw, port, passvie);
|
||||
curPath = path;
|
||||
homePath = path;
|
||||
|
||||
//홈폴더가 없으면 생성을 한다.
|
||||
var list = ftp.directoryListSimple(homePath);
|
||||
if(list.Length == 1)
|
||||
{
|
||||
//폴더를 생성해준다.
|
||||
ftp.createDirectory(homePath);
|
||||
|
||||
//하위폴더
|
||||
string[] subdir = new string[] { "Source","Document","Draw"};
|
||||
foreach (var dir in subdir)
|
||||
ftp.createDirectory(ftp.PathCombine(homePath, dir));
|
||||
}
|
||||
|
||||
this.listView1.DragDrop += listView1_DragDrop;
|
||||
this.listView1.DragEnter += listView1_DragEnter;
|
||||
this.listView1.DragOver += listView1_DragOver;
|
||||
}
|
||||
|
||||
void __Closed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
//listview column width
|
||||
|
||||
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
|
||||
for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
{
|
||||
var curwidth = this.listView1.Columns[i].Width;
|
||||
ini.set_Data("colsize", "index_" + i.ToString(), curwidth.ToString());
|
||||
}
|
||||
ini.Flush();
|
||||
|
||||
//string item = "ftp_lv_col_";
|
||||
//for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
//{
|
||||
// var curwidth = this.listView1.Columns[i].Width;
|
||||
// Pub.setting.Xml.set_Data(item + i.ToString(),curwidth.ToString());
|
||||
//}
|
||||
//Pub.setting.Save();
|
||||
}
|
||||
|
||||
private void __Load(object sender, EventArgs e)
|
||||
{
|
||||
this.tbpath.Text = this.curPath;// Pub.setting.ftp_path;
|
||||
if (this.tbpath.Text == "") tbpath.Text = "/";
|
||||
timer1.Start();
|
||||
|
||||
//listview column width
|
||||
//string item = "ftp_lv_col_";
|
||||
|
||||
if (System.IO.File.Exists(fn) == false) return;
|
||||
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
|
||||
for (int i = 0; i < this.listView1.Columns.Count; i++)
|
||||
{
|
||||
var cwid = ini.get_Data("colsize", "index_" + i.ToString(), "0");
|
||||
this.listView1.Columns[i].Width = int.Parse(cwid);
|
||||
}
|
||||
btQuery.PerformClick();
|
||||
}
|
||||
void listView1_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
void listView1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
void listView1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
|
||||
if (files.Length < 1) return;
|
||||
string msg = string.Format("{0}건의 파일을 업로드 하시겠습니까?",files.Length);
|
||||
if (FCOMMON.Util.MsgQ(msg) != System.Windows.Forms.DialogResult.Yes) return;
|
||||
foreach(var fileName in files)
|
||||
{
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
|
||||
string remote = tbpath.Text + "/" + fi.Name;
|
||||
ftp.Upload(remote, fi.FullName);
|
||||
}
|
||||
btQuery.PerformClick();
|
||||
}
|
||||
|
||||
|
||||
void listView1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
var path = listView1.SelectedItems[0].Text;
|
||||
var newpath = string.Empty;
|
||||
if (path == "..")
|
||||
{
|
||||
if( this.homePath.Replace("/","") == curPath.Replace("/",""))
|
||||
{
|
||||
FCOMMON.Util.MsgE("홈 디렉토리 입니다.");
|
||||
return;
|
||||
} else newpath = ftp.getParent(curPath);
|
||||
}
|
||||
else
|
||||
newpath = ftp.PathCombine(curPath, path);
|
||||
|
||||
search(newpath);
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.tbpath.Text == "/") this.tbpath.Text = homePath;
|
||||
search(this.tbpath.Text);
|
||||
tbpath.Focus();
|
||||
tbpath.SelectAll();
|
||||
}
|
||||
|
||||
void search(string path)
|
||||
{
|
||||
if (path == "") path = "/";
|
||||
curPath = path;
|
||||
tbpath.Text = curPath;
|
||||
|
||||
this.listView1.Items.Clear();
|
||||
this.progressBar1.Value = 0;
|
||||
|
||||
|
||||
// var list = ftp.directoryListSimple("/201");
|
||||
|
||||
var lvup = listView1.Items.Add("..");
|
||||
lvup.SubItems.Add("");
|
||||
lvup.SubItems.Add("");
|
||||
lvup.SubItems.Add("");
|
||||
|
||||
|
||||
var ftpdir = ftp.ListDirectoryDetail(path);
|
||||
if(ftpdir == null)
|
||||
{
|
||||
//Util.MsgE(ftp.errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
this.progressBar1.Maximum = ftpdir.Count;
|
||||
var OrderData = ftpdir.OrderBy(t => t.FileType).OrderBy(t=>t.Filename);
|
||||
|
||||
foreach (var item in OrderData)
|
||||
{
|
||||
this.progressBar1.Value += 1;
|
||||
if (item.Filename == ".") continue;
|
||||
var lv = listView1.Items.Add(item.Filename);
|
||||
lv.SubItems.Add(item.FileType.ToString());
|
||||
lv.SubItems.Add(item.Size.ToString());
|
||||
lv.SubItems.Add(item.FileDateTime.ToString());
|
||||
if (item.FileType == arUtil.FTPClient.FTPfileInfo.DirectoryEntryTypes.Directory) lv.ForeColor = Color.Blue;
|
||||
}
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
this.lbPath.Text = curPath;
|
||||
}
|
||||
|
||||
private void uploadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog od = new OpenFileDialog();
|
||||
if (od.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
|
||||
//이파일을 현재 위치에 업로드 한다.
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(od.FileName);
|
||||
string newfile = ftp.PathFileCombine(curPath, fi.Name);
|
||||
if (!ftp.Upload(newfile, od.FileName))
|
||||
Util.MsgE("upload error");
|
||||
search(curPath);
|
||||
}
|
||||
|
||||
private void downLoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.listView1.SelectedItems.Count < 1) return;
|
||||
|
||||
//이파일을 현재 위치에 업로드 한다.
|
||||
var selfile = this.listView1.SelectedItems[0];
|
||||
var remotefile = ftp.PathFileCombine(curPath, selfile.Text);
|
||||
var onlyfilename = remotefile.Substring(remotefile.LastIndexOf("/")+1);
|
||||
|
||||
SaveFileDialog od = new SaveFileDialog();
|
||||
od.Filter = "All files|*.*";
|
||||
od.FilterIndex = 1;
|
||||
od.FileName = onlyfilename;
|
||||
|
||||
if (od.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
|
||||
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(od.FileName);
|
||||
string newfile = ftp.PathFileCombine(curPath, fi.Name);
|
||||
if (!ftp.Download(remotefile,od.FileName))
|
||||
Util.MsgE("Download error");
|
||||
search(curPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fSelectMonth : Form
|
||||
{
|
||||
public int selectmon = -1;
|
||||
public fSelectMonth()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.KeyDown += (s1,e1)=>{ if (e1.KeyCode == Keys.Escape) this.Close(); };
|
||||
}
|
||||
|
||||
private void fSelectMonth_Load(object sender, EventArgs e)
|
||||
{
|
||||
for(int i = 1 ; i <=12;i++)
|
||||
{
|
||||
Button newbt = new Button();
|
||||
newbt.Text = string.Format("{0}월",i);
|
||||
newbt.Tag = i;
|
||||
newbt.Click += newbt_Click;
|
||||
newbt.Dock = DockStyle.Fill;
|
||||
tableLayoutPanel1.Controls.Add(newbt);
|
||||
}
|
||||
}
|
||||
|
||||
void newbt_Click(object sender, EventArgs e)
|
||||
{
|
||||
var bt = sender as Button;
|
||||
selectmon = int.Parse(bt.Tag.ToString());
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fSelectMonth : Form
|
||||
{
|
||||
public int selectmon { get; set; }
|
||||
public fSelectMonth()
|
||||
{
|
||||
InitializeComponent();
|
||||
selectmon = -1;
|
||||
this.KeyDown += (s1,e1)=>{ if (e1.KeyCode == Keys.Escape) this.Close(); };
|
||||
}
|
||||
|
||||
private void fSelectMonth_Load(object sender, EventArgs e)
|
||||
{
|
||||
for(int i = 1 ; i <=12;i++)
|
||||
{
|
||||
Button newbt = new Button();
|
||||
newbt.Text = string.Format("{0}월",i);
|
||||
newbt.Tag = i;
|
||||
newbt.Click += newbt_Click;
|
||||
newbt.Dock = DockStyle.Fill;
|
||||
tableLayoutPanel1.Controls.Add(newbt);
|
||||
}
|
||||
}
|
||||
|
||||
void newbt_Click(object sender, EventArgs e)
|
||||
{
|
||||
var bt = sender as Button;
|
||||
selectmon = int.Parse(bt.Tag.ToString());
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Emgu.CV;
|
||||
using Emgu.CV.Structure;
|
||||
using Emgu.CV.CvEnum;
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fWebCamera : Form
|
||||
{
|
||||
VideoCapture _capture;
|
||||
public Bitmap bmp = null;
|
||||
|
||||
public fWebCamera(int idx = 0)
|
||||
{
|
||||
InitializeComponent();
|
||||
this._capture = new VideoCapture(idx);
|
||||
//capture.SetCaptureProperty(CapProp.FrameWidth, 648);
|
||||
//_capture.SetCaptureProperty(CapProp.FrameHeight, 480);
|
||||
this._capture.ImageGrabbed += capture_ImageGrabbed;
|
||||
this.FormClosing += fWebCamera_FormClosing;
|
||||
}
|
||||
|
||||
void fWebCamera_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this._capture.ImageGrabbed -= capture_ImageGrabbed;
|
||||
if (this._capture.IsOpened) this._capture.Stop();
|
||||
this._capture.Dispose();
|
||||
}
|
||||
|
||||
private void fWebCamera_Load(object sender, EventArgs e)
|
||||
{
|
||||
srcimage = new Mat();
|
||||
this._capture.Start();
|
||||
this.imageBox1.Image = srcimage;
|
||||
}
|
||||
|
||||
Mat srcimage;
|
||||
DateTime lastimage = DateTime.Now;
|
||||
|
||||
void capture_ImageGrabbed(object sender, EventArgs e)
|
||||
{
|
||||
if (this._capture.Retrieve(srcimage, 0))
|
||||
{
|
||||
lastimage = DateTime.Now;
|
||||
if (srcimage != null && srcimage.Width > 10 && srcimage.Height > 10)
|
||||
{
|
||||
if (this.Disposing || this.IsDisposed) return;
|
||||
try
|
||||
{
|
||||
this.imageBox1.Image = srcimage;
|
||||
this.imageBox1.Invalidate();
|
||||
}catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
//var img = this.pictureBox1.Image;
|
||||
|
||||
//if (img != null) img.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_capture.Stop();
|
||||
while(true)
|
||||
{
|
||||
var ts = DateTime.Now - lastimage;
|
||||
if (ts.TotalSeconds >= 1.0)
|
||||
break;
|
||||
Application.DoEvents();
|
||||
}
|
||||
bmp = srcimage.Bitmap;
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Emgu.CV;
|
||||
using Emgu.CV.Structure;
|
||||
using Emgu.CV.CvEnum;
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fWebCamera : Form
|
||||
{
|
||||
VideoCapture _capture;
|
||||
public Bitmap bmp = null;
|
||||
|
||||
public fWebCamera(int idx = 0)
|
||||
{
|
||||
InitializeComponent();
|
||||
this._capture = new VideoCapture(idx);
|
||||
//capture.SetCaptureProperty(CapProp.FrameWidth, 648);
|
||||
//_capture.SetCaptureProperty(CapProp.FrameHeight, 480);
|
||||
this._capture.ImageGrabbed += capture_ImageGrabbed;
|
||||
this.FormClosing += fWebCamera_FormClosing;
|
||||
}
|
||||
|
||||
void fWebCamera_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this._capture.ImageGrabbed -= capture_ImageGrabbed;
|
||||
if (this._capture.IsOpened) this._capture.Stop();
|
||||
this._capture.Dispose();
|
||||
}
|
||||
|
||||
private void fWebCamera_Load(object sender, EventArgs e)
|
||||
{
|
||||
srcimage = new Mat();
|
||||
this._capture.Start();
|
||||
this.imageBox1.Image = srcimage;
|
||||
}
|
||||
|
||||
Mat srcimage;
|
||||
DateTime lastimage = DateTime.Now;
|
||||
|
||||
void capture_ImageGrabbed(object sender, EventArgs e)
|
||||
{
|
||||
if (this._capture.Retrieve(srcimage, 0))
|
||||
{
|
||||
lastimage = DateTime.Now;
|
||||
if (srcimage != null && srcimage.Width > 10 && srcimage.Height > 10)
|
||||
{
|
||||
if (this.Disposing || this.IsDisposed) return;
|
||||
try
|
||||
{
|
||||
this.imageBox1.Image = srcimage;
|
||||
this.imageBox1.Invalidate();
|
||||
} catch
|
||||
{
|
||||
|
||||
}
|
||||
//var img = this.pictureBox1.Image;
|
||||
|
||||
//if (img != null) img.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_capture.Stop();
|
||||
while(true)
|
||||
{
|
||||
var ts = DateTime.Now - lastimage;
|
||||
if (ts.TotalSeconds >= 1.0)
|
||||
break;
|
||||
Application.DoEvents();
|
||||
}
|
||||
bmp = srcimage.Bitmap;
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user