Exemple #1
0
        /// <summary>
        /// 读取当前数据
        /// </summary>
        public void LoadData()
        {
            string text = File.ReadAllText(FullFileName);

            this.Fields = AssistHelper.GetFields(text);
            // 获取命名空间
            this.NameSpace = AssistHelper.GetValue(text, "namespace", "{").Trim();
            // 获取类名称继承接信息
            this.ClassEntity.Inherit = AssistHelper.GetClassInfo(text);
            // 扩展的主键类型
            this.ClassEntity.InheritType = AssistHelper.GetValue(this.ClassEntity.Inherit, "<", ">");
            // 获取方案名称
            var strs = this.Solution.Name.Split('.');

            if (strs.Length == 2)
            {
                this.CpmpanyName = strs[0];
                this.SubName     = strs[1];
            }
            if (strs.Length == 1)
            {
                this.CpmpanyName = strs[0];
                this.SubName     = strs[0];
            }
        }
Exemple #2
0
        public ExtraApplicationLayerManager(FileEntity _FileEntity)
        {
            FileEntity = _FileEntity;
            // 额外的应用服务层数据(如果勾选了生成额外的应用服务)
            var dirExtraApplication = AssistHelper.GetExtraLayerDir(FileEntity.ServDir, APP.Configuration.ExtraName);

            FileEntity.ExtraApplication.Name        = dirExtraApplication?.Name;
            FileEntity.ExtraApplication.BaseDirPath = dirExtraApplication?.FullName;

            string oldval = string.Format("src\\{0}", FileEntity.ProjectCore.Name);
            string newval = string.Format("serv\\{0}", FileEntity.ExtraApplication.Name);

            FileEntity.ExtraApplication.DomainPath = FileEntity.CurrentFile.DirectoryName.Replace(oldval, newval);

            // 获取方案名称
            var strs = FileEntity.ExtraApplication.Name.Split('.');

            if (strs.Length == 3)
            {
                this.FileEntity.ExtraApplication.CompanyName = strs[0];
                this.FileEntity.ExtraApplication.SubName     = strs[1];
                this.FileEntity.ExtraApplication.ClassName   = string.Format("{0}{1}", strs[1], strs[2]);
            }
            if (strs.Length == 2)
            {
                this.FileEntity.ExtraApplication.CompanyName = strs[0];
                this.FileEntity.ExtraApplication.SubName     = strs[0];
                this.FileEntity.ExtraApplication.ClassName   = string.Format("{0}", strs[1]);
            }
        }
Exemple #3
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var entity = AssistHelper.AssistInitialize(DTE2);

            //  如果为空退出
            if (entity is null)
            {
                MessageBox.Show("辅助程序仅支持ABP项目,且实体必须来自项目的领域层!", "注意", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            var wpf = new AssistToolsWpf(entity);

            wpf.ShowDialog();
        }
        public Result CommentGroupPageList(int page     = ParamConst.PageIndex, int size = ParamConst.PageSize
                                           , int?status = null, string startTime         = null, string endTime = null)
        {
            var whereList = new List <string>();

            if (!string.IsNullOrWhiteSpace(startTime))
            {
                whereList.Add($"AccusationT.a_CreateTime >= '{startTime}'");
            }

            if (!string.IsNullOrWhiteSpace(endTime))
            {
                whereList.Add($"AccusationT.a_CreateTime <= '{endTime}'");
            }

            var whereSql = string.Empty;

            if (whereList.Count > 0)
            {
                whereSql = $" AND {string.Join($"\nAND ", whereList)}";
            }

            var statusWhere = string.Empty;

            if (status.HasValue)
            {
                statusWhere = $"AND a_Status = {status.Value}";
            }

            var pageList =
                AssistHelper.PageList <AccusationGroupDto <CommentDto> >("manage_accusation_comment_get_page_list_group", page,
                                                                         size,
                                                                         new[]
            {
                new SqlParameter("@strW", whereSql),
                new SqlParameter("@order", "AccusationT.accusationCount DESC"),
                new SqlParameter("@statusW", statusWhere),
            });

            return(new Success(pageList));
        }
        public Result WorkPageList(int page           = ParamConst.PageIndex, int size = ParamConst.PageSize
                                   , string startTime = null, string endTime           = null, int?status = null, string searchKey = null)
        {
            var whereList = new List <string>
            {
                $"AccusationT.a_TargetType = {(int) AccusationTargetTypes.Comment}",
            };

            if (status.HasValue)
            {
                whereList.Add($"AccusationT.a_Status = {status}");
            }

            if (!string.IsNullOrWhiteSpace(searchKey))
            {
                whereList.Add($"AccusationT.a_Reason LIKE '%{searchKey}%'");
            }

            if (!string.IsNullOrWhiteSpace(startTime))
            {
                whereList.Add($"AccusationT.a_CreateTime >= '{startTime}'");
            }

            if (!string.IsNullOrWhiteSpace(endTime))
            {
                whereList.Add($"AccusationT.a_CreateTime <= '{endTime}'");
            }

            var whereSql = string.Join($"\nAND ", whereList);

            var pageList =
                AssistHelper.PagingList("manage_accusation_work_get_page_list", page, size,
                                        new[]
            {
                new SqlParameter("@strW", whereSql),
                new SqlParameter("@order", "AccusationT.a_Id DESC"),
            });

            return(new Success(pageList));
        }
        internal static bool transform_assist_calls(string groupname, string sourcetype, GenericTracker <List <Token> > symbolname2functiontoks, GenericTracker <Token[]> const2code, out string code, out List <string> typenames)
        {
            code = string.Empty;
            // get all assists in question
            var masterlist = AssistHelper.getavailableassists_names();
            var mastercopy = masterlist.ToArray();

            for (int i = 0; i < masterlist.Count; i++)
            {
                masterlist[i] = masterlist[i].Replace(sourcetype + ":", string.Empty);
            }
            // strip out their location

            int okcount = 0;
            int classes = 0;

            typenames = new List <string>();
            // process every primary source token
            for (int i = 0; i < primarytokencount; i++)
            {
                // get our building blocks
                var tok = tokstream[i];
                // see if we want it
                if (!tok.isSymbol)
                {
                    continue;
                }
                if (sourcetype.Contains(tok.data))
                {
                    continue;
                }
                // get previous token symbol
                var ptok = getprevioussymbol(tok);
                // verify we return an assist
                if (ptok.data != "AssistI")
                {
                    continue;
                }
                // update other states
                bool voidarguments = issymbolvoidargumentmethod(tok);
                var  masteridx     = masterlist.IndexOf(tok.data);
                bool userfacing    = (masteridx >= 0);
                bool hasname       = userfacing && (AssistHelper.getassist(mastercopy[masteridx], null).AssistName != "GleanCommon.Assist");
                // verify our current token is a void method that is user-facing
                if (voidarguments && userfacing && hasname)
                {
                    // get name
                    var fname = tok.data;
                    // get any helper code which might be called by our function
                    var helpercode = gethelpercode(fname, symbolname2functiontoks);
                    // get new class name (that will inherit from RD_AssistTemplate)
                    var classname = getclassname(fname);
                    // get the pretty name
                    var prettyname = GleanHelper.getsafevarname(AssistHelper.getassist(mastercopy[masteridx], null).AssistName);
                    // insert assist code RD class of the same name (eg GetOffsetTracker or taBollinger)
                    var classdefinition = RD_AssistTemplate.GetTemplateClass(classname, prettyname, "return " + fname + "();", helpercode, false, false);
                    code += classdefinition;
                    // count it
                    classes++;
                    okcount++;
                    typenames.Add(classname);
                }
            }



            return(true);
        }