Exemplo n.º 1
0
        /// <summary>
        /// 公式计算
        /// </summary>
        /// <typeparam name="T">普通类型数据,例:int</typeparam>
        /// <param name="formula">公式,例:function Calc(x, y) { return x + y; }</param>
        /// <param name="parameterList">参数列表,Dictionary&lt;string, object&gt; 或 new {}</param>
        /// <returns></returns>
        public static T Calc <T>(string formula, object parameterList = null)
        {
            if (string.IsNullOrWhiteSpace(formula))
            {
                throw new Exception(FormulaNullException);
            }

            #region 参数数据映射
            Dictionary <string, object> paramDict = CommonHelper.GetParameterDict(parameterList);
            #endregion

            #region 公式参数映射
            // 如果存在参数信息
            if (paramDict != null)
            {
                foreach (KeyValuePair <string, object> keyValueItem in paramDict)
                {
                    formula = formula.Replace(keyValueItem.Key, keyValueItem.Value.ToString());
                }
            }
            #endregion

            #region 计算公式结果
            // 使用 COM 组件计算公式
            MSScriptControl.ScriptControl scriptControl = new MSScriptControl.ScriptControlClass()
            {
                Language = "JavaScript"
            };
            object value = scriptControl.Eval(formula);
            #endregion

            return((T)Convert.ChangeType(value, typeof(T)));
        }
    private void Form1_Load(object sender, EventArgs e)
    {
        MSScriptControl.ScriptControlClass script = new MSScriptControl.ScriptControlClass();
        script.Language = "JavaScript";

        script.AddObject("myform", this, true);
        var b = script.Eval("myform.person.Status==9");
    }
Exemplo n.º 3
0
        public String RunJs(String code)
        {
            MSScriptControl.ScriptControlClass sc = new MSScriptControl.ScriptControlClass();
            sc.Language = "javascript";
            object obj = sc.Eval(code);

            return(obj.ToString());
        }
Exemplo n.º 4
0
 /// <summary>
 /// 根据计算表达式得到计算结果
 /// </summary>
 /// <param name="CalculationInfo">计算式(比如:1*5+(2-1))</param>
 /// <returns></returns>
 public static int Calculation(string CalculationInfo)
 {
     try
     {
         MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
         sc.Language = "JavaScript";
         string str = sc.Eval(CalculationInfo).ToString();//1+12+3
         return(Convert.ToInt32(str));
     }
     catch (Exception)
     {
         return(0);
     }
 }
Exemplo n.º 5
0
        private void button_equal_Click(object sender, EventArgs e)
        {
            if (disp == false)
            {
                num2 = Double.Parse(textBox1.Text);
            }
            switch (sym)
            {
            case "+":
                textBox1.Text = (num1 + num2).ToString();
                break;

            case "-":
                textBox1.Text = (num1 - num2).ToString();
                break;

            case "*":
                textBox1.Text = (num1 * num2).ToString();
                break;

            case "/":
                if (textBox1.Text == "0")
                {
                    MessageBox.Show("除数不能为0", "错误!");
                }
                else
                {
                    textBox1.Text = (num1 / num2).ToString();
                }
                break;
            }
            num1 = Double.Parse(textBox1.Text);
            disp = true;
            equ  = false;

            if (sc == true)
            {
                try
                {
                    MSScriptControl.ScriptControlClass aa = new MSScriptControl.ScriptControlClass();
                    aa.Language = "javascript";
                    object obj = aa.Eval(textBox2.Text);
                    textBox2.Text = obj.ToString();
                }
                catch
                {
                    MessageBox.Show("请输入正确的表达式!");
                }
            }
        }
Exemplo n.º 6
0
        private void convertStringToFormulaCalculate()
        {
            MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
            sc.Language = "JavaScript";

            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show(sc.Eval("((2*3)-5+(3*4))+6/2").ToString(), "formula result", messButton);

            if (dr == DialogResult.OK)
            {
            }
            else
            {
            }
        }
Exemplo n.º 7
0
        private static MSScriptControl.ScriptControlClass initScriptEngine()
        {
            if (engine != null)
            {
                return(engine);
            }
            engine          = new MSScriptControl.ScriptControlClass();
            engine.Language = "javascript";
            string jsStr = "";

            FileInfo file = new FileInfo("C:\\Users\\leegean\\documents\\visual studio 2013\\Projects\\QQWpfApplication1\\WpfApplication1\\qq.js");

            if (file.Exists)
            {
                StreamReader reader = file.OpenText();
                jsStr = reader.ReadToEnd();
                reader.Close();
            }
            engine.Eval(jsStr);
            return(engine);
        }
Exemplo n.º 8
0
        private void button18_Click(object sender, EventArgs e)
        {
            string ans = textBox1.Text;

            MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
            sc.Language = "JavaScript";
            var b = sc.Eval(ans);
            //string a1 = pork[0].ToString();
            //string a2 = pork[1].ToString();
            //string a3 = pork[2].ToString();
            //string a4 = pork[3].ToString();
            string end = b.ToString();

            if (end == "24")
            {
                textBox1.Text = "结果是24,答案正确,恭喜你!";
            }
            else
            {
                textBox1.Text = "结果不是24,回答错误,请开始新游戏!";
            }
        }
