您的位置:首页 > 编程语言 > C#

常见的C#窗体间的传值(一)

2015-11-10 11:07 661 查看
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();

            }

        }

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: