常見的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 XM.OA.Model;

namespace XM.OA.Office.Report
{
    public partial class FormOrdersPrintSearch : Form
    {
        private FormRushSuitsOrdersPrint formRushSuitsOrdersPrint = null;
        private FormRushCoatOrdersPrint  formRushCoatOrdersPrint = null;
        private FormRushShirtOrdersPrint formRushShirtOrdersPrint = null;
        private FormRushVestOrdersPrint  formRushVestOrdersPrint = null;
        private FormRushPantOrdersPrint  formRushPantOrdersPrint = null;
        private FormSuitDeliveryOrdersPrint formSuitDeliveryOrdersPrint = null;
        private FormCoatDeliveryOrdersPrint formCoatDeliveryOrdersPrint = null;
        private FormShirtDeliveryOrdersPrint formShirtDeliveryOrdersPrint = null;
        private FormVestDeliveryOrdersPrint  formVestDeliveryOrdersPrint = null;
        private FormPantDeliveryOrdersPrint  formPantDeliveryOrdersPrint = null;
        private FormCoatEmbroideryOrdersPrint formCoatEmbroideryOrdersPrint = null;
        private FormShirtEmbroideryPrint formShirtEmbroideryPrint = null;
        private FormPantEmbroideryOrdersPrint formPantEmbroideryOrdersPrint = null;

        private OrdersPrintSearchModel printSearchModel = null;
        public const string RushSuitsOrdersPrint = "西裝催貨單";
        public const string RushCoatOrdersPrint = "上衣催貨單";
        public const string RushShirtOrdersPrint = "襯衫催貨單";
        public const string RushVestOrdersPrint = "馬甲催貨單";
        public const string RushPantOrdersPrint = "褲子催貨單";
        public const string SuitDeliveryOrdersPrint  = "西裝出貨單";
        public const string CoatDeliveryOrdersPrint = "上衣出貨單";
        public const string ShirtDeliveryOrdersPrint = "襯衫出貨單";
        public const string VestDeliveryOrdersPrint = "馬甲出貨單";
        public const string PantDeliveryOrdersPrint = "褲子出貨單";
        public const string CoatEmbroideryOrdersPrint = "上衣繡字單";
        public const string ShirtEmbroideryPrint = "襯衫繡字單";
        public const string PantEmbroideryOrdersPrint = "褲子繡字單";

        public FormOrdersPrintSearch()
        {
            InitializeComponent();
        }

        public FormOrdersPrintSearch(FormRushSuitsOrdersPrint _formRushSuitsOrdersPrint, FormRushCoatOrdersPrint _formRushCoatOrdersPrint, FormRushShirtOrdersPrint _formRushShirtOrdersPrint, FormRushVestOrdersPrint _formRushVestOrdersPrint, FormRushPantOrdersPrint _formRushPantOrdersPrint, FormSuitDeliveryOrdersPrint _formSuitDeliveryOrdersPrint, FormCoatDeliveryOrdersPrint _formCoatDeliveryOrdersPrint, FormShirtDeliveryOrdersPrint _formShirtDeliveryOrdersPrint, FormVestDeliveryOrdersPrint _formVestDeliveryOrdersPrint, FormPantDeliveryOrdersPrint _formPantDeliveryOrdersPrint, FormCoatEmbroideryOrdersPrint _formCoatEmbroideryOrdersPrint, FormShirtEmbroideryPrint _formShirtEmbroideryPrint,FormPantEmbroideryOrdersPrint _formPantEmbroideryOrdersPrint)
        {
            InitializeComponent();
            this.formRushSuitsOrdersPrint = _formRushSuitsOrdersPrint;
            this.formRushCoatOrdersPrint = _formRushCoatOrdersPrint;
            this.formRushShirtOrdersPrint = _formRushShirtOrdersPrint;
            this.formRushVestOrdersPrint = _formRushVestOrdersPrint;
            this.formRushPantOrdersPrint = _formRushPantOrdersPrint;
            this.formSuitDeliveryOrdersPrint = _formSuitDeliveryOrdersPrint;
            this.formCoatDeliveryOrdersPrint = _formCoatDeliveryOrdersPrint;
            this.formShirtDeliveryOrdersPrint = _formShirtDeliveryOrdersPrint;
            this.formVestDeliveryOrdersPrint = _formVestDeliveryOrdersPrint;
            this.formPantDeliveryOrdersPrint = _formPantDeliveryOrdersPrint;
            this.formCoatEmbroideryOrdersPrint = _formCoatEmbroideryOrdersPrint;
            this.formShirtEmbroideryPrint = _formShirtEmbroideryPrint;
            this.formPantEmbroideryOrdersPrint = _formPantEmbroideryOrdersPrint;
        }

