Files
Groupware/SubProject/FPJ0000/JobReport_/fLovProject.cs
2024-05-08 14:53:55 +09:00

120 lines
3.5 KiB
C#

using FCOMMON;
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 FPJ0000.JobReport_
{
public partial class fLovProject : fBase
{
public string Title { get; set; }
public int Index { get; set; }
string keyword = string.Empty;
public fLovProject(string search_)
{
InitializeComponent();
Title = string.Empty;
Index = -1;
this.keyword = search_;
this.KeyPreview = true;
this.KeyDown += (s1, e1) => {
if (e1.KeyCode == Keys.Escape) this.Close();
};
}
private void fLovItem_Load(object sender, EventArgs e)
{
EnsureVisibleAndUsableSize();
// var dt = this.ta.GetSearch(this.keyword);
this.taPrj.FillSearch(this.dsMSSQL.Projects,this.keyword,FCOMMON.info.Login.gcode);
this.taJob.FillSearch(this.dsQuery.JobReportItemList, this.keyword, FCOMMON.info.Login.gcode);
this.Show();
Application.DoEvents();
if (this.dsMSSQL.Projects.Rows.Count > 0) dvPrj.Focus();
else if (this.dsQuery.JobReportItemList.Rows.Count > 0) dvItem.Focus();
else dvPrj.Focus();
}
private void bs_CurrentChanged(object sender, EventArgs e)
{
}
private void dv_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btOKPrj.PerformClick();
}
}
private void dvItem_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.btOKJob.PerformClick();
}
}
private void SelectItem_Click(object sender, EventArgs e)
{
var drv = this.bsJob.Current as DataRowView;
if (drv == null)
{
Title = string.Empty;
Index = -1;
return;
}
else
{
var dr = drv.Row as dsQuery.JobReportItemListRow;//.JobReportRow;
Index = dr.pidx;
Title = dr.projectName;
}
if (Title.Trim() == "") DialogResult = System.Windows.Forms.DialogResult.Cancel;
else DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void selectProject_Click(object sender, EventArgs e)
{
var drv = bsPrj.Current as DataRowView;
if (drv == null)
{
Title = string.Empty;
Index = -1;
return;
}
else
{
var dr = drv.Row as dsPRJ.ProjectsRow;
Index = dr.idx;
Title = dr.name;
}
if (Title.Trim() == "" || Index == -1) DialogResult = System.Windows.Forms.DialogResult.Cancel;
else DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void dv_DoubleClick(object sender, EventArgs e)
{
btOKPrj.PerformClick();
}
private void dvItem_DoubleClick(object sender, EventArgs e)
{
btOKJob.PerformClick();
}
}
}