📄 listforcumstor.cs
字号:
this.rd.RestoreProperty("SystemID=0SystemName=ReportID=0ReportCode=ReportName=ReportType=ReportMemo=PageTitle="+ Public.publicCorp +"PageSubTitle="+ this.Text.Substring(0,3) +"资料表PageHeader={ }PageFooter={[\v30]打印时间:"+ DateTime.Now.Date.ToString().Replace(" 0:00:00","") +"}GridPrintWhere=GridSelectStyle=GridPrintFields=GridTotalFields=GridChineseField=GridSortFields=GridPaginationFields=GridStatisticsFields=GridSumFields=GridRowToColFields=PdPropertys=PrinterName=EPSON LQ-1600KIIIPaperName=A4PaperWidth=827PaperHeight=1169PaperIsLandscape=TruePaperMargin.Left=30PaperMargin.Right=51PaperMargin.Top=51PaperMargin.Bottom=31");
this.rd.GridPrintFields = "单位名称,地区,地址,邮编,联系人,电话,传真,手机,电子邮件,备注";
this.rd.GridIsFillblank = false;
this.rd.PaperFooterIsNearGrid = true;
this.rd.GridIsRowAutoNumber = true;
this.rd.PaperCols = 1;
this.rd.FontHeader = new Font("宋体",10F);
this.rd.FontGrid = new Font("宋体",10F);
this.rd.FontFooter = new Font("宋体",10F);
this.rd.PageImage = Public.lyLogo;
this.rd.FontTitle = new Font("黑体",20F,FontStyle.Bold);
this.rd.FontSubTitle = new Font("黑体",20F);
this.rd.SetPageFooterFont = new Font("宋体",10F);
this.rd.SetPageFooterString = Public.GetPrintFooter();
rd.PrintPreview();
}
/// <summary>
/// 新建档案
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void button3_Click(object sender, System.EventArgs e) {
EditCustomer ec = new EditCustomer(this);
if(this.Text.IndexOf("供货商") >= 0) ec.comType = "STOCK";
if(this.Text.IndexOf("我方公司") >= 0) ec.comType = "SELF";
if(this.Text.IndexOf("我方公司") >= 0) ec.SetFormText(this.Text.Substring(0,4) + "资料");
else ec.SetFormText(this.Text.Substring(0,3) + "资料");
ec._lf = this;
ec.Show();
}
/// <summary>
/// 修改选中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem1_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
EditCustomer ec = new EditCustomer(this);
if(this.Text.IndexOf("供货商") >= 0) ec.comType = "STOCK";
if(this.Text.IndexOf("我方公司") >= 0) ec.comType = "SELF";
if(this.Text.IndexOf("我方公司") >= 0) ec.SetFormText(this.Text.Substring(0,4) + "资料");
else ec.SetFormText(this.Text.Substring(0,3) + "资料");
ec.SetAutoID(this.autoID);
ec.ShowDialog();
//自动刷新
this.LoadList();
}
}
/// <summary>
/// 删除选中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem2_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
this.DeleteInfo(this.autoID);
}
}
/// <summary>
/// 打印选中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem4_Click(object sender, System.EventArgs e) {
//
}
/// <summary>
/// 刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem6_Click(object sender, System.EventArgs e) {
this.LoadList();
}
/// <summary>
/// 刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button4_Click(object sender, System.EventArgs e) {
this.LoadList();
}
private void list_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne) {
}
/// <summary>
/// 行改变时选定整行
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void list_CurrentCellChanged(object sender, System.EventArgs e) {
this.list.Select(this.list.CurrentCell.RowNumber);
}
/// <summary>
/// 事件
/// </summary>
private void ClickInDG(object sender,MouseEventArgs e){
try{
if(this.currentIndex != -1) this.list.UnSelect(this.currentIndex);
Point p = new Point(e.X,e.Y);
DataGrid.HitTestInfo hti = this.list.HitTest(p);
if(hti.Type == DataGrid.HitTestType.Cell){
this.list.CurrentCell = new DataGridCell(hti.Row,hti.Column);
this.list.Select(hti.Row);
this.currentIndex = hti.Row;
if(this.list.CurrentCell.RowNumber < this.ds.Tables[0].Rows.Count + 1){
string xuhao = this.list[this.list.CurrentCell.RowNumber,0].ToString();
if(xuhao != null && xuhao != "" && xuhao != "null"){
try{
this.autoID = xuhao;
}catch{
this.autoID = null;
}
}
}else{
if(this.currentIndex != -1){
this.list.UnSelect(this.currentIndex);
this.currentIndex = -1;
}
this.autoID = null;
}
}else this.autoID = null;
//如果相等,则表示选中的是空行
if(this.currentIndex == ((DataTable)this.list.DataSource).Rows.Count){
this.autoID = null;
this.currentIndex = -1;
}
if(this.autoID != null){
this.menuItem1.Enabled = true;
this.menuItem2.Enabled = true;
this.menuItem4.Enabled = true;
//this.menuItem3.Visible = true;
if(this.comType == "SELL"){
this.menuItem7.Visible = true;
this.menuItem8.Visible = false;
this.menuItem9.Visible = false;
this.menuItem3.Visible = true;
}else if(this.comType == "STOCK"){
this.menuItem7.Visible = false;
this.menuItem8.Visible = true;
this.menuItem9.Visible = true;
this.menuItem3.Visible = false;
}else{
this.menuItem7.Visible = false;
this.menuItem8.Visible = false;
this.menuItem9.Visible = false;
this.menuItem3.Visible = false;
}
}else{
this.menuItem1.Enabled = false;
this.menuItem2.Enabled = false;
this.menuItem4.Enabled = false;
this.menuItem7.Visible = false;
this.menuItem8.Visible = false;
this.menuItem3.Visible = false;
}
//MessageBox.Show("当前选中:" + this.currentIndex.ToString() + ",当前autoID="+ this.autoID +",共有"+ ((DataTable)this.list.DataSource).Rows.Count.ToString() +"条记录。");
}catch{}
}
/// <summary>
/// 事件二
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UPInDG(object sender,MouseEventArgs e){
if(this.autoID != null){
this.menuItem1.Enabled = true;
this.menuItem2.Enabled = true;
this.menuItem4.Enabled = true;
//this.menuItem3.Visible = true;
if(this.comType == "SELL"){
this.menuItem7.Visible = true;
this.menuItem8.Visible = false;
this.menuItem9.Visible = false;
this.menuItem3.Visible = true;
}else if(this.comType == "STOCK"){
this.menuItem7.Visible = false;
this.menuItem8.Visible = true;
this.menuItem9.Visible = true;
this.menuItem3.Visible = false;
}else{
this.menuItem7.Visible = false;
this.menuItem8.Visible = false;
this.menuItem9.Visible = false;
this.menuItem3.Visible = false;
}
}else{
this.menuItem1.Enabled = false;
this.menuItem2.Enabled = false;
this.menuItem4.Enabled = false;
this.menuItem7.Visible = false;
this.menuItem8.Visible = false;
this.menuItem3.Visible = false;
this.menuItem9.Visible = false;
}
}
/// <summary>
/// 删除指定系统编号的信息
/// </summary>
/// <param name="_autoID"></param>
private void DeleteInfo(string _autoID){
try{
if(MessageBox.Show("删除后不可恢复且与此单位相关的采购和销售数据都将被冻结,不能进行修改,但可以删除!\n\n如果需要重新编辑与此单位相关的采购和销售数据请记录当前单位的编号;删除后再按当前编号重建此单位信息;创建完成后即可对相关的信息进行修改操作。\n\n确定删除吗?","删除确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK){
string sql = "delete from CorpColl where autoID=" + _autoID;
OleDbCommand cmd = new OleDbCommand(sql,Public.conn);
Public.CloseConn();
Public.conn.Open();
cmd.ExecuteNonQuery();
Public.conn.Close();
MessageBox.Show("操作成功,请刷新列表查看!");
return;
}
}catch(Exception ex){
MessageBox.Show(ex.Message.ToString());
return;
}
}
/// <summary>
/// 新建采购单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem8_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
string _bh = this.list[this.list.CurrentRowIndex,1].ToString();
Eboer.MIS.MF.WinForm.Stock.EditOrder addSO = new Eboer.MIS.MF.WinForm.Stock.EditOrder(_bh);
addSO.sign.Enabled = true;
addSO.button2.Enabled = true;
addSO.LoadItemCol();
addSO.sign.Text = Public.GetNewInfoID("StockOrder","soSign");
addSO.SetPackSign();
addSO.ShowDialog();
}
}
/// <summary>
/// 新建销售单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem7_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
string _bh = this.list[this.list.CurrentRowIndex,1].ToString();
Eboer.MIS.MF.WinForm.Sell.EditOrder addSO = new Eboer.MIS.MF.WinForm.Sell.EditOrder(_bh);
addSO.LoadItemCol();
addSO.sign.Enabled = true;
addSO.button2.Enabled = true;
addSO.sign.Text = Public.GetNewInfoID("SellOrder","soSign");
addSO.SetPackSign();
addSO.ShowDialog();
}
}
/// <summary>
/// 查看全部定单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem3_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
Eboer.MIS.MF.WinForm.Sell.OrderList result = new Eboer.MIS.MF.WinForm.Sell.OrderList();
result.corpSign = this.list[this.list.CurrentRowIndex,1].ToString();
result.corpName = this.list[this.list.CurrentRowIndex,2].ToString();
result.viewType = "ITEM";
result.ListInit();
result.MdiParent = Public.mainForm;
result.Show();
}
}
/// <summary>
/// 我的全部采购
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItem9_Click(object sender, System.EventArgs e) {
if(this.autoID != null){
Eboer.MIS.MF.WinForm.Stock.StockList result = new Eboer.MIS.MF.WinForm.Stock.StockList();
result.corpSign = this.list[this.list.CurrentRowIndex,1].ToString();
result.corpName = this.list[this.list.CurrentRowIndex,2].ToString();
result.viewType = "ITEM";
result.ListInit();
result.MdiParent = Public.mainForm;
result.Show();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -