根据结果集处理工作事务c#源码

private void Show_DialogResult(CurrencyWorkFable.cwfWTablet wtablet, DataTable mydtmsg, int EditState)
        {
            string strmsg;
            #region 根据返回的执行结果
            if (mydtmsg != null && mydtmsg.Rows.Count > 0)
            {
                string tname; bool isclose = false;
                if (mydtmsg.Columns.Contains("DataErrorMsg") == true)
                {
                    strmsg = mydtmsg.Rows[0]["DataErrorMsg"].ToString();
                    cwfIosys.ioCtrl.MsgShow(strmsg,CurrencyWorkFable.appLanguage.Get_String("msg_tsmsg31", "发生脚本错误!"), 2);
                    return;
                }
                if (mydtmsg.Columns.Contains("window_close") == true)
                {
                    isclose = true;
                }

                if (mydtmsg.Columns.Contains("errmsg") == true)
                {
                    strmsg = mydtmsg.Rows[0]["errmsg"].ToString();
                    MessageBox.Show(strmsg, CurrencyWorkFable.appLanguage.Get_String("msg_tsmsg32", "操作提示!")
                             , MessageBoxButtons.OK, MessageBoxIcon.Error);
                    if (mydtmsg.Columns.Contains("control_focus") == true && isclose == false)
                    {
                        tname = mydtmsg.Rows[0]["control_focus"].ToString();
                        cwfsys_workfun.set_control_Focus(wtablet.appConCase, tname);
                    }
                    return;
                }
                if (mydtmsg.Columns.Contains("win_form") == true)
                {
                    string winformname, filename = "";
                    string myfrmname;
                    for (int i = 0; i < mydtmsg.Rows.Count; i++)
                    {
                        winformname = mydtmsg.Rows[i]["win_form"].ToString();
                        if (string.IsNullOrEmpty(winformname) == false)
                        {
                            if (winformname.Contains("||") == true)
                            {
                                int wz = winformname.IndexOf("||");
                                filename = Application.StartupPath + "\\" + winformname.Substring(0, wz);
                                myfrmname = winformname.Substring(wz + 2, winformname.Length - wz - 2);
                                if (string.Compare(Application.ExecutablePath, filename, true) == 0)
                                {
                                    filename = "";
                                }
                            }
                            else
                            {
                                myfrmname = winformname;
                            }
                           Run_WinForm(filename, myfrmname, mydtmsg);

                        }
                    }
                }
                if (mydtmsg.Columns.Contains("file_print") == true)
                {

                    if (wtablet.FindForm().GetType().Equals(typeof(frmsys_runwork)) == true || wtablet.FindForm().GetType().BaseType.Equals(typeof(frmsys_runwork)))
                    {
                        string wfile;
                        for (int i = 0; i < mydtmsg.Rows.Count; i++)
                        {
                            wfile = mydtmsg.Rows[i]["file_print"].ToString();
                            // ((frmsys_runwork)this.FindForm()).myWorkTool.File_Printer(wfile);
                            // ((frmsys_runwork)this.FindForm()).myfrmParent.myWorkTool.File_Printer(wfile);
                            ((frmsys_runwork)wtablet.FindForm()).MyFrmFrist.myWorkTool.File_Printer(wfile);

                        }
                    }
                }
                if (mydtmsg.Columns.Contains("msg") == true)
                {
                    strmsg = mydtmsg.Rows[0]["msg"].ToString();
                    if (string.IsNullOrEmpty(strmsg) == false)
                        cwfIosys.ioCtrl.MsgShow(strmsg, appLanguage.Get_String("msg_tsmsg27", "操作完成!"));
                }

                if (string.IsNullOrEmpty(wtablet.appTabName) == false && isclose == false)
                {
                    // 执行显示新的数据
                    wtablet.ShowData(cwfsys_runwork.ShowOrigin.runcommand);
                }
                if (EditState == 1 && mydtmsg.Columns.Contains("exit_add") == true)
                {
                    #region 退出添加状态
                    int et = 1;
                    strmsg = mydtmsg.Rows[0]["exit_add"].ToString();
                    if (string.IsNullOrEmpty(strmsg) == false)
                    {
                        DialogResult myreg = MessageBox.Show(strmsg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (myreg == DialogResult.No)
                        {
                            et = 0;
                        }
                    }
                    else et = 0;
                    if (et == 0)
                    {
                        if (wtablet.appTbutAdd != null)
                        {
                            wtablet.state_toaddcancel();
                            wtablet.appTbutAdd.Enabled = true;
                            wtablet.appTbutAdd.Text = appLanguage.Get_String("Ctrl_but01", "添加");
                            wtablet.appTbutAdd.ToolTipText = appLanguage.Get_String("Ctrl_but01", "添加");
                            wtablet.appTbutAdd.Image = cwfResLoad.getResImage("add.gif");
                        }
                        if (wtablet.appTbutAddR != null)
                        {
                            wtablet.appTbutAddR.Enabled = true;
                            wtablet.appTbutAddR.Text = appLanguage.Get_String("Ctrl_but02", "添加子");
                            wtablet.appTbutAddR.ToolTipText = appLanguage.Get_String("Ctrl_but02", "添加子");
                            wtablet.appTbutAddR.Image = cwfResLoad.getResImage("addr.gif");
                        }
                        if (wtablet.appTbutDel != null) wtablet.appTbutDel.Enabled = true;
                        if (wtablet.appFlowshow.Contains("G") == true)
                        { wtablet.appDgv.Enabled = true; }
                        if (wtablet.appFlowshow.Contains("T") == true)
                        { wtablet.appTrv.Enabled = true; }
                        wtablet.appEditState = 0;
                    }
                    #endregion
                }

                if (mydtmsg.Columns.Contains("Refresh_WorkTable") == true)
                {
                    cwfControls.cwfPanel mypanref;
                    for (int i = 0; i < mydtmsg.Rows.Count; i++)
                    {
                        tname = mydtmsg.Rows[i]["Refresh_WorkTable"].ToString();
                        //if (this.FindForm().GetType().Name == "frmsys_runwork")
                        if (wtablet.FindForm().GetType().IsSubclassOf(typeof(frmsys_runwork)) == true)
                        {
                            mypanref = ((frmsys_runwork)wtablet.FindForm()).WorkTables.GetWorkTable(tname);
                            if (mypanref == null)
                            {
                                if (((frmsys_runwork)wtablet.FindForm()).MyFrmFrist != null)
                                {
                                    mypanref = ((frmsys_runwork)wtablet.FindForm()).MyFrmFrist.WorkTables.GetWorkTable(tname);
                                }

                            }
                            if (mypanref != null)
                            {
                                if (mypanref.GetType().Equals(typeof(cwfWTablet)) == true)
                                {
                                    ((cwfWTablet)mypanref).ShowData(cwfsys_runwork.ShowOrigin.runcommand);
                                }
                            }
                            //this.ShowData();
                        }
                    }
                }

                if (mydtmsg.Columns.Contains("control_focus") == true && isclose == false)
                {
                    tname = mydtmsg.Rows[0]["control_focus"].ToString();
                    cwfsys_workfun.set_control_Focus(wtablet.appConCase, tname);
                }
                if (isclose == true)
                { wtablet.FindForm().Close(); }
            }
            else
            { // 执行显示新的数据
                wtablet.ShowData(cwfsys_runwork.ShowOrigin.runcommand);
            }
            #endregion
        }

你可能感兴趣的:(C#)