185 lines
6.6 KiB
C#
185 lines
6.6 KiB
C#
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 util = FCOMMON.Util;
|
|
namespace FPJ0000
|
|
{
|
|
public partial class fProjectSchedule : FCOMMON.fBase
|
|
{
|
|
string fn_fpcolsize = "";
|
|
int projectindex = 0;
|
|
EEEntities db;
|
|
List<EETGW_ProjectsSchedule> list;
|
|
public fProjectSchedule(int project_)
|
|
{
|
|
InitializeComponent();
|
|
projectindex = project_;
|
|
db = new EEEntities();//this.dsPRJ.ProjectsSchedule.TableNewRow += ProjectsSchedule_TableNewRow;
|
|
fn_fpcolsize = util.MakeFilePath(util.CurrentPath, "formSetting", "fp_" + this.Name + ".ini");
|
|
}
|
|
|
|
void ProjectsSchedule_TableNewRow(object sender, DataTableNewRowEventArgs e)
|
|
{
|
|
e.Row["wuid"] = FCOMMON.info.Login.no;
|
|
e.Row["wdate"] = DateTime.Now;
|
|
e.Row["project"] = this.projectindex;
|
|
}
|
|
|
|
private void fProjectSchedule_Load(object sender, EventArgs e)
|
|
{
|
|
RefreshData();
|
|
|
|
}
|
|
void RefreshData()
|
|
{
|
|
try
|
|
{
|
|
//list = db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == this.projectindex).OrderBy(t => t.seq).ToList();
|
|
this.ta.Fill(this.dsPRJ.EETGW_ProjectsSchedule, FCOMMON.info.Login.gcode, this.projectindex);
|
|
this.taTodo.Fill(this.dsPRJ.EETGW_ProjectToDo, this.projectindex);
|
|
//this.bs.DataSource = list;//.ToList();// db.EETGW_ProjectsSchedule.Local;
|
|
//this.fpSpread1_Sheet1.DataSource = this.bs;
|
|
FPUtil.ColSizeLoad(ref this.fpSpread1, fn_fpcolsize);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
System.Windows.Forms.MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
private void projectsScheduleBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
|
{
|
|
this.Validate();
|
|
this.bs.EndEdit();
|
|
this.ta.Update(this.dsPRJ.EETGW_ProjectsSchedule);
|
|
dsPRJ.EETGW_ProjectsSchedule.AcceptChanges();
|
|
}
|
|
|
|
private void fillToolStripButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void autoToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
this.fpSpread1.ActiveSheet.DataAutoSizeColumns = true;
|
|
|
|
for (int i = 0; i < this.fpSpread1.ActiveSheet.Rows.Count; i++)
|
|
this.fpSpread1.ActiveSheet.SetRowHeight(i, 25);
|
|
//dv1.AutoResizeColumns();
|
|
}
|
|
|
|
private void resetToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (FarPoint.Win.Spread.Column col in this.fpSpread1.ActiveSheet.Columns)
|
|
{
|
|
col.Width = 100;
|
|
}
|
|
}
|
|
|
|
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FPUtil.ColsizeSave(this.fpSpread1, fn_fpcolsize);
|
|
}
|
|
|
|
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FPUtil.ColSizeLoad(ref this.fpSpread1, fn_fpcolsize);
|
|
}
|
|
|
|
private void exportListToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
fpSpread1.SaveExcel("schedule.xls",
|
|
FarPoint.Excel.ExcelSaveFlags.SaveAsViewed
|
|
| FarPoint.Excel.ExcelSaveFlags.SaveAsFiltered
|
|
| FarPoint.Excel.ExcelSaveFlags.NoFormulas
|
|
| FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
|
|
}
|
|
|
|
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
|
|
{
|
|
//새로운 데이터 추가
|
|
var newdr = this.dsPRJ.EETGW_ProjectsSchedule.NewEETGW_ProjectsScheduleRow();
|
|
newdr.wuid = FCOMMON.info.Login.no;
|
|
newdr.wdate = DateTime.Now;
|
|
newdr.project = this.projectindex;
|
|
newdr.seq = this.bs.Count + 1;
|
|
newdr.gcode = FCOMMON.info.Login.gcode;
|
|
dsPRJ.EETGW_ProjectsSchedule.AddEETGW_ProjectsScheduleRow(newdr);
|
|
}
|
|
|
|
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
|
|
{
|
|
this.bs.RemoveCurrent();
|
|
}
|
|
|
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
|
{
|
|
RefreshData();
|
|
}
|
|
|
|
private void bs_CurrentChanged(object sender, EventArgs e)
|
|
{
|
|
//아직 저장안된자료인지 체크한다.
|
|
var drv = this.bs.Current as DataRowView;
|
|
if (drv == null) return;
|
|
var dr = drv.Row as dsPRJ.EETGW_ProjectsScheduleRow;
|
|
if(dr.idx == -1)
|
|
{
|
|
this.fpSpread2.Enabled = false;
|
|
bnTodo.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.fpSpread2.Enabled = true;
|
|
bnTodo.Enabled = true;
|
|
this.bsTodo.Filter = "pseq=" + dr.idx; //해당데이터만 처리하게 한다
|
|
}
|
|
}
|
|
|
|
private void toolStripButton6_Click(object sender, EventArgs e)
|
|
{
|
|
var drv = this.bs.Current as DataRowView;
|
|
if (drv == null) return;
|
|
var dr = drv.Row as dsPRJ.EETGW_ProjectsScheduleRow;
|
|
|
|
|
|
//토도추가
|
|
var newdr = this.dsPRJ.EETGW_ProjectToDo.NewEETGW_ProjectToDoRow();
|
|
newdr.wuid = FCOMMON.info.Login.no;
|
|
newdr.wdate = DateTime.Now;
|
|
newdr.pidx = this.projectindex;
|
|
newdr.pseq = dr.idx;
|
|
this.dsPRJ.EETGW_ProjectToDo.AddEETGW_ProjectToDoRow(newdr);
|
|
}
|
|
|
|
private void toolStripButton9_Click(object sender, EventArgs e)
|
|
{
|
|
//todo만 다ㅣㅅ 불렁노다
|
|
taTodo.Fill(this.dsPRJ.EETGW_ProjectToDo, this.projectindex);
|
|
}
|
|
|
|
private void toolStripButton7_Click(object sender, EventArgs e)
|
|
{
|
|
bsTodo.RemoveCurrent();
|
|
}
|
|
|
|
private void toolStripButton8_Click(object sender, EventArgs e)
|
|
{
|
|
var cnt = taTodo.Update(this.dsPRJ.EETGW_ProjectToDo);
|
|
FCOMMON.Util.MsgI($"{cnt}건의 자료가 업데이트 되었습니다");
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
this.tam.UpdateAll(this.dsPRJ);
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|