Exemplo n.º 9
0
        // GET: Customers/Create
        public ActionResult Create()
        {
            var Currentuser = Session["CurrentUser"];

            if (Currentuser == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            ViewBag.Currentuser = Currentuser;
            var URL = Request.Url.AbsoluteUri;

            ViewBag.URL = URL;
            int        userid = Convert.ToInt32(Currentuser);
            AspNetUser user   = db.AspNetUsers.FirstOrDefault(a => a.Id == userid);

            ViewBag.UserRole  = user.RoleID;
            ViewBag.BranchID  = new SelectList(db.Branches.Where(a => a.ID > 1), "ID", "Name");
            ViewBag.BirthDate = new DateTime(2000, 1, 1);

            var js = new MSScriptControl.ScriptControlClass
            {
                AllowUI  = false,
                Language = "JScript"
            };

            js.Reset();

            string jscode = ReadResource();

            js.AddCode(jscode);
            object[] parms  = new object[] { "Netherlands" };
            string   result = (string)js.Run("buildIbans", ref parms);

            ViewBag.IbanNo         = result;
            TempData["IbanNoCode"] = result;

            return(View());
        }
Exemplo n.º 10
0
    public int Button2_Click(string t)
    {
#pragma warning disable IDE0017 // Simplify object initialization
        if (t.Length > 0)
        {
            MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
#pragma warning restore IDE0017 // Simplify object initialization
            sc.Language = "JavaScript";
            var x = sc.Eval(t);
            if (x == sc.Eval("5/0"))
            {
                throw (new DivideByZeroException("Divide by zero found"));
            }
            else
            {
                return((int)x);
            }
        }
        else
        {
            throw (new StringIsEmptyException("Empty input found"));
        }
    }
        protected override void OnStartup()
        {
            ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event appStatusEvents = ArcMap.Application as ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event;
            appStatusEvents.Initialized += new ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_InitializedEventHandler(appStatusEvents_Initialized);

            ArcMap.Events.NewDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.OpenDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.CloseDocument += ArcMap_CloseDocument;
            ReloadMonitor.reloadConfig += new ReloadEventHandler(reloadOccured);

            GetConfigSettings();
            if (!_enabledOnStart | AAState._dt == null)
            {
                AAState.PerformUpdates = false;
                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_9a"));

            }
            IEditor _editor = Globals.getEditor(ArcMap.Application);

            //Wire editor events.
            AAState._editEvents = (IEditEvents_Event)_editor;
            AAState._editEvents.OnStartEditing += OnStartEditing;
            AAState._editEvents.OnStopEditing += OnStopEditing;
            AAState._editEvents2 = (IEditEvents2_Event)_editor;// SG Jan 2003-

            script = new MSScriptControl.ScriptControlClass();
            script.AllowUI = false;
            script.Language = "VBScript";
            script.UseSafeSubset = true;

            string strScript = "function iif(psdStr, trueStr, falseStr)" + System.Environment.NewLine +
                "On Error Resume Next" + System.Environment.NewLine +
                "if psdStr then" + System.Environment.NewLine +
                        "iif = trueStr" + System.Environment.NewLine +
                      "else " + System.Environment.NewLine +
                        "iif = falseStr" + System.Environment.NewLine +
                      "end if" + System.Environment.NewLine +
                    "end function" + System.Environment.NewLine;
            script.AddCode(strScript);

            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_9b") + newValue);
        }
        protected override void OnShutdown()
        {
            try
            {
                script = null;
                lastValue = null;

                intersectLayer = null;

                intersectTable = null;
                intersectLayerSelection = null;
                intersectTableSelection = null;
                qFilter = null;
                row = null;
                testField = null;

                curve = null;
                sourceLayer = null;
                pFS = null;

                _copyPoint = null;
                _copyPolyline = null;
                _copyPolygon = null;
                sFilter = null;
                try
                {
                    if (fCursor != null)
                        Marshal.ReleaseComObject(fCursor);
                    if (cCurs != null)
                        Marshal.ReleaseComObject(cCurs);
                    if (sourceFeature != null)
                        Marshal.ReleaseComObject(sourceFeature);

                }
                catch
                { }
                fCursor = null;
                cCurs = null;

                sourceFeature = null;
                nearestFeature = null;
                fieldObj = null;
                _currentDataset = null;
                proxOp = null;

            }
            catch { }
            try
            {
                if (AAState._sw != null)
                {
                    AAState._sw.Flush();
                    AAState._sw.Close();
                    AAState._sw = null;
                }

            }
            catch { }
            try
            {
                if (ArcMap.Events != null)
                {
                    ArcMap.Events.NewDocument -= ArcMap_NewOpenDocument;
                    ArcMap.Events.OpenDocument -= ArcMap_NewOpenDocument;
                }
                if (AAState._editor != null)
                {

                    if (AAState._editor != null)
                    {

                        //Wire editor events.
                        AAState._editEvents = (IEditEvents_Event)AAState._editor;
                        AAState._editEvents.OnStartEditing -= OnStartEditing;
                        AAState._editEvents.OnStopEditing -= OnStopEditing;
                        AAState._editEvents2 = (IEditEvents2_Event)AAState._editor;// SG Jan 2003

                        AAState._editor = null;
                        AAState._editEvents = null;
                        AAState._editEvents2 = null;  // SG Jan 2003

                    }
                }

                try
                {
                    AAState.bmpOff.Dispose();
                    AAState.bmpOn.Dispose();
                    AAState.commandItem = null;
                }
                catch { }
            }

            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain5") + ex.Message);

            }
        }
