public async Task InsertOrUpdateAsync(NotificationTemplateInfo templateInfo)
        {
            using (var context = _msSqlContextFactory.CreateDataContext())
            {
                var entity = await context.Templates.FirstOrDefaultAsync(x => x.Name == templateInfo.Name);

                if (entity == null)
                {
                    entity = new TemplateEntity
                    {
                        Name = templateInfo.Name,
                        ListOfLocalization = ConvertListLocalizationToString(templateInfo.AvailableLocalizations)
                    };

                    await context.AddAsync(entity);
                }
                else
                {
                    entity.ListOfLocalization = ConvertListLocalizationToString(templateInfo.AvailableLocalizations);

                    context.Update(entity);
                }

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 模版分类重命名
        /// </summary>
        private void menuRename_Click(object sender, EventArgs e)
        {
            string name = this.treeTemplate.SelectedNode.Text;
            Prompt p    = new Prompt("模板分类")
            {
                Height = 100, DefaultValue = name
            };
            string text = p.Show();

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            CodeBuilderService service = ServiceHelper.GetCodeBuilderService();
            TemplateEntity     entity  = service.GetTemplateById(GetSelectedID());

            entity.TemplateName = text;
            if (service.UpdateTemplate(entity))
            {
                //DirectoryInfo dir = new DirectoryInfo(TemplateManager.GetTemplateType(name));
                //dir.MoveTo(TemplateManager.GetTemplateType(text));
                this.treeTemplate.SelectedNode.Text = text;
            }
            else
            {
                MsgBox.Alert("模板分类重命名失败!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建应用层的代码
        /// </summary>
        /// <param name="overWrite">是否重写</param>
        /// <param name="overReadEntity">是否重新获取实体信息</param>
        public static void Create(bool overWrite, bool overReadEntity = false)
        {
            if (ProjectContainer.Application == null)
            {
                ProjectContainer.Application = SolutionCommon.Dte.AddClassLibrary(SolutionCommon.Application, true);
            }
            if (ProjectContainer.IApplication == null)
            {
                ProjectContainer.IApplication = SolutionCommon.Dte.AddClassLibrary(SolutionCommon.IApplication, true);
            }

            List <TemplateEntity> entitys = DomainEntityLogic.GetEntitys(overReadEntity);

            for (int i = 0; i < entitys.Count; i++)
            {
                // _work.ReportProgress((int)((i + 1) * 100 / entitys.Length), string.Format("添加实体类-{0}-的代码", fileEntity));
                TemplateEntity tmpEntity = entitys[i];

                CodeCreateManager codeManager = new CodeCreateManager(ConstructType.Application, tmpEntity);
                codeManager.IsOverWrite = overWrite;
                codeManager.BuildTaget  = ProjectContainer.Application;
                codeManager.CreateCode();

                codeManager             = new CodeCreateManager(ConstructType.IApplication, tmpEntity);
                codeManager.IsOverWrite = overWrite;
                codeManager.BuildTaget  = ProjectContainer.IApplication;
                codeManager.CreateCode();
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Grade")] TemplateEntity entity)
        {
            if (id != entity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(entity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    if (!EntityExists(entity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Grade"] = new SelectList(_context.TemplateClasses, "Grade", "Grade", entity.Grade);
            return(View(entity));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Grade")] TemplateEntity entity)
        {
            if (ModelState.IsValid)
            {
                var entityJson = new StringContent(
                    System.Text.Json.JsonSerializer.Serialize <TemplateEntity>(entity),
                    Encoding.UTF8, "application/json");

                var client = _clientFactory.CreateClient();

                var response = await client.PostAsync("<API Link and Path>/", entityJson);

                var success = true;

                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    success = false;
                }

                if (success)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                //_context.Add(entity);
                //await _context.SaveChangesAsync();
            }
            return(View(entity));
        }
Ejemplo n.º 6
0
        public virtual void Initialize(ChecklistSingleViewModel parentVM, IFieldDefinitionEntity fieldDef, IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            _process = (TemplateEntity)parentVM.QuestionsTemplate;
            _parentVM = parentVM;
            _fieldDefinition = fieldDef;
            ChangeChartTypeCommand = new DelegateCommand(ExecuteChange);

            PrepareFieldDefRelatedData();

            var weakListener = new WeakEventListener<SPCChartControlViewModel, ChecklistViewModelBase, EventArgs>(this, parentVM);
            parentVM.SelectesQuestionChanged += weakListener.OnEvent;
            weakListener.OnEventAction = OnSelectedQuestionChanged;
            weakListener.OnDetachAction = (listener, source) =>
            {
                source.SelectesQuestionChanged -= listener.OnEvent;
            };

            ShowLCLAnyChart = true; ShowUCLAnyChart = true; ShowMeanAnyChart = true;
            ShowLCLRangeChart = true; ShowUCLRangeChart = true; ShowMeanRangeChart = true;
            ShowUSL = false; ShowLSL = false;

            OnSelectedQuestionChanged(this, parentVM, EventArgs.Empty);            
        }
Ejemplo n.º 7
0
 public TemplateDTO(TemplateEntity entity)
 {
     Id          = entity.Id;
     Name        = entity.Name;
     Description = entity.ModelDescription;
     DateCreated = entity.DateCreated.ToJsonString();
 }
Ejemplo n.º 8
0
        public async Task <IActionResult> PutEntity(int id, TemplateEntity entity)
        {
            if (id != entity.Id)
            {
                return(BadRequest());
            }

            try
            {
                _context.Update(entity);
                _context.Entry(entity).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                if (!EntityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 9
0
 public int Insert(TemplateEntity template)
 {
     using (SqlConnection connection = new SqlConnection(_connectionString))
     {
         return(connection.ExecuteScalar <int>(@"INSERT INTO [dbo].[NTFTBLTXTTEMPLATENOTIFICA]
                                                             ([HDRDTHHOR]
                                                             ,[HDRCODUSU]
                                                             ,[HDRCODLCK]
                                                             ,[HDRDTHINS]
                                                             ,[HDRCODETC]
                                                             ,[HDRCODPRG]
                                                             ,[TXTCODTEMPLATE]
                                                             ,[TXTDESTEMPLATE]
                                                             ,[TXTSIT])
                                                         VALUES
                                                             (GETDATE()
                                                                 ,'teste'
                                                                 ,1
                                                                 ,GETDATE()
                                                                 ,'teste'
                                                                 ,'teste'
                                                                 ,@CodTemplate
                                                                 ,@DestTemplate
                                                                 ,'A')
                                                         SELECT SCOPE_IDENTITY()", template));
     }
 }
Ejemplo n.º 10
0
        //private static readonly SolidBrush ActiveForeGround = new SolidBrush(ColorTranslator.FromHtml("#FF0000"));
        //private static readonly SolidBrush InactiveForeGround = new SolidBrush(ColorTranslator.FromHtml("#00FF00"));
        #endregion

        #region Internal Method
        /// <summary>
        /// テンプレートのヘッダ一覧を取得する
        /// </summary>
        /// <returns></returns>
        internal List <TemplateListItem> Select()
        {
            var result = new List <TemplateListItem>();

            using (var database = new MyLogDatabase(Constants.DatabaseFile())) {
                database.Open();

                var entity = new TemplateEntity(database);
                using (var recset = entity.Select()) {
                    while (recset.Read())
                    {
                        result.Add(new TemplateListItem()
                        {
                            Id   = recset.GetLong(TemplateEntity.Cols.Id),
                            Name = recset.GetString(TemplateEntity.Cols.Name),
                            Sun  = recset.GetBool(TemplateEntity.Cols.Sun) ? ActiveForeGround : InactiveForeGround,
                            Mon  = recset.GetBool(TemplateEntity.Cols.Mon) ? ActiveForeGround : InactiveForeGround,
                            Tue  = recset.GetBool(TemplateEntity.Cols.Tue) ? ActiveForeGround : InactiveForeGround,
                            Wed  = recset.GetBool(TemplateEntity.Cols.Wed) ? ActiveForeGround : InactiveForeGround,
                            Thu  = recset.GetBool(TemplateEntity.Cols.Thu) ? ActiveForeGround : InactiveForeGround,
                            Fri  = recset.GetBool(TemplateEntity.Cols.Fri) ? ActiveForeGround : InactiveForeGround,
                            Sat  = recset.GetBool(TemplateEntity.Cols.Sat) ? ActiveForeGround : InactiveForeGround
                        });
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 11
0
        // [ValidateAntiForgeryToken]
        public ActionResult SubmitFreeForm(TemplateEntity templateEntity, string keyValue)
        {
            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    var temp = templateApp.GetForm(keyValue);
                    temp.TAKE_MAN    = templateEntity.TAKE_MAN;
                    temp.FINISH_DATE = DateTime.Now;
                    temp.FINISH_NUM  = templateEntity.FINISH_NUM;
                    temp.MAT_FEE     = templateEntity.MAT_FEE;
                    temp.MDDE_FEE    = templateEntity.MDDE_FEE;
                    temp.WEIGHT      = templateEntity.WEIGHT;
                    temp.WORK_TIME   = templateEntity.WORK_TIME;
                    temp.GROUP_NAME  = templateEntity.GROUP_NAME;
                    temp.MATERIAL    = templateEntity.MATERIAL;
                    templateApp.SubmitForm(temp, keyValue);
                }

                return(Success("操作成功!"));
            }
            catch (Exception ex)
            {
                return(Error("操作失败!"));
            }
        }
Ejemplo n.º 12
0
 // [ValidateAntiForgeryToken]
 public ActionResult SubmitNoticeForm(TemplateEntity templateEntity, string keyValue)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             var temp = templateApp.GetForm(keyValue);
             temp.TAKE_MAN    = templateEntity.TAKE_MAN;
             temp.FINISH_DATE = DateTime.Now;
             temp.FINISH_NUM  = templateEntity.FINISH_NUM;
             temp.MAT_FEE     = templateEntity.MAT_FEE;
             temp.MDDE_FEE    = templateEntity.MDDE_FEE;
             temp.WEIGHT      = templateEntity.WEIGHT;
             temp.WORK_TIME   = templateEntity.WORK_TIME;
             temp.GROUP_NAME  = templateEntity.GROUP_NAME;
             temp.MATERIAL    = templateEntity.MATERIAL;
             temp.NOTICE_GET  = "T";//已通知
             temp.NOTICE_MAN  = OperatorProvider.Provider.GetCurrent().UserName;
             temp.NOTICE_DATE = DateTime.Now;
             templateApp.SubmitForm(temp, keyValue);
             var appMan = userApp.GetFormByName(temp.CREATE_USER);
             if (appMan != null && !string.IsNullOrEmpty(appMan.F_Email))
             {
                 mHelper.MailServer = "10.110.120.2";
                 mHelper.Send(appMan.F_Email, "样板领取", "你好,有样板需要你登录OA领取,请点击链接<a>http://10.110.120.6:8090/</a>");
             }
         }
     }
     catch (Exception ex)
     {
         return(Error("操作失败!"));
     }
     return(Success("操作成功!"));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// テンプレート作成(作成本体)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="argument"></param>
        /// <returns></returns>
        public async Task TemplateCreate(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var message = await argument;
            var temp    = message.Text;

            //キャンセル操作が行われたら
            await TryCatch(context, temp, async() =>
            {
                //リストから指定したラベルを基にテンプレートエンティティを作成
                TemplateEntity templateEntity = new TemplateEntity(label, temp);

                //エンティティ追加実行
                TableResult insertResult = entityOperation.InsertEntityResult(templateEntity, string.Empty);

                if (insertResult != null)
                {
                    await context.PostAsync("テンプレートを作成しました");
                }
                else
                {
                    await context.PostAsync("テンプレートの作成に失敗しました");
                }
            });

            context.Done <object>(context);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// テンプレート編集(編集本体)
        /// </summary>
        /// <param name="context"></param>
        /// <param name="argument"></param>
        /// <returns></returns>
        public async Task TemplateEdit(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var message = await argument;
            var temp    = message.Text;

            //キャンセル操作が行われたら
            await TryCatch(context, temp, async() =>
            {
                //リストから指定したラベルを基にテンプレートエンティティを作成
                TemplateEntity template = new TemplateEntity(label, temp);

                //Eitityで上書きする
                TemplateEntity entity = entityOperation.UpdateEntityResult(template, string.Empty).Result as TemplateEntity;

                //上書き後の返り値がnullかどうか
                if (entity != null)
                {
                    await context.PostAsync("テンプレートを編集しました");
                }
                else
                {
                    await context.PostAsync("テンプレートの編集に失敗しました");
                }
            });


            context.Done <object>(context);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// This function is used to delete an TemplateEntity.
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <returns>True on success, false on fail.</returns>
        public static bool Delete(System.Guid guid)
        {
            TemplateEntity    template = new TemplateEntity(guid);
            DataAccessAdapter ds       = new DataAccessAdapter();

            return(ds.DeleteEntity(template));
        }
Ejemplo n.º 16
0
        public bool Update(TemplateEntity entity)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("update [Template] set ");
            sb.AppendFormat("TemplateName='{0}',", entity.TemplateName);
            sb.AppendFormat("FileName='{0}',", entity.FileName);
            sb.AppendFormat("FileExtensions='{0}',", entity.FileExtensions);
            sb.AppendFormat("Attr='{0}',", entity.Attr);
            sb.AppendFormat("Content=@Content,");
            if (entity.FilePrefix != null)
            {
                sb.AppendFormat("FilePrefix=@FilePrefix,");
            }
            sb.AppendFormat("EditTime='{0}'", DateTimeHelper.NowDateTime);
            sb.AppendFormat(" where [ID]={0}", entity.ID);
            string sql       = sb.ToString();
            var    paramList = new List <Paramter>()
            {
                new Paramter()
                {
                    ParamterName = "@Content", Value = entity.Content, DbType = DbType.String
                }
            };

            if (entity.FilePrefix != null)
            {
                paramList.Add(new Paramter()
                {
                    ParamterName = "@FilePrefix", Value = entity.FilePrefix, DbType = DbType.String
                });
            }
            return(db.ExecuteNonQuery(sql, paramList));
        }
Ejemplo n.º 17
0
        public int Add(TemplateEntity entity)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("insert into [Template](ParentID,TemplateName,FileExtensions,FileName,Attr,Content,FilePrefix) values");
            sb.AppendFormat("({0},'{1}','{2}','{3}','{4}',@Content", entity.ParentID, entity.TemplateName,
                            entity.FileExtensions, entity.FileName, entity.Attr);
            if (entity.FilePrefix != null)
            {
                sb.Append(",@FilePrefix");
            }
            sb.Append(");");
            string sql       = sb.ToString();
            var    paramList = new List <Paramter>()
            {
                new Paramter()
                {
                    ParamterName = "@Content", Value = entity.Content, DbType = DbType.String
                }
            };

            if (entity.FilePrefix != null)
            {
                paramList.Add(new Paramter()
                {
                    ParamterName = "@FilePrefix",
                    Value        = entity.FilePrefix,
                    DbType       = DbType.String
                });
            }
            return(db.ExecuteAdd(sql, paramList));
        }
Ejemplo n.º 18
0
        public virtual ActionResult Remove(string[] id)
        {
            var result = new Dictionary <string, object>();
            var rev    = false;
            var mess   = "";

            if (id != null)
            {
                var infos = new List <TemplateEntity>();
                foreach (var i in id)
                {
                    var info = new TemplateEntity
                    {
                        Id       = i.Convert <long>(),
                        SaveType = SaveType.Remove
                    };
                    infos.Add(info);
                }
                rev  = this.SaveEntities(infos);
                mess = rev ? "" : infos?.FirstOrDefault()?.Errors?.FirstOrDefault()?.Message;
            }
            result.Add("Status", rev);
            result.Add("Message", mess);
            return(this.Jsonp(result));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// This function is used to insert a TemplateEntity in the storage area.
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <param name="siteuid">Site Unique ID</param>
        /// <param name="templatetypeuid">Template Type Unique ID</param>
        /// <param name="name">Name</param>
        /// <param name="displayname">Display Name</param>
        /// <param name="description">Description</param>
        /// <param name="islocked">Is Locked Flag</param>
        /// <param name="isbuiltin">Is Builtin Flag</param>
        /// <param name="htmltext">HTML Text</param>
        /// <param name="createtime">Create Time</param>
        /// <param name="createuseruid">Create User UID</param>
        /// <param name="edittime">Edit Time</param>
        /// <param name="edituseruid">Edit User UID</param>
        /// <param name="owneruid">Owner Unique ID</param>
        /// <returns>True on success, False on fail</returns>
        public static bool Insert(
            System.Guid guid,
            System.Int32 siteuid,
            System.Int32 templatetypeuid,
            System.String name,
            System.String displayname,
            System.String description,
            System.Boolean islocked,
            System.Boolean isbuiltin,
            System.DateTime createtime,
            System.Int32 createuseruid,
            System.DateTime edittime,
            System.Int32 edituseruid,
            System.Int32 owneruid)
        {
            TemplateEntity template = new TemplateEntity();

            template.GUID            = guid;
            template.SiteUID         = siteuid;
            template.TemplateTypeUID = templatetypeuid;
            template.Name            = name;
            template.DisplayName     = displayname;
            template.Description     = description;
            template.IsLocked        = islocked;
            template.IsBuiltin       = isbuiltin;
            template.CreateTime      = createtime;
            template.CreateUserUID   = createuseruid;
            template.EditTime        = edittime;
            template.EditUserUID     = edituseruid;
            template.OwnerUID        = owneruid;
            DataAccessAdapter ds = new DataAccessAdapter();

            return(ds.SaveEntity(template));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 根据模版获取生成的代码
        /// </summary>
        public string GetByTable(
            string tableName,
            TemplateEntity templ
            )
        {
            TableEntity     table = service.GetTableByName(Project.ID.ToString(), tableName);
            CodeBuilderHost host  = new CodeBuilderHost();

            host.User          = User;
            host.Columns       = service.GetColumnList(table.ID.ToString()).ToList();
            host.Project       = Project;
            host.Table         = table;
            host.FileExtension = templ.FileExtensions;
            host.TemplateFile  = "";
            //开始生成代码
            Engine engine = new Engine();
            //string input = File.ReadAllText(host.TemplateFile,Encoding.Default);
            string input      = templ.Content;
            string outputText = engine.ProcessTemplate(input, host);

            //写入生成错误信息
            foreach (CompilerError createError in host.Errors)
            {
                Error.AppendLine(createError.ToString());
            }
            return(outputText);
        }
Ejemplo n.º 21
0
        public ActionResult Print(string keyValue)
        {
            List <TemplateEntity> tempList = new List <TemplateEntity>();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    string[] keys     = keyValue.Split(',');
                    var      GROUP_ID = "";
                    foreach (var k in keys)
                    {
                        TemplateEntity template = templateApp.GetForm(k);
                        template.PRT_TAG = "T";
                        if (!string.IsNullOrEmpty(GROUP_ID))
                        {
                            template.GROUP_ID = GROUP_ID;
                        }
                        else
                        {
                            GROUP_ID          = templateApp.ProduceGroupID();
                            template.GROUP_ID = GROUP_ID;
                        }
                        templateApp.SubmitForm(template, k);

                        tempList.Add(template);
                    }
                }
            }
            catch (Exception ex)
            {
                new ErrorLogApp().SubmitForm(ex);
            }
            return(View(tempList));
        }
        /// <summary>
        /// テンプレート表示
        /// </summary>
        /// <param name="context"></param>
        /// <param name="argument"></param>
        /// <returns></returns>
        public async Task TemplateDisplay(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var message = await argument;

            issueModel.Labels = message.Text;

            //操作キャンセル確認メソッド
            await dialog.TryCatch(context, issueModel.Labels, async() =>
            {
                //引数のラベルでEntityを検索する
                TemplateEntity entity = entityOperation_Template.RetrieveEntityResult(issueModel.Labels, "label", string.Empty).Result as TemplateEntity;

                //ラベルのテンプレートが未設定だったら
                if (entity == null)
                {
                    //テンプレートが未設定の旨をメッセージで表示
                    await context.PostAsync("テンプレートが未設定です。テンプレートを設定してください");

                    //issue作成操作を終了する
                    context.Done <object>(context);
                }
                else
                {
                    var input = "タイトル" + Environment.NewLine + entity.Template;

                    await context.PostAsync("下記のテンプレートを用いて本文を作成してください(タイトルのみも可)");
                    await context.PostAsync(ConvertToSlackFormat(input, "```"));

                    context.Wait(IssueCreate);
                }
            });
        }
Ejemplo n.º 23
0
        private void menuAddType_Click(object sender, EventArgs e)
        {
            Prompt p = new Prompt("模板分类")
            {
                Height = 100
            };
            string text = p.Show();

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            CodeBuilderService service = ServiceHelper.GetCodeBuilderService();
            TemplateEntity     entity  = new TemplateEntity()
            {
                ParentID     = TemplateRootID,
                Content      = "",
                FilePrefix   = "",
                TemplateName = text
            };

            if (service.AddTemplate(entity) > 0)
            {
                //创建模版目录
                //string path = Path.Combine(TemplateManager.TemplatePath, text);
                //FileHelper.CreateFolder(path);
                DataBind();
            }
            else
            {
                MsgBox.Alert("添加模板分类失败");
            }
        }
Ejemplo n.º 24
0
        private void cmbReposi_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cmb = sender as ComboBox;

            _selectEntity           = cmb.SelectedItem as TemplateEntity;
            cmbReturn.SelectedIndex = -1;
            cmbReturn.Text          = "";
        }
Ejemplo n.º 25
0
        // [ValidateAntiForgeryToken]
        public ActionResult SubmitCheckForm(TemplateEntity templateEntity, string keyValue)
        {
            try
            {
                string[]      Ids      = keyValue.Split(',');
                List <string> authList = new List <string>();
                List <string> appList  = new List <string>();
                foreach (var Id in Ids)
                {
                    var template = templateApp.GetForm(Id);
                    template.AUDIT_TAG  = templateEntity.AUDIT_TAG;
                    template.AUDIT_DATE = DateTime.Now;
                    if (templateEntity.AUDIT_TAG == "N")
                    {
                        template.BACK_REA = templateEntity.BACK_REA;
                    }
                    templateApp.SubmitForm(template, Id);
                    if (!appList.Contains(template.CREATE_USER))
                    {
                        appList.Add(template.CREATE_USER);
                    }
                    if (!authList.Contains(template.TEM_CHARGE))
                    {
                        authList.Add(template.TEM_CHARGE);
                    }
                }
                if (templateEntity.AUDIT_TAG == "N")
                {
                    foreach (var item in appList)
                    {
                        var user = userApp.GetFormByName(item);
                        if (user != null && !string.IsNullOrEmpty(user.F_Email))
                        {
                            mHelper.MailServer = "10.110.120.2";
                            mHelper.Send(user.F_Email, "样板审核不通过", "你好,你的样板审核不通过,详情查看请点击链接<a>http://10.110.120.6:8090/</a>");
                        }
                    }
                }
                else
                {
                    foreach (var item in authList)
                    {
                        var user = userApp.GetFormByName(item);
                        if (user != null && !string.IsNullOrEmpty(user.F_Email))
                        {
                            mHelper.MailServer = "10.110.120.2";
                            mHelper.Send(user.F_Email, "样板接收", "你好,有样板需要你接收,请点击链接<a>http://10.110.120.6:8090/</a>");
                        }
                    }
                }

                return(Success("操作成功。"));
            }
            catch (Exception)
            {
                return(Error("操作失败。"));
            }
        }
Ejemplo n.º 26
0
        //获取模板导出的文件名
        public string GetTemplateFileName(TemplateEntity templ)
        {
            string[] templateFileName = new string[] {
                templ.TemplateName, templ.FileName, templ.FileExtensions
            };
            string fileName = string.Join("-", templateFileName) + TemplateExt;

            return(fileName);
        }
Ejemplo n.º 27
0
        public void ShouldMapTemplateEntityToTemplateDto()
        {
            var entity = new TemplateEntity();

            var result = _mapper.Map <TemplateDto>(entity);

            result.Should().NotBeNull();
            result.Should().BeOfType <TemplateDto>();
        }
        private CreateTemplateResult RealCreateTransform(TemplateVo template)
        {
            if (string.IsNullOrEmpty(template.Name))
            {
                return(CreateTemplateResult.NameRequired);
            }

            if (string.IsNullOrEmpty(template.Version))
            {
                return(CreateTemplateResult.VersionRequired);
            }

            if (string.IsNullOrEmpty(template.Description))
            {
                return(CreateTemplateResult.DescriptionRequired);
            }

            if (string.IsNullOrEmpty(template.Body))
            {
                return(CreateTemplateResult.BodyRequired);
            }

            using (var context = new SavoryTransformDBContext())
            {
                var existingTransform = context.Transform.FirstOrDefault(v => v.Name.Equals(template.Name, StringComparison.OrdinalIgnoreCase) && v.DataStatus == 1);
                if (existingTransform == null)
                {
                    return(CreateTemplateResult.TransformNotFound);
                }

                var existingTemplate = context.Template.FirstOrDefault(v => v.Name.Equals(template.Name, StringComparison.OrdinalIgnoreCase) &&
                                                                       v.Version.Equals(template.Version, StringComparison.OrdinalIgnoreCase) &&
                                                                       v.DataStatus == 1);
                if (existingTemplate != null)
                {
                    return(CreateTemplateResult.TemplateVersionExisted);
                }

                var templateEntity = new TemplateEntity();
                templateEntity.Name           = template.Name;
                templateEntity.Version        = template.Version;
                templateEntity.Body           = template.Body;
                templateEntity.Extension      = template.Extension;
                templateEntity.ItemJsonValue  = template.ItemJsonValue;
                templateEntity.Description    = template.Description;
                templateEntity.DataStatus     = 1;
                templateEntity.CreateUser     = "******";
                templateEntity.CreateTime     = DateTime.Now;
                templateEntity.LastUpdateUser = "******";
                templateEntity.LastUpdateTime = DateTime.Now;
                context.Template.Add(templateEntity);

                context.SaveChanges();
            }

            return(CreateTemplateResult.Success);
        }
Ejemplo n.º 29
0
        public static TemplateEntity Map(this TemplateModel model)
        {
            var entity = new TemplateEntity {
                Id = model.Id
            };

            model.Map(entity);
            return(entity);
        }
Ejemplo n.º 30
0
        void test()
        {
            TemplateEntity entity = new TemplateEntity();

            entity.code = "123";
            if (ModelState.IsValid)
            {
            }
        }
Ejemplo n.º 31
0
        public ActionResult GetJobInfo([FromRoute] decimal jobId)
        {
            V_JobEntity entity = null;

            var query = from d in _context.V_JOBS
                        where d.JOB_ID == jobId
                        select d;

            if (query.Any())
            {
                V_JOB job = query.Single();
                entity             = new V_JobEntity();
                entity.jobId       = job.JOB_ID;
                entity.userId      = job.USER_ID;
                entity.phoneNumber = job.PHONE_NUMBER;

                ImageInfoEntity avatar = new ImageInfoEntity();
                avatar.path = job.AVATAR;

                entity.avatar  = avatar;
                entity.score   = job.SCORE;
                entity.likeNum = job.LIKE_NUM;

                TemplateEntity template = new TemplateEntity();
                template.templateCd    = job.TEMPLATE_CD;
                template.templateTitle = job.TEMPLATE_TITLE;
                entity.template        = template;

                Location loc = new Location();
                loc.latitude    = job.LATITUDE;
                loc.longitude   = job.LONGITUDE;
                entity.location = loc;

                Catalog catalog = new Catalog();
                catalog.catalogCd   = job.CATALOG_CD;
                catalog.catalogName = job.CATALOG_NAME;
                entity.catalog      = catalog;

                entity.dateTime = job.UPD_DATETIME.HasValue ? job.UPD_DATETIME.Value : job.REG_DATETIME;

                return(Ok(new Result
                {
                    Status = 200,
                    Message = string.Empty,
                    Data = entity
                }));
            }

            return(Ok(new Result
            {
                Status = 404,
                Message = "Data not exists.",
                Data = null
            }));
        }
Ejemplo n.º 32
0
 public Entity(int x, int y, TemplateEntity template)
 {
     this.X = x;
     this.Y = y;
     this.Template = template;
 }