        public FormOrdersPrintSearch(FormRushSuitsOrdersPrint _formRushSuitsOrdersPrint, FormRushCoatOrdersPrint _formRushCoatOrdersPrint, FormRushShirtOrdersPrint _formRushShirtOrdersPrint, FormRushVestOrdersPrint _formRushVestOrdersPrint, FormRushPantOrdersPrint _formRushPantOrdersPrint, FormSuitDeliveryOrdersPrint _formSuitDeliveryOrdersPrint, FormCoatDeliveryOrdersPrint _formCoatDeliveryOrdersPrint, FormShirtDeliveryOrdersPrint _formShirtDeliveryOrdersPrint, FormVestDeliveryOrdersPrint _formVestDeliveryOrdersPrint, FormPantDeliveryOrdersPrint _formPantDeliveryOrdersPrint, FormCoatEmbroideryOrdersPrint _formCoatEmbroideryOrdersPrint, FormShirtEmbroideryPrint _formShirtEmbroideryPrint,FormPantEmbroideryOrdersPrint _formPantEmbroideryOrdersPrint,OrdersPrintSearchModel _printSearchModel)
        {
            InitializeComponent();
            this.formRushSuitsOrdersPrint = _formRushSuitsOrdersPrint;
            this.formRushCoatOrdersPrint = _formRushCoatOrdersPrint;
            this.formRushShirtOrdersPrint = _formRushShirtOrdersPrint;
            this.formRushVestOrdersPrint = _formRushVestOrdersPrint;
            this.formRushPantOrdersPrint = _formRushPantOrdersPrint;
            this.formSuitDeliveryOrdersPrint = _formSuitDeliveryOrdersPrint;
            this.formCoatDeliveryOrdersPrint = _formCoatDeliveryOrdersPrint;
            this.formShirtDeliveryOrdersPrint = _formShirtDeliveryOrdersPrint;
            this.formVestDeliveryOrdersPrint = _formVestDeliveryOrdersPrint;
            this.formPantDeliveryOrdersPrint = _formPantDeliveryOrdersPrint;
            this.formCoatEmbroideryOrdersPrint = _formCoatEmbroideryOrdersPrint;
            this.formShirtEmbroideryPrint = _formShirtEmbroideryPrint;
            this.formPantEmbroideryOrdersPrint = _formPantEmbroideryOrdersPrint; ;
            this.printSearchModel = _printSearchModel;
        }

        private void FormOrdersPrintSearch_Load(object sender, EventArgs e)
        {
            if (printSearchModel != null)
            {
                dtpBeginOrderDate.Value = printSearchModel.BeginOrderDate;
                dtpEndOrderDate.Value = printSearchModel.EndOrderDate;
                txtTranNo.Text = printSearchModel.TranNo;
                txtOrderNo.Text = printSearchModel.OrderNo;
            }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            string BeginOrderDate = dtpBeginOrderDate.Value.ToString();
            string EndOrderDate = dtpEndOrderDate.Value.ToString();
            string TranNo = txtTranNo.Text.Trim();
            string OrderNo = txtOrderNo.Text.Trim();
            if (this.cboSearch.Text.Equals(RushCoatOrdersPrint))
            {
                FormRushCoatOrdersPrint OrdersPrint = new FormRushCoatOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(RushSuitsOrdersPrint))
            {
                FormRushSuitsOrdersPrint OrdersPrint = new  FormRushSuitsOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(RushShirtOrdersPrint))
            {
                FormRushShirtOrdersPrint OrdersPrint = new  FormRushShirtOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
     
            if (this.cboSearch.Text.Equals(RushVestOrdersPrint))
            {
                FormRushVestOrdersPrint OrdersPrint = new  FormRushVestOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(RushPantOrdersPrint))
            {
                FormRushPantOrdersPrint OrdersPrint = new FormRushPantOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(SuitDeliveryOrdersPrint))
            {
                FormSuitDeliveryOrdersPrint OrdersPrint = new  FormSuitDeliveryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(CoatDeliveryOrdersPrint))
            {
                FormCoatDeliveryOrdersPrint OrdersPrint = new  FormCoatDeliveryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(ShirtDeliveryOrdersPrint))
            {
                FormShirtDeliveryOrdersPrint OrdersPrint = new  FormShirtDeliveryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(VestDeliveryOrdersPrint))
            {
                FormVestDeliveryOrdersPrint OrdersPrint = new  FormVestDeliveryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(PantDeliveryOrdersPrint))
            {
                FormPantDeliveryOrdersPrint OrdersPrint = new  FormPantDeliveryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(CoatEmbroideryOrdersPrint))
            {
                FormCoatEmbroideryOrdersPrint OrdersPrint = new  FormCoatEmbroideryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(ShirtEmbroideryPrint))
            {
                FormShirtEmbroideryPrint OrdersPrint = new  FormShirtEmbroideryPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
            if (this.cboSearch.Text.Equals(PantEmbroideryOrdersPrint))
            {
                FormPantEmbroideryOrdersPrint OrdersPrint = new FormPantEmbroideryOrdersPrint(BeginOrderDate, EndOrderDate, TranNo, OrderNo);
                OrdersPrint.Show();
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("確定關閉?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                this.Close();
            }
        }
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章