Exemplo n.º 13
0
        private void GetPrice()
        {
            WriteLog("获取商品价格");
            List <string> xpaths = new List <string>()
            {
                "//*[@id='priceblock_ourprice']",
                "//*[@id='priceblock_saleprice']",
                "//*[@id='mbc']/div[1]/div/h5[1]/span/span",
                "/html/body/div[2]/div[4]/div[7]/div[7]/div/div[2]/ul/li/span/span[1]/span/a/span[2]/span",
                "/html/body/div[2]/div[4]/div[7]/div[7]/div/div[2]/ul/li/span/span[1]/span/a/span[2]",
                "//*[@id='priceblock_dealprice']",
                "id('a-autoid-3-announce')/span[2]/span",
                "id('mediaTab_heading_0')/a/span/div[2]/span",
                "//*[@id='unqualified']/div[1]/span",
                "//*[@id='olp_feature_div']/div/span/a",
                "//*[@id='unqualified']/div[1]/span",
                "//*[@id='buyNewSection']/h5/div/div[2]/div/span[2]"
            };

            product.Price = -1;
            foreach (var path in xpaths)
            {
                var htmlNode = htmlDocument.DocumentNode.SelectSingleNode(path);

                if (htmlNode == null)
                {
                    continue;
                }
                try
                {
                    if (htmlNode.InnerText.IndexOf('-') > -1)
                    {
                        string str = htmlNode.InnerText.Split('-')[0];
                        product.Price = Decimal.Parse(str.Trim().Replace("$", ""));// * Config.decExchangeRate;
                        break;
                    }
                    else if (htmlNode.InnerText.IndexOf("from") > -1)
                    {
                        string str = htmlNode.InnerText.Substring(htmlNode.InnerText.IndexOf('$') - 1, (htmlNode.InnerText.Length - htmlNode.InnerText.IndexOf('$')) + 1);
                        if (str.IndexOf("$") > -1)
                        {
                            str = str.Replace("shipping", "");
                            var prices = str.Split('+');
                            foreach (var price in prices)
                            {
                                try
                                {
                                    product.Price += decimal.Parse(price.Trim().Replace("$", ""));// * Config.decExchangeRate;
                                }
                                catch { }
                            }
                        }
                    }
                    else
                    {
                        product.Price = decimal.Parse(htmlNode.InnerText.Trim().Replace("$", ""));// * Config.decExchangeRate;
                        break;
                    }
                }
                catch
                {
                    try
                    {
                        product.Price = decimal.Parse(htmlNode.InnerText.Trim().Replace("$", ""));
                        break;
                    }
                    catch
                    {
                        try
                        {
                            product.Price = GetNumber(htmlNode.InnerText.Trim().Replace("$", ""));
                            break;
                        }
                        catch (Exception ex1)
                        {
                            product.Price = 0.01M;
                            //AmazonInternationalSpider.Helper.WriteLog("价格获取失败:" + this.url + "   " + ex1.Message);
                        }
                    }
                }
            }

            try
            {
                MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
                sc.Language = "JavaScript";
                var weight = getProductWeight();
                product.Price = decimal.Parse(sc.Eval(Setting.PriceFunction + "Price(" + product.Price.ToString() + "," + weight.ToString() + ")").ToString());
            }
            catch (Exception ex)
            {
                WriteLog("商品价格计算出错" + ex.Message, ConsoleLogStatus.Exption);
            }

            if (product.Price == -1)
            {
                WriteLog($"商品价格{product.Asin}获取异常", ConsoleLogStatus.Exption);
            }
        }
        protected override void OnStartup()
        {
            ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event appStatusEvents = ArcMap.Application as ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event;
            appStatusEvents.Initialized += new ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_InitializedEventHandler(appStatusEvents_Initialized);

            ArcMap.Events.NewDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.OpenDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.CloseDocument += ArcMap_CloseDocument;
            ReloadMonitor.reloadConfig += new ReloadEventHandler(reloadOccured);

            GetConfigSettings();
            if (!_enabledOnStart | AAState._dt == null)
            {
                AAState.PerformUpdates = false;
                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_9a"));

            }
            IEditor _editor = Globals.getEditor(ArcMap.Application);

            //Wire editor events.
            AAState._editEvents = (IEditEvents_Event)_editor;
            AAState._editEvents.OnStartEditing += OnStartEditing;

            AAState._editEvents.OnStopEditing += OnStopEditing;
            AAState._editEvents2 = (IEditEvents2_Event)_editor;// SG Jan 2003-

            try
            {
                script = new MSScriptControl.ScriptControlClass();
                script.AllowUI = false;
                script.Language = "VBScript";
                script.UseSafeSubset = true;

                string strScript = "function iif(psdStr, trueStr, falseStr)" + System.Environment.NewLine +
                    "On Error Resume Next" + System.Environment.NewLine +
                    "if psdStr then" + System.Environment.NewLine +
                            "iif = trueStr" + System.Environment.NewLine +
                          "else " + System.Environment.NewLine +
                            "iif = falseStr" + System.Environment.NewLine +
                          "end if" + System.Environment.NewLine +
                        "end function" + System.Environment.NewLine;
                string strScript2 = "function TCase(strTextString)" + System.Environment.NewLine +
                    "Dim arrTextItem, strTextNew" + System.Environment.NewLine +
                    "strSplitText = \" '-\"" + System.Environment.NewLine +
                    "For y = 1 to len(strSplitText)" + System.Environment.NewLine +
                    "strSplitItem = Mid(strSplitText,y,1)" + System.Environment.NewLine +
                    "arrTextItem = Split(strTextString, strSplitItem)" + System.Environment.NewLine +
                    "For x = 0 to Ubound(arrTextItem)" + System.Environment.NewLine +
                    "If strSplitItem = \"'\" Then" + System.Environment.NewLine +
                    "If Mid(arrTextItem(x),2,1) = \" \" Then" + System.Environment.NewLine +
                    "strTextNew = strTextNew & strSplitItem & LCase(Left(arrTextItem(x),1)) & Right(arrTextItem(x),Len(arrTextItem(x))-1)" + System.Environment.NewLine +
                    "Else" + System.Environment.NewLine +
                    "strTextNew = strTextNew & strSplitItem & UCase(Left(arrTextItem(x),1)) & Right(arrTextItem(x),Len(arrTextItem(x))-1)" + System.Environment.NewLine +
                    "End If" + System.Environment.NewLine +
                    "Else" + System.Environment.NewLine +
                    "If strSplitItem = \"-\" Then" + System.Environment.NewLine +
                    "strTextNew = strTextNew & strSplitItem & UCase(Left(arrTextItem(x),1)) & Right(arrTextItem(x),Len(arrTextItem(x))-1)" + System.Environment.NewLine +
                    "Else" + System.Environment.NewLine +
                    "strTextNew = strTextNew & strSplitItem & UCase(Left(arrTextItem(x),1)) & LCase(Right(arrTextItem(x),Len(arrTextItem(x))-1))" + System.Environment.NewLine +
                    "End If" + System.Environment.NewLine +
                    "End If" + System.Environment.NewLine +
                    "Next" + System.Environment.NewLine +
                    "strTextString = Right(strTextNew,Len(strTextNew)-1)" + System.Environment.NewLine +
                    "strTextNew = \"\"" + System.Environment.NewLine +
                    "Next" + System.Environment.NewLine +
                    "TCase = strTextString" + System.Environment.NewLine +
                    "end function" + System.Environment.NewLine;

                script.AddCode(strScript);
                script.AddCode(strScript2);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_9b") + newValue);
        }
Exemplo n.º 15
0
Arquivo: iectl.cs Projeto: wrmsr/iectl
 public ScriptUtils(MSScriptControl.ScriptControlClass _script, IEController _ie)
 {
     script = _script;
     ie = _ie;
 }
Exemplo n.º 16
0
Arquivo: iectl.cs Projeto: wrmsr/iectl
        static void Main(string[] args)
        {
            try {
                MSScriptControl.ScriptControlClass script = new MSScriptControl.ScriptControlClass();
                script.Language = "JavaScript";
                script.Timeout = 600000;
                script.AllowUI = true;
                script.UseSafeSubset = false;

                IEControllerOptions opts = new IEControllerOptions();
                IEController ie = new IEController(opts);

                ScriptUtils utils = new ScriptUtils(script, ie);
                script.AddObject("utils", utils, true); //makes var c = meta[a]; call htmlwindow - W T F

                string src = null;

                if(args.Length > 1 && args[0] == "-e") {
                    StringBuilder sb = new StringBuilder();

                    for(int i = 1; i < args.Length; i++)
                        sb.AppendLine(args[i]);

                    src = sb.ToString();
                }
                else if(args.Length > 0) {
                    using(StreamReader sr = new StreamReader(args[0]))
                        src = sr.ReadToEnd();
                }
                else
                    throw new Exception("Usage: iectl (<filename> | -e <statements...>)");

                script.AddObject("ie", ie, false);

                utils.initGlobal();

                utils.include("autoexec.js");

                //try
                {
                    utils.__eval(src);
                }
                /*catch(Exception ex)
                {
                    if(script.Error.Number > 0)
                        Console.WriteLine(script.Error.);
                }*/
            }
            catch(Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 17
0
        static public object Run(string FunctionName, string SourceBody, DataTable SourceValues, object ThisObject, string[] ReferenceNames, object[] ReferenceObjects)
        {
            object ret = null;

            try
            {
                if (string.IsNullOrEmpty(FunctionName))
                {
                    FunctionName = "Macro";
                }

                #region Preparing source code and values

                int count = 0;
                if (SourceValues != null)
                {
                    count = SourceValues.Columns.Count;
                }
                object[] param = new object[count];

                StringBuilder sb = new StringBuilder();
                sb.Append("Function ");
                sb.Append(FunctionName);
                sb.Append("(");

                if (SourceValues != null)
                {
                    for (int i = 0; i < SourceValues.Columns.Count; i++)
                    {
                        DataColumn col = SourceValues.Columns[i];
                        if (i > 0)
                        {
                            sb.Append(",");
                        }
                        sb.Append(SourceValues.Columns[i].ColumnName);

                        if (SourceValues.Rows.Count > 0)
                        {
                            param[i] = SourceValues.Rows[0][i];
                        }
                    }
                }

                sb.AppendLine(")");
                sb.AppendLine(SourceBody);
                sb.Append("End Function");

                #endregion

                #region Creating Script Instance

                MSScriptControl.ScriptControlClass scriptcontrol = new MSScriptControl.ScriptControlClass();
                scriptcontrol.AllowUI  = true;
                scriptcontrol.Language = "VBScript";
                scriptcontrol.Timeout  = 300000;

                #endregion

                #region Referencing Additional Objects

                if (ThisObject != null)
                {
                    scriptcontrol.AddObject("This", ThisObject, false);
                }

                if (ReferenceObjects != null)
                {
                    string referencename = "";
                    for (int i = 0; i < ReferenceObjects.Length; i++)
                    {
                        if (ReferenceObjects[i] != null)
                        {
                            if (ReferenceNames != null && i < ReferenceNames.Length)
                            {
                                referencename = ReferenceNames[i];
                            }
                            else
                            {
                                referencename = ReferenceObjects[i].GetType().Name;
                            }

                            scriptcontrol.AddObject(referencename, ReferenceObjects[i], false);
                        }
                    }
                }

                #endregion

                #region Run Dynamic Function

                scriptcontrol.AddCode(sb.ToString());
                ret = scriptcontrol.Run(FunctionName, param);

                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ret);
        }
        protected override void OnStartup()
        {
            ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event appStatusEvents = ArcMap.Application as ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event;
            appStatusEvents.Initialized += new ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_InitializedEventHandler(appStatusEvents_Initialized);

            ArcMap.Events.NewDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.OpenDocument += ArcMap_NewOpenDocument;
            ArcMap.Events.CloseDocument += ArcMap_CloseDocument;
            ReloadMonitor.reloadConfig += new ReloadEventHandler(reloadOccured);

            GetConfigSettings();
            if (!_enabledOnStart | AAState._dt == null)
            {
                AAState._PerformUpdates = false;
                //ExecuteToggleAACommands();
                AAState.setIcon();
            }
            IEditor _editor = Globals.getEditor(ArcMap.Application);

            //Wire editor events.
            AAState._editEvents = (IEditEvents_Event)_editor;
            AAState._editEvents.OnStartEditing += OnStartEditing;
            AAState._editEvents.OnStopEditing += OnStopEditing;

            //_comReleaser = new ESRI.ArcGIS.ADF.ComReleaser();
            //_comReleaser.ManageLifetime(fCursor);

            script = new MSScriptControl.ScriptControlClass();
            script.AllowUI = false;
            script.Language = "VBScript";
            script.UseSafeSubset = true;

            string strScript = "function iif(psdStr, trueStr, falseStr)" + System.Environment.NewLine +
                "On Error Resume Next" + System.Environment.NewLine +
                "if psdStr then" + System.Environment.NewLine +
                        "iif = trueStr" + System.Environment.NewLine +
                      "else " + System.Environment.NewLine +
                        "iif = falseStr" + System.Environment.NewLine +
                      "end if" + System.Environment.NewLine +
                    "end function" + System.Environment.NewLine;
            script.AddCode(strScript);

            //     strScript = "function trueStr () " + System.Environment.NewLine +
            //     "if trueStr== \"<Null>\" then " + System.Environment.NewLine +
            //     "return(DBNull.value)" + System.Environment.NewLine +
            //     "else" + System.Environment.NewLine +
            //     "return trueStr" + System.Environment.NewLine +
            //     "end function" + System.Environment.NewLine;

            //     script.AddCode(strScript);
            //     strScript = "function falseStr () " + System.Environment.NewLine +
            //"if falseStr== \"<Null>\" then " + System.Environment.NewLine +
            //"return(DBNull.value)" + System.Environment.NewLine +
            //"else" + System.Environment.NewLine +
            //"return falseStr" + System.Environment.NewLine +
            //"end function" + System.Environment.NewLine;

            //     script.AddCode(strScript);
            AAState.WriteLine("                  script to process: " + newValue);
            //_application = _editor.Parent;
            //if (_application != null)
            //{
            //    _document = _application.Document;
            //    _mxDocument = (IMxDocument)_document;
            //    _map = _mxDocument.FocusMap;
            //}
            //else
            //    MessageBox.Show("Couldn't get handle for ArcMap Application");
        }
        protected override void OnShutdown()
        {
            try
            {
                script = null;
                lastValue = null;

                areaLayer = null;
                intersectLayer = null;

                intersectTable = null;
                intersectLayerSelection = null;
                intersectTableSelection = null;
                qFilter = null;
                row = null;
                testField = null;

                curve = null;
                sourceLayer = null;
                pFS = null;

                _copyPoint = null;
                _copyPolyline = null;
                _copyPolygon = null;
                sFilter = null;
                try
                {
                    if (fCursor != null)
                        Marshal.ReleaseComObject(fCursor);
                    if (cCurs != null)
                        Marshal.ReleaseComObject(cCurs);
                    if (sourceFeature != null)
                        Marshal.ReleaseComObject(sourceFeature);

                }
                catch
                { }
                fCursor = null;
                cCurs = null;

                sourceFeature = null;
                nearestFeature = null;
                fieldObj = null;
                _currentDataset = null;
                proxOp = null;

            }
            catch { }
            try
            {
                if (AAState._sw != null)
                {
                    AAState._sw.Flush();
                    AAState._sw.Close();
                    AAState._sw = null;
                }

            }
            catch { }
            try
            {
                //ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event appStatusEvents = ArcMap.Application as ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_Event;
                //appStatusEvents.Initialized -= new ESRI.ArcGIS.ArcMap.IApplicationStatusEvents_InitializedEventHandler(appStatusEvents_Initialized);
                if (ArcMap.Events != null)
                {
                    ArcMap.Events.NewDocument -= ArcMap_NewOpenDocument;
                    ArcMap.Events.OpenDocument -= ArcMap_NewOpenDocument;
                }
                if (AAState._editor != null)
                {

                    if (AAState._editor != null)
                    {

                        //Wire editor events.
                        AAState._editEvents = (IEditEvents_Event)AAState._editor;
                        AAState._editEvents.OnStartEditing -= OnStartEditing;
                        AAState._editEvents.OnStopEditing -= OnStopEditing;

                        AAState._editor = null;
                        AAState._editEvents = null;

                    }
                }

                try
                {
                    AAState.bmpOff.Dispose();
                    AAState.bmpOn.Dispose();
                    AAState.commandItem = null;
                }
                catch { }
            }

            catch (Exception ex)
            {
                MessageBox.Show("OnShutdown: " + ex.Message);

            }
        }
Exemplo n.º 20
0
        public ActionResult Create([Bind(Include = "ID,IBANNo,CardID,Name,BranchID,CreateDate,BirthDate,Email,Address,Phone1,Phone2")] Customer customer)
        {
            var Currentuser = Session["CurrentUser"];

            if (Currentuser == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            ViewBag.Currentuser = Currentuser;
            var URL = Request.Url.AbsoluteUri;

            ViewBag.URL = URL;
            int        userid = Convert.ToInt32(Currentuser);
            AspNetUser user   = db.AspNetUsers.FirstOrDefault(a => a.Id == userid);

            ViewBag.UserRole = user.RoleID;
            if (customer.CardID == null)
            {
                ModelState.AddModelError("CardID", "Please filled the CardID field");
            }
            if (customer.BirthDate == null)
            {
                ModelState.AddModelError("BirthDate", "Please filled the BirthDate field");
            }
            if (customer.Email == null)
            {
                ModelState.AddModelError("Email", "Please filled the Email field");
            }
            if (customer.Name == null)
            {
                ModelState.AddModelError("Name", "Please filled the Name field");
            }
            if (ModelState.IsValid)
            {
                customer.IBANNo     = TempData["IbanNoCode"].ToString();
                customer.CreateDate = DateTime.Now;
                if (user.BranchID != 1)
                {
                    customer.BranchID = user.BranchID;
                }
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var js = new MSScriptControl.ScriptControlClass
            {
                AllowUI  = false,
                Language = "JScript"
            };

            js.Reset();

            string jscode = ReadResource();

            js.AddCode(jscode);
            object[] parms  = new object[] { "Netherlands" };
            string   result = (string)js.Run("buildIbans", ref parms);

            ViewBag.IbanNo         = result;
            TempData["IbanNoCode"] = result;

            ViewBag.UserRole = user.RoleID;
            ViewBag.BranchID = new SelectList(db.Branches.Where(a => a.ID > 1), "ID", "Name", customer.BranchID);
            return(View(customer));
        }
Exemplo n.º 21
0
        //保存并通过
        protected void Button4_Click(object sender, EventArgs e)
        {
            try
            {
                string TjszStrSz, TjszStrCg;
                string TjszStr;
                string str1 = null;
                str1 = "" + strNextNodeNum + "0";
                ArrayList myarr = new ArrayList();
                string[]  mystr = str1.Split(',');
                for (int s = 0; s < mystr.Length; s++)
                {
                    TjszStrCg = null; TjszStrSz = null;
                    TjszStr   = null;
                    TjszStr   = "1 == 1";

                    //常规型条件
                    SqlDataReader datar1 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[常规型]'");
                    while (datar1.Read())
                    {
                        if (datar1["fbCondi"].ToString() == "包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + ">= 0 ";
                        }
                        else if (datar1["fbCondi"].ToString() == "不包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + "< 0 ";
                        }
                    }
                    datar1.Close();

                    //数字型条件
                    SqlDataReader datar2 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[数字型]'");
                    while (datar2.Read())
                    {
                        TjszStrSz += "&&" + int.Parse(Request.Form["" + datar2["fbNo"] + ""]) + " " + datar2["fbCondi"] + " " + datar2["fbValue"] + "  ";
                    }
                    datar2.Close();

                    TjszStr += TjszStrCg + TjszStrSz;
                    MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
                    sc.Language = "javascript";
                    if ((bool)sc.Eval(TjszStr) == false)
                    {
                        strnnNumkey  = strnnNumkey.Replace("" + mystr[s] + ",", "");
                        lblnnnk.Text = lblnnnk.Text.Replace("" + mystr[s] + ",", "");
                    }
                }

                SqlHelper.ExecuteSql("INSERT INTO hk_WorkAppLog(FK_wfID,al_fName,al_wfName,alContent,FK_uid,AddTime) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblFormName.Text + "','" + lblName.Text + "','审批工作','" + this.Session["userid"] + "',GETDATE())");

                SqlHelper.ExecuteSql("UPDATE hk_Work SET wName='" + hkdb.GetStr(whname.Text) + "',wStatus='正在办理', wContent='" + hkdb.GetStrTeIn(ContractContent.Text) + "',EndUserIDs=EndUserIDs+'" + this.Session["userid"].ToString() + ",',EndUserNames=EndUserNames+'" + this.Session["username"].ToString() + ",',LastTime=GETDATE() WHERE wID='" + int.Parse(Request.QueryString["id"]) + "'");

                //?
                SqlHelper.ExecuteSql("INSERT INTO hk_WorkAppLog(FK_wfID,al_fName,al_wfName,alContent,FK_uid,AddTime) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblFormName.Text + "','" + lblName.Text + "','审批工作','" + this.Session["userid"] + "',GETDATE())");
            }
            catch
            {
                mydb.Alert("保存失败,请检查是否有必填项未填写!");
                return;
            }

            //审批意见ID
            int iAcid = 0;
            //上传
            string strBaseLocation = Server.MapPath("../../Attach/flow/work/");
            string TruePath        = string.Empty;
            string Temp1           = string.Empty;

            if (uploadFile.PostedFile.ContentLength != 0)
            {
                string fileName = System.IO.Path.GetFileName(uploadFile.PostedFile.FileName);
                string extName  = System.IO.Path.GetExtension(fileName);

                Random g   = new Random();
                string rad = g.Next(10000).ToString();
                Temp1 = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + rad;
                uploadFile.PostedFile.SaveAs(strBaseLocation + Temp1 + extName);
                TruePath = Temp1 + extName;

                iAcid = Convert.ToInt32(SqlHelper.ExecuteScalar("INSERT INTO hk_WorkAppComm(ac_wfID,ac_fName,ac_wfName,acContent,acAttName,acAttNewName,FK_uid,AddTime,ac_status) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblstrfnName.Text + "','" + lblName.Text + "','" + hkdb.GetStr(txt_appcomm.Text) + "','" + fileName + "','" + TruePath + "','" + this.Session["userid"] + "',GETDATE(),'临时')" + "SELECT CAST(scope_identity() AS int)"));

                BindDplist();
            }
            else
            {
                if (txt_appcomm.Text == "")
                {
                }
                else
                {
                    iAcid = Convert.ToInt32(SqlHelper.ExecuteScalar("INSERT INTO hk_WorkAppComm(ac_wfID,ac_fName,ac_wfName,acContent,acAttName,acAttNewName,FK_uid,AddTime,ac_status) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblstrfnName.Text + "','" + lblName.Text + "','" + hkdb.GetStr(txt_appcomm.Text) + "','','','" + this.Session["userid"] + "',GETDATE(),'临时')" + "SELECT CAST(scope_identity() AS int)"));
                }
            }

            //保存
            SqlDataReader datar3 = SqlHelper.ExecuteReader("SELECT * FROM hk_Work WHERE wID='" + hkdb.GetStr(Request.QueryString["id"]) + "'");

            if (datar3.Read())
            {
                SqlDataReader dr_wh = SqlHelper.ExecuteReader("SELECT whID FROM hk_WorkHandled WHERE whNo='" + datar3["wNo"] + "'");
                if (dr_wh.Read())
                {
                    dr_wh.Close();
                    SqlHelper.ExecuteSql("UPDATE hk_WorkHandled SET whContent='" + hkdb.GetStrTeIn(ContractContent.Text) + "' WHERE whNo='" + datar3["wNo"] + "'");
                }
                else
                {
                    dr_wh.Close();
                    SqlHelper.ExecuteSql("INSERT INTO hk_WorkHandled(FK_fid,FK_fno,FK_wfid,FK_wfno,FK_fnno,FK_fnnum,whNo,whSerialNo,whName,whContent,whPromoterID,whEndUserIDs,whEndUserNames,FK_uid,AddTime) values ('" + datar3["FK_fid"] + "','" + datar3["FK_fno"] + "','" + datar3["FK_wfid"] + "','" + datar3["FK_wfno"] + "','" + datar3["NextNodeNo"] + "','" + datar3["NextNodeNum"] + "','" + datar3["wNo"] + "','" + datar3["wSerialNo"] + "','" + datar3["wName"] + "','" + hkdb.GetStrTeIn(ContractContent.Text) + "','" + datar3["PromoterID"] + "','" + datar3["EndUserIDs"] + "','" + datar3["EndUserNames"] + "','" + this.Session["userid"] + "',GETDATE())");
                }
            }
            datar3.Close();

            Response.Redirect("HandleWork_Audi_Pass.aspx?UpNodeNum=" + lblnnnk.Text + "&FlowNumber=" + Request.QueryString["FlowNumber"] + "&FormId=" + Request.QueryString["FormId"] + "&UpNodeId=" + Request.QueryString["UpNodeId"] + "&Number=" + Number.Text + "&acid=" + iAcid + "");
        }
Exemplo n.º 22
0
        //保存
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_appcomm.Text))
            {
                lblMsg.Text = "请输入审批意见!";
                return;
            }

            try
            {
                string TjszStrSz, TjszStrCg;
                string TjszStr;
                string str1 = null;
                str1 = "" + strNextNodeNum + "0";
                ArrayList myarr = new ArrayList();
                string[]  mystr = str1.Split(',');
                for (int s = 0; s < mystr.Length; s++)
                {
                    TjszStrCg = null; TjszStrSz = null;
                    TjszStr   = null;
                    TjszStr   = "1 == 1";

                    //常规型条件
                    SqlDataReader datar1 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[常规型]'");
                    while (datar1.Read())
                    {
                        if (datar1["fbCondi"].ToString() == "包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + ">= 0 ";
                        }
                        else if (datar1["fbCondi"].ToString() == "不包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + "< 0 ";
                        }
                    }
                    datar1.Close();

                    //数字型条件
                    SqlDataReader datar2 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[数字型]'");
                    while (datar2.Read())
                    {
                        TjszStrSz += "&&" + int.Parse(Request.Form["" + datar2["fbNo"] + ""]) + " " + datar2["fbCondi"] + " " + datar2["fbValue"] + "  ";
                    }
                    datar2.Close();

                    TjszStr += TjszStrCg + TjszStrSz;
                    MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
                    sc.Language = "javascript";
                    if ((bool)sc.Eval(TjszStr) == false)
                    {
                        strnnNumkey  = strnnNumkey.Replace("" + mystr[s] + ",", "");
                        lblnnnk.Text = lblnnnk.Text.Replace("" + mystr[s] + ",", "");
                    }
                }

                SqlHelper.ExecuteSql("INSERT INTO hk_WorkAppLog(FK_wfID,al_fName,al_wfName,alContent,FK_uid,AddTime) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblFormName.Text + "','" + lblName.Text + "','审批工作','" + this.Session["userid"] + "',GETDATE())");

                if (lblstrAudiMode.Text == "仅一人通过审批即可向下流转")
                {
                    SqlHelper.ExecuteSql("UPDATE hk_Work SET wStatus='正在办理', wContent='" + hkdb.GetStrTeIn(lblhtm.Text) + "',EndUserIDs=EndUserIDs+'" + this.Session["userid"].ToString() + ",',EndUserNames=EndUserNames+'" + this.Session["username"].ToString() + ",',LastTime=GETDATE() WHERE wID='" + int.Parse(Request.QueryString["id"]) + "'");
                }
                else
                {
                    SqlHelper.ExecuteSql("UPDATE hk_Work SET wStatus='正在办理', wContent='" + hkdb.GetStrTeIn(lblhtm.Text) + "',EndUserIDs=EndUserIDs+'" + this.Session["userid"].ToString() + ",',EndUserNames=EndUserNames+'" + this.Session["username"].ToString() + ",',wUserIDs='" + lblstrhyUserIDs.Text + "',wUserNames='" + lblstrhyUserNames.Text + "',LastTime=GETDATE() WHERE wID='" + int.Parse(Request.QueryString["id"]) + "'");
                }
            }
            catch
            {
                mydb.Alert("保存失败,请检查是否有必填项未填写!");
                return;
            }

            if (txt_appcomm.Text == "")
            {
            }
            else
            {
                SqlHelper.ExecuteSql("INSERT INTO hk_WorkAppComm(ac_wfID,ac_fName,ac_wfName,acContent,acAttName,acAttNewName,FK_uid,AddTime) values ('" + hkdb.GetStr(Request.QueryString["id"]) + "','" + lblstrfnName.Text + "','" + lblName.Text + "','" + hkdb.GetStr(txt_appcomm.Text) + "','','','" + this.Session["userid"] + "',GETDATE())");
            }

            //保存
            SqlDataReader datar3 = SqlHelper.ExecuteReader("SELECT * FROM hk_Work WHERE wID='" + hkdb.GetStr(Request.QueryString["id"]) + "'");

            if (datar3.Read())
            {
                SqlDataReader dr_wh = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkHandled WHERE whNo='" + datar3["wNo"] + "'");
                if (dr_wh.Read())
                {
                    dr_wh.Close();
                    SqlHelper.ExecuteSql("UPDATE hk_WorkHandled SET whContent='" + hkdb.GetStrTeIn(lblhtm.Text) + "' WHERE whNo='" + datar3["wNo"] + "'");
                }
                else
                {
                    dr_wh.Close();
                    SqlHelper.ExecuteSql("INSERT INTO hk_WorkHandled(FK_fid,FK_fno,FK_wfid,FK_wfno,FK_fnno,FK_fnnum,whNo,whSerialNo,whName,whContent,whPromoterID,whEndUserIDs,whEndUserNames,FK_uid,AddTime) values ('" + datar3["FK_fid"] + "','" + datar3["FK_fno"] + "','" + datar3["FK_wfid"] + "','" + datar3["FK_wfno"] + "','" + datar3["NextNodeNo"] + "','" + datar3["NextNodeNum"] + "','" + datar3["wNo"] + "','" + datar3["wSerialNo"] + "','" + datar3["wName"] + "','" + hkdb.GetStrTeIn(lblhtm.Text) + "','" + datar3["PromoterID"] + "','" + datar3["EndUserIDs"] + "','" + datar3["EndUserNames"] + "','" + this.Session["userid"] + "',GETDATE())");
                }
            }
            datar3.Close();

            Response.Redirect("HandleWork.aspx");
        }
Exemplo n.º 23
0
        public MainWindow()
        {
            InitializeComponent();

            Regex           p  = new Regex("aa(bb)");
            MatchCollection mc = p.Matches("hhaabbhh", 0);

            Console.WriteLine(mc.Count);
            Match m = p.Match("hhaabbhh");

            if (m.Success)
            {
                Console.WriteLine(m.Groups[1].Value + "          " + new Random().NextDouble());
            }

            Dictionary <String, Object> dic = new Dictionary <String, Object>();

            dic.Add("aa", "bb");
            Dictionary <String, Object> .KeyCollection.Enumerator enu = dic.Keys.GetEnumerator();
            //if (enu.MoveNext())
            //{
            //    Console.WriteLine(enu.Current);

            //};
            Console.WriteLine(enu.Current);
            String str = "{\"retcode\":10,\"result\":{\"gmasklist\":[{\"gid\":1000,\"mask\":0},{\"gid\":1638195794,\"mask\":0},{\"gid\":321105219,\"mask\":0}], \"gnamelist\":[{\"flag\":16777217,\"name\":\"iQQ\",\"gid\":1638195794,\"code\":2357062609},{\"flag\":1048577,\"name\":\"iQQ核心开发区\",\"gid\":321105219,\"code\":640215156}],\"gmarklist\":[]}}";

            JSONTokener token = new JSONTokener(new StringReader(str));
            JSONObject  json  = new JSONObject(token);

            Console.WriteLine(json.ToString());

            //Console.WriteLine((Type.FONT==(Type)Enum.Parse(typeof(Type), "1", true))+"");
            //Console.WriteLine((Enum.Parse(typeof(Type), "text", true)) + "");


            string jsStr =
                "( {'timeString':'Time is: ' + new Date(),'dateValue':new Date()} )";

            FileInfo file = new FileInfo("C:\\Users\\leegean\\documents\\visual studio 2013\\Projects\\QQWpfApplication1\\WpfApplication1\\qq.js");

            if (file.Exists)
            {
                StreamReader reader = file.OpenText();
                jsStr = reader.ReadToEnd();
                reader.Close();
            }
            //Microsoft.JScript.JSObject obj =
            //    (Microsoft.JScript.JSObject)JSEvaluator.EvalToObject(jsStr);
            //        MessageBox.Show(obj["timeString"].ToString());
            //MessageBox.Show(obj["dateValue"].ToString());
            //Microsoft.JScript.DateObject tmpV =
            //    (Microsoft.JScript.DateObject)obj["dateValue"];
            //DateTime dt =
            //    (DateTime)Microsoft.JScript.Convert.Coerce(tmpV, typeof(DateTime));
            //MessageBox.Show(dt.ToString());

            MSScriptControl.ScriptControlClass scc = new MSScriptControl.ScriptControlClass();
            scc.Language = "javascript";
            scc.Eval(jsStr);
            Console.WriteLine(scc.Eval("getPassword('lj19861001','1002053815','qwer');").ToString());
        }
Exemplo n.º 24
0
        //下一步按钮
        protected void NetxBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string TjszStrSz, TjszStrCg;
                string TjszStr;
                string str1 = null;
                str1 = "" + NextNodeNum + "0";
                ArrayList myarr = new ArrayList();
                string[]  mystr = str1.Split(',');
                for (int s = 0; s < mystr.Length; s++)
                {
                    TjszStrCg = null; TjszStrSz = null;
                    TjszStr   = null;
                    TjszStr   = "1 == 1";

                    //[常规型]条件
                    SqlDataReader datar1 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[常规型]'");
                    while (datar1.Read())
                    {
                        if (datar1["fbCondi"].ToString() == "包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + ">= 0 ";
                        }
                        else if (datar1["fbCondi"].ToString() == "不包含")
                        {
                            TjszStrCg += "&&" + Request.Form["" + datar1["fbNo"] + ""].IndexOf(datar1["fbValue"].ToString()) + "< 0 ";
                        }
                    }
                    datar1.Close();

                    //[数字型]条件
                    SqlDataReader datar2 = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowBranch WHERE fbTofnid=(SELECT fnID FROM hk_WorkFlowNode WHERE fnNum='" + mystr[s] + "' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "') AND FK_fnid='" + strfnid + "' AND fbType='[数字型]'");
                    while (datar2.Read())
                    {
                        TjszStrSz += "&&" + int.Parse(Request.Form["" + datar2["fbNo"] + ""]) + " " + datar2["fbCondi"] + " " + datar2["fbValue"] + "  ";
                    }
                    datar2.Close();

                    TjszStr += TjszStrCg + TjszStrSz;

                    MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControlClass();
                    sc.Language = "javascript";
                    if ((bool)sc.Eval(TjszStr) == false)
                    {
                        NextNodeNumKey       = NextNodeNumKey.Replace("" + mystr[s] + ",", "");
                        lbloNextNodeNum.Text = lbloNextNodeNum.Text.Replace("" + mystr[s] + ",", "");
                    }
                }

                SqlDataReader dr = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlowNode where fnPosition='开始' AND FK_wfno='" + hkdb.GetStr(Request.QueryString["FlowNumber"]) + "'");
                if (dr.Read())
                {
                    string JkUsername = null, JkRealname = null;

                    SqlDataReader dr_wf = SqlHelper.ExecuteReader("SELECT * FROM hk_WorkFlow WHERE wfID='" + dr["FK_wfid"] + "'");
                    if (dr_wf.Read())
                    {
                        JkUsername = dr_wf["wfUserIDs"].ToString();
                        JkRealname = dr_wf["wfUserNames"].ToString();
                    }
                    dr_wf.Close();

                    //流水号
                    SqlDataReader datar3 = SqlHelper.ExecuteReader("SELECT TOP 1 wID FROM hk_Work ORDER BY wID DESC");
                    if (datar3.Read())
                    {
                        serid = int.Parse(datar3["wID"].ToString()) + 1;
                    }
                    else
                    {
                        serid = 1;
                    }
                    datar3.Close();



                    if (!string.IsNullOrEmpty(Request.QueryString["wid"]))
                    {
                        //如果重新发起,则复制原工作记录的审批意见
                        int iWid = Convert.ToInt32(SqlHelper.ExecuteScalar("INSERT INTO hk_Work(wFileNo,MoniUserIDs,MoniUserNames,FK_fid,FK_fno,FK_wfid,FK_wfno,FK_fnno,FK_fnnum,wNo,wSerialNo,wName,wStatus,wContent,PromoterID,EndUserIDs,EndUserNames,MyUserIDs,MyUserNames,AttentUserIDs,AttentUserNames,FK_uid,FK_did,wQxStr,FK_rid,AddTime,LastTime,ClientUserIDs,ClientUserNames,wTitle) values ('" + nNameid + "','" + JkUsername + "','" + JkRealname + "','" + dr["FK_fid"] + "','" + dr["FK_fno"] + "','" + dr["FK_wfid"] + "','" + dr["FK_wfno"] + "','" + dr["fnNo"] + "','" + dr["fnNum"] + "','" + hkdb.GetStr(Number.Text) + "','" + serid + "','" + hkdb.GetStr(fileid.Text) + "','等待送审','" + hkdb.GetStrTeIn(ContractContent.Text) + "','" + this.Session["userid"] + "','','','','','','','" + this.Session["userid"] + "','" + this.Session["deptid"] + "','" + this.Session["deptqx"] + "','" + this.Session["roleid"] + "',GETDATE(),GETDATE(),'','','" + hkdb.GetStr(wTitle.Text) + "')" + "SELECT CAST(scope_identity() AS int)"));

                        SqlHelper.ExecuteSql("INSERT INTO hk_WorkAppComm(ac_wfID,ac_fName,ac_wfName,acContent,acAttName,acAttNewName,FK_uid,AddTime) SELECT " + iWid + ",ac_fName,ac_wfName,acContent,acAttName,acAttNewName,FK_uid,AddTime FROM hk_WorkAppComm WHERE ac_wfid='" + hkdb.GetStr(Request.QueryString["wid"].ToString()) + "'");
                    }
                    else
                    {
                        //如果是新发起
                        SqlHelper.ExecuteSql("INSERT INTO hk_Work(wFileNo,MoniUserIDs,MoniUserNames,FK_fid,FK_fno,FK_wfid,FK_wfno,FK_fnno,FK_fnnum,wNo,wSerialNo,wName,wStatus,wContent,PromoterID,EndUserIDs,EndUserNames,MyUserIDs,MyUserNames,AttentUserIDs,AttentUserNames,FK_uid,FK_did,wQxStr,FK_rid,AddTime,LastTime,ClientUserIDs,ClientUserNames,wTitle) values ('" + nNameid + "','" + JkUsername + "','" + JkRealname + "','" + dr["FK_fid"] + "','" + dr["FK_fno"] + "','" + dr["FK_wfid"] + "','" + dr["FK_wfno"] + "','" + dr["fnNo"] + "','" + dr["fnNum"] + "','" + hkdb.GetStr(Number.Text) + "','" + serid + "','" + hkdb.GetStr(fileid.Text) + "','等待送审','" + hkdb.GetStrTeIn(ContractContent.Text) + "','" + this.Session["userid"] + "','','','','','','','" + this.Session["userid"] + "','" + this.Session["deptid"] + "','" + this.Session["deptqx"] + "','" + this.Session["roleid"] + "',GETDATE(),GETDATE(),'','','" + hkdb.GetStr(wTitle.Text) + "')");
                    }
                }
                else
                {
                    mydb.Alert("保存失败,请检查是否存在开始流程!");
                    return;
                }
                dr.Close();

                Response.Redirect("AddWork_Add_Detail.aspx?UpNodeNum=" + lbloNextNodeNum.Text + "&FlowNumber=" + Request.QueryString["FlowNumber"] + "&FormId=" + Request.QueryString["FormId"] + "&Number=" + Number.Text + "");
            }
            catch
            {
                mydb.Alert("保存失败,请检查是否有【必填项】未填写或【可写字段】设置错误!");
                return;
            }
        }