コード例 #1
0
        private void AddMethod(string serviceName, string methodSignature)
        {
            IMethodData method = new MethodParser(methodSignature);

            if (!method.IsValid)
            {
                _logger.Error("Method is not valid: " + methodSignature);
                return;
            }
            var serviceInfo = new CloudServiceInfo(serviceName);

            _logger.Info("Adding method " + method.MethodName + " to " + serviceName);
            _logger.Info("... interface");
            SafeLaunch(CodeHelper.AddMethodToClass, GetInterfaceFileName(serviceInfo), CodeHelper.GetInterfaceSignatureForMethod(method));
            _logger.Info("... service");
            SafeLaunch(CodeHelper.AddMethodToClass, GetServiceFileName(serviceInfo), CodeHelper.GetEmptyMethod(method));
            _logger.Info("... service proxy");
            SafeLaunch(CodeHelper.AddMethodToClass, GetServiceProxyFileName(serviceInfo), CodeHelper.GetProxyMethod(method, serviceInfo));
            _logger.Info("... process flow");
            SafeLaunch(r => r.AddProcessFlow(serviceInfo, method.MethodName));
            _logger.Info("completed.");
        }
コード例 #2
0
ファイル: ClassRoomController.cs プロジェクト: dovanduy/LiXin
        /// <summary>
        /// 获取所有的教室
        /// </summary>
        /// <param name="roomName">关键字</param>
        /// <param name="pageSize">没有显示条数</param>
        /// <param name="pageIndex">页数</param>
        /// <param name="jsRenderSortField">排序方式</param>
        /// <returns></returns>
        public JsonResult GetAllClassRoom(string roomName = "", int pageIndex = 1, int pageSize = 20, string jsRenderSortField = "LastUpdateTime desc")
        {
            int totalCount;
            var roomList = RoomBl.GetRoomListPaging(out totalCount, string.Format(" RoomName like '%{0}%' and IsDelete=0 ", CodeHelper.ReplaceSql(roomName)), (pageIndex - 1) * pageSize + 1, pageSize, string.Format(" order by {0}", jsRenderSortField));

            roomList.ForEach(p =>
            {
                p.RoomName = p.RoomName.HtmlXssEncode();
            });
            return(Json(new { result = 1, dataList = roomList, recordCount = totalCount }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: fangliu520/Beeant
 public ActionResult LoginDialog()
 {
     CodeHelper.InitilzeCodeErrorCount(CodeErrorName);
     return(View());
 }
コード例 #4
0
        private void Execute(string code)
        {
            StringBuilder sb = new StringBuilder();

            //-----------------
            // Create the class as usual
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Windows.Forms;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using TopDown_QA_FrameWork;");
            sb.AppendLine("using System.Runtime.InteropServices;");
            sb.AppendLine("using OpenQA.Selenium;");
            sb.AppendLine("using OpenQA.Selenium.Support.PageObjects;");
            sb.AppendLine("using OpenQA.Selenium.Support.UI;");
            sb.AppendLine("using System.ComponentModel;");

            sb.AppendLine();
            sb.AppendLine("namespace TestFrameWork");
            sb.AppendLine("{");

            sb.AppendLine("      public class ActionToRun");
            sb.AppendLine("      {");

            // My pre-defined class named FilterCountries that receive the sourceListBox
            sb.AppendLine("            public void RunAction()");
            sb.AppendLine("            {");
            sb.AppendLine(code);
            sb.AppendLine("            }");
            sb.AppendLine("      }");
            sb.AppendLine("}");

            //-----------------
            // The finished code
            String classCode = sb.ToString();

            //-----------------
            // Dont need any extra assemblies
            Object[] requiredAssemblies = new Object[] { "TopDown_QA_FrameWork.dll" };

            dynamic classRef;

            try
            {
                //txtErrors.Clear();

                //------------
                // Pass the class code, the namespace of the class and the list of extra assemblies needed
                classRef = CodeHelper.HelperFunction(classCode, "TestFrameWork.ActionToRun", requiredAssemblies);

                //-------------------
                // If the compilation process returned an error, then show to the user all errors
                if (classRef is CompilerErrorCollection)
                {
                    StringBuilder sberror = new StringBuilder();

                    foreach (CompilerError error in (CompilerErrorCollection)classRef)
                    {
                        sberror.AppendLine(string.Format("{0}:{1} {2} {3}", error.Line, error.Column, error.ErrorNumber, error.ErrorText));
                    }

                    //txtErrors.Text = sberror.ToString();
                    MessageBox.Show(sberror.ToString());
                    return;
                }
            }
            catch (Exception ex)
            {
                // If something very bad happened then throw it
                MessageBox.Show(ex.Message);
                throw;
            }

            //-------------
            // Finally call the class to filter the countries with the specific routine provided
            classRef.RunAction();
            //List<string> targetValues = classRef.FilterCountries(lstSource);
            //List<string> targetValues = new List<String>();
            ////-------------
            //// Move the result to the target listbox
            //lstTarget.Items.Clear();
            //lstTarget.Items.AddRange(targetValues.ToArray());
        }
コード例 #5
0
 public ActionResult NumImage()
 {
     byte[] byData = CodeHelper.CreateValidateGraphic(CodeHelper.RandomNum());
     return(File(byData, @"image/jpg"));
 }
コード例 #6
0
ファイル: HomeController.cs プロジェクト: fangliu520/Beeant
 /// <summary>
 /// 验证码
 /// </summary>
 /// <returns></returns>
 public virtual void LoginCode()
 {
     CodeHelper.CreateCode(CodeName);
 }
コード例 #7
0
        public void Get_Parameters()
        {
            List <ParameterItem> parameters;
            CsDocument           document = BuildCodeDocument(Source.Parameters);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "delegate Delegate1"));
            Assert.AreEqual(2, parameters.Count);
            AssertParameter("x", 7, parameters[0]);
            AssertParameter("y", 7, parameters[1]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "constructor Class1"));
            Assert.AreEqual(10, parameters.Count);
            AssertParameter("list", 12, parameters[0]);
            AssertParameter("comparer", 13, parameters[1]);
            AssertParameter("a", 16, parameters[2]);
            AssertParameter("b", 17, parameters[3]);
            AssertParameter("a", 21, parameters[4]);
            AssertParameter("b", 22, parameters[5]);
            AssertParameter("a", 25, parameters[6]);
            AssertParameter("b", 26, parameters[7]);
            AssertParameter("a", 30, parameters[8]);
            AssertParameter("b", 31, parameters[9]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "property Property1"));
            Assert.AreEqual(4, parameters.Count);
            AssertParameter("a", 38, parameters[0]);
            AssertParameter("b", 38, parameters[1]);
            AssertParameter("a", 43, parameters[2]);
            AssertParameter("b", 43, parameters[3]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "indexer this"));
            Assert.AreEqual(5, parameters.Count);
            AssertParameter("index", 47, parameters[0]);
            AssertParameter("a", 51, parameters[1]);
            AssertParameter("b", 51, parameters[2]);
            AssertParameter("a", 56, parameters[3]);
            AssertParameter("b", 56, parameters[4]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method Method1"));
            Assert.AreEqual(5, parameters.Count);
            AssertParameter("count", 61, parameters[0]);
            AssertParameter("size", 62, parameters[1]);
            AssertParameter("text", 63, parameters[2]);
            AssertParameter("a", 65, parameters[3]);
            AssertParameter("b", 65, parameters[4]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method Method2"));
            Assert.AreEqual(2, parameters.Count);
            AssertParameter("args", 69, parameters[0]);
            AssertParameter("obj", 72, parameters[1]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method Method3"));
            Assert.AreEqual(3, parameters.Count);
            AssertParameter("format", 78, parameters[0]);
            AssertParameter("args", 78, parameters[1]);
            AssertParameter("obj", 81, parameters[2]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method operator Class1"));
            Assert.AreEqual(3, parameters.Count);
            AssertParameter("x", 87, parameters[0]);
            AssertParameter("a", 89, parameters[1]);
            AssertParameter("b", 89, parameters[2]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method operator int"));
            Assert.AreEqual(3, parameters.Count);
            AssertParameter("x", 93, parameters[0]);
            AssertParameter("a", 95, parameters[1]);
            AssertParameter("b", 95, parameters[2]);

            parameters = CodeHelper.GetParameters(GetElementByName(document, "method operator +"));
            Assert.AreEqual(4, parameters.Count);
            AssertParameter("x", 99, parameters[0]);
            AssertParameter("y", 99, parameters[1]);
            AssertParameter("a", 101, parameters[2]);
            AssertParameter("b", 101, parameters[3]);
        }
コード例 #8
0
        public AcaoDynResult Executar(string Parametro)
        {
            AcaoDynResult Result = new AcaoDynResult();

            //MessageBox.Show("COdeScript:" + CodeScript);

            StringBuilder sb = new StringBuilder();

            //-----------------
            // Create the class as usual
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Windows.Forms;");
            sb.AppendLine("using System.Collections;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System.Text.RegularExpressions;");
            sb.AppendLine("using System.Collections.ObjectModel;");
            sb.AppendLine("using TopDown_QA_FrameWork;");
            sb.AppendLine("using System.Runtime.InteropServices;");
            sb.AppendLine("using OpenQA.Selenium;");
            sb.AppendLine("using OpenQA.Selenium.Support.PageObjects;");
            sb.AppendLine("using OpenQA.Selenium.Support.UI;");
            sb.AppendLine("using System.ComponentModel;");

            sb.AppendLine();
            sb.AppendLine("namespace TestFrameWork");
            sb.AppendLine("{");

            sb.AppendLine("      public class ActionToRun");
            sb.AppendLine("      {");

            // My pre-defined class named FilterCountries that receive the sourceListBox
            sb.AppendLine("            public void RunAction(string Parametro, out bool? Passou, out string Retorno)");
            sb.AppendLine("            {");
            sb.AppendLine("Browser.Driver.SwitchTo().DefaultContent();");
            // sb.AppendLine("Passou = null;");
            sb.AppendLine("Retorno = \"\";");
            sb.AppendLine(CodeScript);
            sb.AppendLine("            }");
            sb.AppendLine("            public void IR_PARA_CONTEUDO_PRINCIPAL() {Browser.Driver.SwitchTo().DefaultContent();}");
            sb.AppendLine("            public void MUDAR_PARA_FRAME(string frameContainer) {Browser.Wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(frameContainer));}");
            //sb.AppendLine("            public void IR_PARA_CONTEUDO_PRINCIPAL() {Browser.Driver.SwitchTo().DefaultContent();}");
            //sb.AppendLine("            public void IR_PARA_CONTEUDO_PRINCIPAL() {Browser.Driver.SwitchTo().DefaultContent();}");
            //sb.AppendLine("            public void IR_PARA_CONTEUDO_PRINCIPAL() {Browser.Driver.SwitchTo().DefaultContent();}");

            sb.AppendLine("      }");
            sb.AppendLine("}");

            //-----------------
            // The finished code
            String classCode = sb.ToString();

            //-----------------
            // Dont need any extra assemblies
            Object[] requiredAssemblies = new Object[] { "TopDown_QA_FrameWork.dll" };

            dynamic classRef;

            try
            {
                //txtErrors.Clear();

                //------------
                // Pass the class code, the namespace of the class and the list of extra assemblies needed
                classRef = CodeHelper.HelperFunction(classCode, "TestFrameWork.ActionToRun", requiredAssemblies);

                //-------------------
                // If the compilation process returned an error, then show to the user all errors
                if (classRef is CompilerErrorCollection)
                {
                    StringBuilder sberror = new StringBuilder();

                    foreach (CompilerError error in (CompilerErrorCollection)classRef)
                    {
                        sberror.AppendLine(string.Format("{0}:{1} {2} {3}", error.Line, error.Column, error.ErrorNumber, error.ErrorText));
                    }

                    //txtErrors.Text = sberror.ToString();
                    MessageBox.Show("ERRO DE CÓDIGO: " + sberror.ToString());
                    Result.erro = sberror.ToString();
                    return(Result);
                }
            }
            catch (Exception ex)
            {
                // If something very bad happened then throw it
                //MessageBox.Show(ex.Message);
                Result.erro = ex.Message;
                throw;
            }

            bool?  passou;
            string retornoInformacao;

            //-------------
            // Finally call the class to filter the countries with the specific routine provided
            classRef.RunAction(Parametro, out passou, out retornoInformacao);

            Result.passou            = passou;
            Result.retornoInformacao = retornoInformacao;

            //MessageBox.Show(Result.passou.ToString() + Result.retornoInformacao);
            //List<string> targetValues = classRef.FilterCountries(lstSource);
            //List<string> targetValues = new List<String>();
            ////-------------
            //// Move the result to the target listbox
            //lstTarget.Items.Clear();
            //lstTarget.Items.AddRange(targetValues.ToArray());

            return(Result);
        }
コード例 #9
0
 public virtual void AddCommentTokens(IList <DataToken> tokens, Comment comment)
 {
     tokens.Add(new DataToken()
     {
         Name = "Comment Message", SystemName = "CommentHtml", Value = comment.CommentHtml
     });
     tokens.Add(new DataToken()
     {
         Name = "Comment Id", SystemName = "CommentId", Value = comment.Id.ToString()
     });
     tokens.Add(new DataToken()
     {
         Name = "Comment User", SystemName = "CommentUser", Value = comment.Username
     });
     if (comment.CreatedOn.HasValue)
     {
         tokens.Add(new DataToken()
         {
             Name = "Comment Added On", SystemName = "CommentAddedOn", Value = CodeHelper.TimeAgo(comment.CreatedOn.Value)
         });
     }
     tokens.Add(new DataToken()
     {
         Name = "Comment Approved", SystemName = "CommentApproved", Value = comment.IsApproved ? "Yes" : "No"
     });
     tokens.Add(new DataToken()
     {
         Name = "Comment Block Reason", SystemName = "CommentBlockReason", Value = comment.BlockReason
     });
     tokens.Add(new DataToken()
     {
         Name = "Comment Blocked By User Id", SystemName = "CommentBlockedByUserId", Value = comment.BlockedBy.ToString()
     });
     tokens.Add(new DataToken()
     {
         Name = "Comment Blocked By User", SystemName = "CommentBlockedByUser", Value = comment.BlockedBy > 0 ? _userRepository.GetByID(comment.BlockedBy)?.UserName : "******"
     });
 }
コード例 #10
0
        protected override StringBuilder OnConvertToCode(CodeNode currentNode, CodeNode parentNode, CodeRenderService rendererService)
        {
            var    code = new StringBuilder();
            string name = FigmaSharp.Resources.Ids.Conversion.NameIdentifier;

            var frame = (FigmaFrame)currentNode.Node;

            currentNode.Node.TryGetNativeControlType(out FigmaControlType controlType);
            currentNode.Node.TryGetNativeControlVariant(out NativeControlVariant controlVariant);

            if (rendererService.NeedsRenderConstructor(currentNode, parentNode))
            {
                code.WriteConstructor(name, GetControlType(currentNode.Node), rendererService.NodeRendersVar(currentNode, parentNode));
            }

            if (controlType == FigmaControlType.Separator)
            {
                code.WriteEquality(name, nameof(NSBox.BoxType), NSBoxType.NSBoxSeparator);
            }

            if (controlType == FigmaControlType.BoxCustom)
            {
                code.WriteEquality(name, nameof(NSBox.BoxType), NSBoxType.NSBoxCustom);
                bool borderSet = false;

                FigmaVector rectangle = frame.children
                                        .OfType <FigmaVector>()
                                        .FirstOrDefault();

                foreach (var styleMap in rectangle?.styles)
                {
                    if ((rendererService.figmaProvider as NodeProvider).TryGetStyle(styleMap.Value, out FigmaStyle style))
                    {
                        if (styleMap.Key == "fill")
                        {
                            code.WriteEquality(name, nameof(NSBox.FillColor), ColorService.GetNSColorString(style.name));
                        }

                        if (styleMap.Key == "stroke")
                        {
                            code.WriteEquality(name, nameof(NSBox.BorderColor), ColorService.GetNSColorString(style.name));
                            code.WriteEquality(name, nameof(NSBox.BorderWidth), rectangle.strokeWeight.ToString());
                            borderSet = true;
                        }
                    }
                }

                if (!borderSet)
                {
                    code.WriteEquality(name, nameof(NSBox.BorderWidth), "0");
                }
            }

            FigmaText text = frame.children
                             .OfType <FigmaText>()
                             .FirstOrDefault(s => (s.name == ComponentString.TITLE && s.visible));

            if (text != null)
            {
                string stringTitle = CodeHelper.GetTranslatableString(text.characters,
                                                                      rendererService.CurrentRendererOptions.TranslateLabels);

                code.WriteEquality(name, nameof(NSBox.Title), stringTitle,
                                   inQuotes: !rendererService.CurrentRendererOptions.TranslateLabels);
            }
            else
            {
                code.WriteEquality(name, nameof(NSBox.Title), "", inQuotes: true);
            }

            return(code);
        }
コード例 #11
0
 public virtual void AddEventTokens(IList <DataToken> tokens, Event events)
 {
     tokens.Add(new DataToken()
     {
         Name = "Event Start Date", SystemName = "EventStartDate", Value = events.StartDate.HasValue ? CodeHelper.TimeAgo(events.StartDate.Value) : ""
     });
     tokens.Add(new DataToken()
     {
         Name = "Event End Date", SystemName = "EventEndDate", Value = events.EndDate.HasValue ? CodeHelper.TimeAgo(events.EndDate.Value) : ""
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Id", SystemName = "EventId", Value = events.Id.ToString()
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Location", SystemName = "EventVenue", Value = events.Venue
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Title", SystemName = "EventTitle", Value = events.Title
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Active", SystemName = "EventActive", Value = events.IsActive ? "Yes" : "No"
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Approved", SystemName = "EventApproved", Value = events.IsApproved ? "Yes" : "No"
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Description", SystemName = "EventDescription", Value = events.Description
     });
     tokens.Add(new DataToken()
     {
         Name = "Event Url", SystemName = "EventUrl", Value = events.GetSystemName()
     });
 }
コード例 #12
0
        protected override StringBuilder OnConvertToCode(CodeNode currentNode, CodeNode parentNode, ICodeRenderService rendererService)
        {
            var    code = new StringBuilder();
            string name = FigmaSharp.Resources.Ids.Conversion.NameIdentifier;

            var frame = (FigmaFrame)currentNode.Node;

            currentNode.Node.TryGetNativeControlType(out FigmaControlType controlType);
            currentNode.Node.TryGetNativeControlVariant(out NativeControlVariant controlVariant);

            if (rendererService.NeedsRenderConstructor(currentNode, parentNode))
            {
                code.WriteConstructor(name, GetControlType(currentNode.Node).FullName, rendererService.NodeRendersVar(currentNode, parentNode));
            }

            FigmaText text = frame.children
                             .OfType <FigmaText>()
                             .FirstOrDefault(s => s.name == ComponentString.SYMBOL);

            code.WritePropertyEquality(name, nameof(NSButton.BezelStyle), NSBezelStyle.RegularSquare);
            code.WritePropertyEquality(name, nameof(NSButton.Bordered), false);
            code.WritePropertyEquality(name, nameof(NSButton.Title), text.characters, inQuotes: true);

            code.WritePropertyEquality(name, nameof(NSButton.Font),
                                       $"{ typeof(NSFont) }.{ nameof(NSFont.SystemFontOfSize) }({ text.style.fontSize }, { CodeHelper.GetNSFontWeightString(text) })");

            foreach (var styleMap in text.styles)
            {
                if (rendererService.NodeProvider.TryGetStyle(styleMap.Value, out FigmaStyle style))
                {
                    if (styleMap.Key == "fill")
                    {
                        code.WritePropertyEquality(name, nameof(NSButton.ContentTintColor), ColorService.GetNSColorString(style.name));
                    }
                }
            }

            return(code);
        }
コード例 #13
0
        public IActionResult History_Data(int startMonth = -1000, string Code = "000001")
        {
            var startDay = DateTime.Now.AddDays(30 * startMonth);
            var data     = DBHelper._db.SHAs.Where(tb => tb.Code == CodeHelper.CodeToDBCode(Code)).Where(tb => tb.Date >= startDay).Select(tb => new
            {
                tb.Date,
                tb.Closing,
                tb.ReferDown,
                tb.ReferUp,
                tb.Highest,
                tb.Lowest,
                Turnover = (int)(tb.Turnover / 100000000)
            }).OrderBy(tb => tb.Date).ToList();

            string CHName = CodeHelper.CodeDic[Code];

            ChartData result = new ChartData();

            result.xAxis  = data.Select(tb => tb.Date.ToString("yyyy-MM-dd")).ToArray();
            result.legend = new string[] { CHName, "赶紧跑路", "为国护盘", "最高", "最低", "成交" };
            result.series.Add(new series
            {
                name = CHName,
                type = "line",
                data = data.Select(tb => (object)tb.Closing).ToArray()
            });

            result.series.Add(new series
            {
                name = "最高",
                type = "line",
                data = data.Select(tb => (object)tb.Highest).ToArray()
            });
            result.series.Add(new series
            {
                name = "最低",
                type = "line",
                data = data.Select(tb => (object)tb.Lowest).ToArray()
            });
            result.series.Add(new series
            {
                name = "成交",
                type = "line",
                data = data.Select(tb => (object)tb.Turnover).ToArray()
            });

            if (Code == "000001")
            {
                result.series.Add(new series
                {
                    name = "赶紧跑路",
                    type = "line",
                    data = data.Select(tb => (object)tb.ReferUp).ToArray()
                });
                result.series.Add(new series
                {
                    name = "为国护盘",
                    type = "line",
                    data = data.Select(tb => (object)tb.ReferDown).ToArray()
                });
            }
            if (data.Count > 0)
            {
                ViewBag.yStart = (int)(data.Min(tb => tb.Lowest) * 100 / data.Max(tb => tb.Highest));
            }

            return(View(result));
        }
コード例 #14
0
 /// <inheritdoc />
 public virtual string GetMethodChain(CodeHelper code)
 {
     return ".IsUnicode(" + code.Literal(false) + ")";
 }
コード例 #15
0
        public object PostSmartFlowCard([FromBody] IEnumerable <SmartFlowCard> flowCards)
        {
            if (flowCards == null || !flowCards.Any())
            {
                return(Result.GenError <Result>(Error.ParamError));
            }

            if (flowCards.Count(x => x.Number <= 0) > 1)
            {
                return(Result.GenError <Result>(Error.SmartFlowCardNumberError));
            }

            var wId         = flowCards.First().WorkshopId;
            var taskOrderId = flowCards.First().TaskOrderId;

            if (flowCards.GroupBy(x => x.ProcessCodeId).Count() > 1)
            {
                return(Result.GenError <Result>(Error.ParamError));
            }
            var processCodeId = flowCards.First().ProcessCodeId;

            var thisTotal = flowCards.Sum(x => x.Number);

            var taskOrder = SmartTaskOrderHelper.Instance.Get <SmartTaskOrder>(taskOrderId);

            if (taskOrder == null)
            {
                return(Result.GenError <Result>(Error.SmartTaskOrderNotExist));
            }

            if (taskOrder.Left <= 0)
            {
                return(Result.GenError <Result>(Error.SmartFlowCardNumberLimit));
            }

            var processes = SmartProductProcessHelper.GetSmartProductProcesses(taskOrderId, processCodeId);

            if (!processes.Any())
            {
                return(Result.GenError <Result>(Error.SmartProcessNotEmpty));
            }

            var batch = SmartFlowCardHelper.GetSmartFlowCardBatch(taskOrderId);

            batch++;

            var count          = flowCards.Count();
            var userId         = Request.GetIdentityInformation();
            var markedDateTime = DateTime.Now;
            var fcs            = CodeHelper.GenCodes(CodeType.流程卡, count, markedDateTime).ToArray();
            var i = 0;

            foreach (var flowCard in flowCards)
            {
                flowCard.CreateUserId   = userId;
                flowCard.MarkedDateTime = markedDateTime;
                flowCard.CreateTime     = markedDateTime;
                flowCard.FlowCard       = fcs[i];
                flowCard.Batch          = batch;
                flowCard.Remark         = flowCard.Remark ?? "";
                i++;
            }
            SmartFlowCardHelper.Instance.Add(flowCards);
            var addFlowCards = SmartFlowCardHelper.GetSmartFlowCardsByBatch(taskOrderId, batch);

            var smartFlowCardProcesses = new List <SmartFlowCardProcess>();

            i = 0;
            foreach (var smartFlowCard in addFlowCards)
            {
                var newSmartFlowCard = flowCards.ElementAt(i);
                smartFlowCard.ProcessorId = newSmartFlowCard.ProcessorId;
                var t = true;
                foreach (var process in processes)
                {
                    var flowCardProcess = new SmartFlowCardProcess
                    {
                        CreateUserId   = userId,
                        MarkedDateTime = markedDateTime,
                        WorkshopId     = wId,
                        FlowCardId     = smartFlowCard.Id,
                        ProcessId      = process.Id,
                    };

                    if (t)
                    {
                        flowCardProcess.ProcessorId = smartFlowCard.ProcessorId;
                        flowCardProcess.Before      = smartFlowCard.Number;
                        t = false;
                    }
                    smartFlowCardProcesses.Add(flowCardProcess);
                }
                i++;
            }

            SmartFlowCardProcessHelper.Instance.Add <SmartFlowCardProcess>(smartFlowCardProcesses);
            taskOrder.Doing         += thisTotal;
            taskOrder.Issue         += count;
            taskOrder.MarkedDateTime = markedDateTime;

            OldWorkFlowHelper.Instance.OnSmartFlowCardChanged(addFlowCards);
            OldWorkFlowHelper.Instance.OnSmartFlowCardProcessCreated(addFlowCards, smartFlowCardProcesses);
            return(new
            {
                errno = 0,
                errmsg = "成功",
                taskOrder.Target,
                taskOrder.Left,
                taskOrder.Doing,
                taskOrder.Issue,
                FlowCards = addFlowCards
            });
        }
コード例 #16
0
ファイル: ServiceFrm.cs プロジェクト: koksaver/CodeHelper
 private bool IsValueType(CodeHelper.Core.Parse.ParseResults.DataViews.DbType type)
 {
     return type == CodeHelper.Core.Parse.ParseResults.DataViews.DbType.Bool ||
         type == CodeHelper.Core.Parse.ParseResults.DataViews.DbType.Char ||
         type == CodeHelper.Core.Parse.ParseResults.DataViews.DbType.DateTime ||
         type == CodeHelper.Core.Parse.ParseResults.DataViews.DbType.Float ||
         type == CodeHelper.Core.Parse.ParseResults.DataViews.DbType.Int
         ;
 }
コード例 #17
0
ファイル: ButtonConverter.cs プロジェクト: kblok/FigmaSharp
        protected override StringBuilder OnConvertToCode(CodeNode currentNode, CodeNode parentNode, CodeRenderService rendererService)
        {
            var    code = new StringBuilder();
            string name = FigmaSharp.Resources.Ids.Conversion.NameIdentifier;

            var frame = (FigmaFrame)currentNode.Node;

            currentNode.Node.TryGetNativeControlType(out FigmaControlType controlType);
            currentNode.Node.TryGetNativeControlVariant(out NativeControlVariant controlVariant);

            if (rendererService.NeedsRenderConstructor(currentNode, parentNode))
            {
                code.WriteConstructor(name, GetControlType(currentNode.Node).FullName, rendererService.NodeRendersVar(currentNode, parentNode));
            }

            switch (controlType)
            {
            case FigmaControlType.Button:
                code.WritePropertyEquality(name, nameof(NSButton.BezelStyle), NSBezelStyle.Rounded);
                break;

            case FigmaControlType.ButtonRoundRect:
                code.WritePropertyEquality(name, nameof(NSButton.BezelStyle), NSBezelStyle.RoundRect);
                break;

            case FigmaControlType.ButtonHelp:
                code.WritePropertyEquality(name, nameof(NSButton.BezelStyle), NSBezelStyle.HelpButton);
                code.WritePropertyEquality(name, nameof(NSButton.Title), string.Empty, inQuotes: true);
                break;
            }

            code.WritePropertyEquality(name, nameof(NSButton.ControlSize), ViewHelper.GetNSControlSize(controlVariant));
            code.WritePropertyEquality(name, nameof(NSSegmentedControl.Font), CodeHelper.GetNSFontString(controlVariant));

            FigmaGroup group = frame.children
                               .OfType <FigmaGroup> ()
                               .FirstOrDefault(s => s.visible);

            if (group != null)
            {
                FigmaText text = group.children
                                 .OfType <FigmaText> ()
                                 .FirstOrDefault(s => s.name == ComponentString.TITLE);

                if (text != null && controlType != FigmaControlType.ButtonHelp)
                {
                    code.WriteTranslatedEquality(name, nameof(NSButton.Title), text, rendererService);
                }

                if (group.name == ComponentString.STATE_DISABLED)
                {
                    code.WritePropertyEquality(name, nameof(NSButton.Enabled), false);
                }

                if (group.name == ComponentString.STATE_DEFAULT)
                {
                    code.WritePropertyEquality(name, nameof(NSButton.KeyEquivalent), "\\r", true);
                }
            }

            return(code);
        }