Example #1
0
 public ArticleController()
 {
     serviceTemplate = new ServiceTemplate();
     serviceArticle  = new ServiceArticle();
     serviceSchema   = new ServiceSchema();
     serviceAdmUser  = new ServiceAdmUser();
 }
Example #2
0
        public string  NewActivity(string ActivityType)
        {
            StringBuilder   str     = new StringBuilder();
            ServiceTemplate service = new ServiceTemplate();

            if (ActivityType != "")
            {
                var list = service.GetListActivityBytype(new Guid(ActivityType));
                foreach (var item in list)
                {
                    str.Append("<li><a href=\"/Activity/Details?Id=" + item.Id + "\">");
                    if (item.Imgurl != null)
                    {
                        string[] imge = item.Imgurl.Split(',');
                        str.Append("<img src=" + imge[0] + " />");
                    }
                    str.Append(" <span>" + item.Title + "</span>");
                    str.Append("</a></li>");
                }
                return(str.ToString());
            }
            else
            {
                return("");
            }
        }
Example #3
0
        /// <summary>
        /// INVIA MAIL
        /// Intanto così, poi si aggiungerà quello che serve, ma almeno centralizzo l'invio (almeno per quel che mi serve ora...)
        /// </summary>
        /// <param name="Content">TEsto mail</param>
        /// <param name="Address">Indirizzo</param>
        /// <param name="OtherParameters">Gli altri parametri che serviranno per l'invio</param>
        /// <returns>
        /// True: mail inviata
        /// False: errori invio...
        /// </returns>
        private bool NotificationSendMail(
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage Message,
            String Address)
        {
            if (Data == null)
            {
                Message.Translation.Body    = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Body);
                Message.Translation.Subject = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Subject);
            }
            else
            {
                Message.Translation.Body    = Data.AnalyzeContent(Message.Translation.Body, Settings);
                Message.Translation.Subject = Data.AnalyzeContent(Message.Translation.Subject, Settings);
            }

            bool sentMail = ServiceTemplate.SendMail(
                this.CurrentPerson,
                Settings.SmtpConfig,
                Message.MailSettings,
                Message.Translation.Subject,
                Message.Translation.Body,
                Address);

            return(sentMail);
        }
Example #4
0
        public PartialViewResult ActivityStyle()
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.ActivityStyle = service.GetActivityStylelist();
            return(PartialView(model));
        }
Example #5
0
        public JsonResult ActivityMapList(string lng, string lat, string Type)
        {
            ServiceTemplate         service = new ServiceTemplate();
            var                     list    = service.GetListActivityMap(lng, lat, Type);
            ActivityModelsListModel model   = new ActivityModelsListModel(list);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        //
        // GET: /Activity/
        public PartialViewResult LunBoRight()
        {
            ServiceTemplate         service = new ServiceTemplate();
            var                     list    = service.GetListActivityByTop(5);
            ActivityModelsListModel model   = new ActivityModelsListModel(list);

            return(PartialView(model));
        }
Example #7
0
        public ActionResult ActivityMapDetails(Guid?id)
        {
            ServiceTemplate         service = new ServiceTemplate();
            var                     list    = service.GetListActivity(id);
            ActivityModelsListModel model   = new ActivityModelsListModel(list);

            model.DataDictionary = service.GetActivityTypeList("活动类型");
            return(View(model));
        }
Example #8
0
        /// <summary>
        /// Invio mail con password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendRecover(
            Domain.TicketUser User,
            Domain.DTO.DTO_NotificationSettings Settings,
            String NewPassword)
        {
            //Testo esempio:

            /* Le sue credenziali per l'accesso al servizio ticket sono le seguenti:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Indirizzo per l'accesso: [PlaceHoldersType.UserTokenUrl]
             */

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Settings.LangCode = User.LanguageCode;

            // = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = NewPassword,
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRecover);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }
Example #9
0
        public ActionResult ActivityStyleDetails(Guid id)
        {
            ServiceTemplate service = new ServiceTemplate();
            var             info    = service.GetbyActivityStyle(id);
            var             model   = new ActivityStyleModel().ToModel(info);

            ViewBag.count = service.GetByMessageManagements(id);
            //ViewBag.MessageManagements = service.GetMessageManagementsList(id);
            return(View(model));
        }
Example #10
0
        public ActionResult Details(Guid id)
        {
            ServiceTemplate service = new ServiceTemplate();
            var             info    = service.GetbyActivity(id);
            var             model   = new ActivityModels().ToModel(info);

            ViewBag.ActivityByid = service.GetListActivityByid(id);
            ViewBag.Baomingmen   = service.GetRegistrationCount(id);
            return(View(model));
        }
Example #11
0
        public ServiceTemplate GetServiceTemplate(int id)
        {
            ServiceTemplate serviceTemplate = db.ServiceTemplates.FirstOrDefault(s => s.Id == id);

            if (serviceTemplate == null)
            {
                return(null);
            }
            return(serviceTemplate);
        }
Example #12
0
        //留言评价
        public ActionResult Message(string ActivityNmae, string Text, string Id, string UserId)
        {
            //if (!String.IsNullOrEmpty(SessionHelper.userid))
            //{
            UserId = "16BB93E1-3C85-47C5-A5C6-735A5C213320";
            ServiceTemplate service = new ServiceTemplate();

            return(Json(service.AddMessage(ActivityNmae, Text, UserId, Id)));
            //}
            //return Json(0);
        }
Example #13
0
        public PartialViewResult NewActivity()
        {
            ServiceTemplate service = new ServiceTemplate();
            ActivityModels  model   = new ActivityModels();

            model.DataDictionary = service.GetActivityTypeList("活动类型");
            var id = model.DataDictionary.FirstOrDefault().Id;

            ViewBag.ActivityBytype = service.GetListActivityBytype(id);
            return(PartialView(model));
        }
        private Dictionary <String, lm.Comol.Core.Notification.Domain.dtoNotificationMessage> GetTemplates(long idAction, Core.Notification.Domain.NotificationChannel channel, Core.Notification.Domain.NotificationMode mode, List <String> languageCodes)
        {
            Dictionary <String, lm.Comol.Core.Notification.Domain.dtoNotificationMessage> templates = new Dictionary <string, Core.Notification.Domain.dtoNotificationMessage>();

            if (languageCodes.Any())
            {
                /// RECUPERO I TEMPLATE PER CIASCUNA LINGUA
                templates = languageCodes.ToDictionary(l => l, l => ServiceTemplate.GetNotificationMessage(l, ModuleWebConferencing.UniqueCode, idAction, mode, channel));
            }
            return(templates);
        }
Example #15
0
        private void CreateType(Module module, GeneratorType type, string typeFolder)
        {
            if (type.BaseType == typeof(Enum))
            {
                // create model.ts file
                var modelTemplate = new ModelTemplate(type, Modules);
                TransformText(modelTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}.ts");

                // create service.ts file
                var serviceTemplate = new EnumServiceTemplate(type);
                TransformText(serviceTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}.service.ts");
            }
            else
            {
                // create model.ts file
                var modelTemplate = new ModelTemplate(type, Modules);
                TransformText(modelTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}.ts");

                // create service.ts file
                var serviceTemplate = new ServiceTemplate(type, module.ModuleName);
                TransformText(serviceTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}.service.ts");

                // create listcomponent.ts file
                var listComponentTemplate = new ListComponentTemplate(type);
                TransformText(listComponentTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}-list.component.ts");

                // create list html.ts file
                var listHtmlTemplate = new ListHtmlTemplate(type, module.ModuleName, module.UIName);
                TransformText(listHtmlTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}-list.template.html");

                // create edit component.ts file
                var editComponentTemplate = new EditComponentTemplate(type, module.ModuleName, Modules);
                TransformText(editComponentTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}-edit.component.ts");

                // create edit html.ts file
                var editHtmlTemplate = new EditHtmlTemplate(type, module.ModuleName, module.UIName);
                TransformText(editHtmlTemplate, $"{typeFolder}\\{type.Name.ToLower(cultureInfo)}-edit.template.html");

                // create enum pipe files
                var enumProperties = GetEnumProperties(type.Type);
                foreach (var pi in enumProperties)
                {
                    var typeName   = ExtractTypeName(pi);
                    var enumModule = SearchTypeInModules(Modules, typeName);
                    var pipeFolder = $"{OutputFolder}\\src\\app\\core\\pipes";
                    CreateFolder(pipeFolder);
                    var enumPipeTemplate = new EnumPipeTemplate(pi, module);
                    TransformText(enumPipeTemplate, $"{pipeFolder}\\{typeName.ToLower(cultureInfo)}.pipe.ts");
                }
            }
        }
 private void GenerateService(CodeGenerateDto dto)
 {
     foreach (var entity in dto.Entities)
     {
         if (dto.ExceptServices.Contains(entity.Name, StringComparer.OrdinalIgnoreCase))
         {
             continue;
         }
         var serviceTemplate = new ServiceTemplate();
         serviceTemplate.Name = entity.Name;
         Directory.CreateDirectory($@"{dto.BasePath}\Service");
         System.IO.File.WriteAllText($@"{dto.BasePath}\Service\{entity.Name}Service.cs", serviceTemplate.TransformText());
     }
 }
 private void DisableSearchService()
 {
     if (ComboBoxService.SelectedItem != null)
     {
         ButtonSearch.IsEnabled     = true;
         ButtonGeneration.IsEnabled = true;
         string         optionService = ((ComboBoxItem)ComboBoxService.SelectedItem).Content.ToString();
         Models.Service serviceSelect = services.Find(Service => Service.name.Equals(optionService));
         optionIdService = serviceSelect.idService;
         nameService     = serviceSelect.name;
         serviceTemplate = new ServiceTemplate();
         GetRequestReceived();
     }
 }
        private void TransformServices(SmartAppInfo manifest)
        {
            bool result          = true;
            var  enabledEntities = manifest.DataModel.Entities.Where(e => !e.IsAbstract && e.AllProperties().FirstOrDefault(p => p.IsKey) != null);

            foreach (var entity in enabledEntities)
            {
                if (!result)
                {
                    break;
                }
                var template = new ServiceTemplate(entity, manifest.Id, Constants.Version);
                result = _writingService.WriteFile(Path.Combine(_context.BasePath, template.OutputPath, $"{entity.Id}Service.g.cs"), template.TransformText());
            }
        }
Example #19
0
        public ActionResult ActivityRegister(string RegistrationName, string RegistrationTel, string UserId, string Id)
        {
            //测试用户id
            UserId = "16BB93E1-3C85-47C5-A5C6-735A5C213320";
            ServiceTemplate service = new ServiceTemplate();
            var             count   = service.GetIsRegistration(new Guid(UserId), new Guid(Id));

            if (count > 0)
            {
                return(Json(2));
            }
            else
            {
                return(Json(service.Add(RegistrationName, RegistrationTel, UserId, Id)));
            }
        }
Example #20
0
        ///查看更多 切换显示Ajax
        public JsonResult SeeAjaxIndex(string ActivityType, int pagings = 0)
        {
            ServiceTemplate service = new ServiceTemplate();
            ActivityModels  model   = new ActivityModels();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = new Guid(ActivityType);
            Paging paging = new Paging(model.Condition);
            var    ser    = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(ser);

            models.Paging = paging;
            models.Total  = paging.Total.ToString();
            models.Index  = paging.PageIndex.ToString();
            models.Size   = paging.PageSize.ToString();
            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Example #21
0
        /// <summary>
        /// Invio mail per reset password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendPasswordChanged(Domain.TicketUser User, Domain.DTO.DTO_NotificationSettings Settings)
        {
            ////Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = "",
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalPasswordChanged);

            if (msg != null)
            {
                return(NotificationSendMail(Settings, Data, msg, Mail));
            }


            return(true);

            // Invio Mail.
        }
Example #22
0
        public void RenderServiceFile(List <SearchModel> models)
        {
            if (!Directory.Exists(_outputPath + "Services\\" + NormalizeTableName + "\\"))
            {
                Directory.CreateDirectory(_outputPath + "Services\\" + NormalizeTableName + "\\");
            }
            var serviceTemplate = new ServiceTemplate(_projectName, _tableName.Replace("_", ""), models);
            var output          = serviceTemplate.TransformText();
            var outputPath      = _outputPath + "Services\\" + NormalizeTableName + "\\" + NormalizeTableName + "Service.cs";

            File.WriteAllText(outputPath, output);

            var interfaceTemplate = new IServiceTemplate(_projectName, NormalizeTableName);
            var iOutPut           = interfaceTemplate.TransformText();
            var iOutPutPath       = _outputPath + "Services\\" + NormalizeTableName + "\\I" + NormalizeTableName + "Service.cs";

            File.WriteAllText(iOutPutPath, iOutPut);
        }
Example #23
0
        public JsonResult FenyeSeeMoreNew(string type = "", int pagings = 0)
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = new Guid(type);
            Paging paging = new Paging(model.Condition);

            paging.PageIndex = pagings;
            var activity = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(activity);

            models.Paging = paging;
            models.Total  = paging.Total.ToString();
            models.Index  = paging.PageIndex.ToString();
            models.Size   = paging.PageSize.ToString();
            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Example #24
0
        public bool UpdateServiceTemplate(ServiceTemplate serviceTemplate)
        {
            var existingTemplate = db.ServiceTemplates.FirstOrDefault(p => p.Id == serviceTemplate.Id);

            if (existingTemplate != null)
            {
                existingTemplate.Name       = serviceTemplate.Name;
                existingTemplate.UseTasks   = serviceTemplate.UseTasks;
                existingTemplate.Url        = serviceTemplate.Url;
                existingTemplate.JsonFields = serviceTemplate.JsonFields;
            }
            else
            {
                db.ServiceTemplates.Add(serviceTemplate);
            }

            db.SaveChanges();

            return(true);
        }
Example #25
0
        public ActionResult SeeMore(int pagings = 0)
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = service.GetActivityTypeList("活动类型").Where(n => n.Name == "公益活动").FirstOrDefault().Id;
            Paging paging = new Paging(model.Condition);

            paging.PageIndex = pagings;
            var activity = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(activity);

            models.Paging         = paging;
            models.Total          = paging.Total.ToString();
            models.Index          = paging.PageIndex.ToString();
            models.Size           = paging.PageSize.ToString();
            models.DataDictionary = service.GetActivityTypeList("活动类型");
            return(View(models));
        }
Example #26
0
        /// <summary>
        /// Invio notifiche automatiche
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <param name="OtherParameters">Altri parametri da definire...</param>
        /// <returns></returns>
        /// <remarks>
        /// ATTENZIONE! Sarà necessario creare funzioni "ad hoc" con relativi parametri necessari.
        /// </remarks>
        public bool NotificationSend(
            ModuleTicket.MailSenderActionType ActionType,
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            String Address)
        {
            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Address));
        }
Example #27
0
        /// <summary>
        /// Creates a route from a service template and date. Uses a random route name.
        /// </summary>
        private void CreateRoute(DateTime date, ServiceTemplate serviceTemplate, BusinessAccount ownerBusinessAccount, int clientIndex)
        {
            var newRoute = new Route
            {
                Id = Guid.NewGuid(),
                Name = _routeNames.RandomItem(),
                Date = date.Date,
                RouteType = serviceTemplate.Name,
                OwnerBusinessAccount = ownerBusinessAccount,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };

            //Add employees to the Route
            newRoute.Employees.Add(_employeesDesignData.DesignEmployees.FirstOrDefault(e => e.FirstName == "Jon"));

            //Add vehicles to the Route
            newRoute.Vehicles.Add(_vehiclesDesignData.DesignVehicles.RandomItem());

            var orderInRoute = 1;

            var startingClientIndex = clientIndex * 6;

            //Create Services and RouteTasks, add them to the Route
            for (var i = startingClientIndex; i <= (startingClientIndex + 5); i++)
            {
                //Prevents you from trying to add a client that doesnt exist in Design Data
                if (i > _clientsDesignData.DesignClients.Count())
                    break;

                var currentClient = _clientsDesignData.DesignClients.ElementAt(i);

                //Take the first location from the client
                var currentLocation = currentClient.Locations.ElementAt(0);

                var newService = new Service
                {
                    ServiceDate = newRoute.Date,
                    ServiceTemplate = serviceTemplate.MakeChild(ServiceTemplateLevel.ServiceDefined),
                    Client = currentClient,
                    ServiceProvider = ownerBusinessAccount,
                    CreatedDate = DateTime.UtcNow,
                    LastModified = DateTime.UtcNow
                };

                newService.ServiceTemplate.SetDestination(currentLocation);

                var routeTask = new RouteTask
                {
                    OrderInRouteDestination = 1,
                    Date = newRoute.Date,
                    Location = currentClient.Locations.ElementAt(0),
                    Client = currentClient,
                    Name = newRoute.RouteType,
                    EstimatedDuration = new TimeSpan(0, _random.Next(25), 0),
                    OwnerBusinessAccount = ownerBusinessAccount,
                    Service = newService,
                    TaskStatus = ownerBusinessAccount.TaskStatuses.FirstOrDefault(ts => ts.DefaultTypeInt != null && ts.DefaultTypeInt == ((int)StatusDetail.RoutedDefault)),
                    CreatedDate = DateTime.UtcNow,
                    LastModified = DateTime.UtcNow
                };

                var routeDestination = new RouteDestination
                {
                    OrderInRoute = orderInRoute,
                    CreatedDate = DateTime.UtcNow,
                    LastModified = DateTime.UtcNow
                };
                routeDestination.RouteTasks.Add(routeTask);
                newRoute.RouteDestinations.Add(routeDestination);

                orderInRoute++;
            }

            DesignRoutes.Add(newRoute);
        }
Example #28
0
        /// <summary>
        /// Invio Token/URL per la validazione dell'utente
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendToken(TicketUser User, Domain.DTO.DTO_NotificationSettings Settings, Token Token, String Password)
        {
            //Testo esempio:

            /* Gentile [PlaceHoldersType.UserSureName] [PlaceHoldersType.UserName]
             * Il suo account è stato registrato nel sistema.
             *
             * Dati Account:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Lingua: [PlaceHoldersType.UserLanguageCode]
             *
             * Per attivarlo è necessario accedere con le proprie credenziali al seguente indirizzo:
             * [PlaceHoldersType.UserTokenUrl]
             *
             * Oppure dalla pagine di accesso, al primo tentativo verrà richiesto il seguente codice di convalida:
             * [PlaceHoldersType.UserToken]
             *
             * La conferma dell'account può essere effettuata entro il: [PlaceHoldersType.UserTokenExpiration]
             */


            //To Do!!!
            //Domain.Enums.Notification NotificationType = Domain.Enums.Notification.ExternalRegistration;

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null, IntTicketStatus= null,
            //    SmtpConfig = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? false : true;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = Password,
                Token        = new Domain.DTO.Notification.DTO_User.DTO_Token
                {
                    Code     = Token.Code.ToString(),
                    Creation = Token.CreatedOn
                }
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }
        /// <summary>
        /// Initializes the <see cref="ServiceTemplatesDesignData"/> class.
        /// </summary>
        static ServiceTemplatesDesignData()
        {
            #region Oil and GreaseCompany

            OilServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{8ADDFE8A-7376-4AC4-8312-C7152148F1A5}"),
                Name = "WVO Collection",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoice,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            OilServiceTemplate.Invoice.Id = OilServiceTemplate.Id;

            var oilFields = new FieldsDesignData().DesignFields.ToArray();
            foreach (var field in oilFields)
                OilServiceTemplate.Fields.Add(field);

            var smallGreaseFields = new FieldsDesignData().DesignFields.ToArray();

            SmallGreaseTrapServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{B1B4C515-EBBC-4D16-AC11-94C6D1B7EF8D}"),
                Name = "Grease Trap Service",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceTwo,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            SmallGreaseTrapServiceTemplate.Invoice.Id = SmallGreaseTrapServiceTemplate.Id;

            foreach (var field in smallGreaseFields)
                SmallGreaseTrapServiceTemplate.Fields.Add(field);

            var interceptorFields = new FieldsDesignData().DesignFields.ToArray();

            InterceptorServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{699D428A-3A4F-472D-9850-BD54CFB99625}"),
                Name = "Interceptor, 500+ gallons",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceThree,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            InterceptorServiceTemplate.Invoice.Id = InterceptorServiceTemplate.Id;

            foreach (var field in interceptorFields)
                InterceptorServiceTemplate.Fields.Add(field);

            var hydroFields = new FieldsDesignData().DesignFields.ToArray();

            HydrojettingServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{0A60FAC7-31A2-4CEA-9EDC-B63DD8D953C9}"),
                Name = "Hydrojetting",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoice,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            HydrojettingServiceTemplate.Invoice.Id = HydrojettingServiceTemplate.Id;

            foreach (var field in hydroFields)
                HydrojettingServiceTemplate.Fields.Add(field);

            var containerFields = new FieldsDesignData().DesignFields.ToArray();

            ContainerReplacementServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{D82CA114-2660-4F09-A9B4-DFBFB4C1D10E}"),
                Name = "Container Replacement",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceTwo,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            ContainerReplacementServiceTemplate.Invoice.Id = ContainerReplacementServiceTemplate.Id;

            foreach (var field in containerFields)
                ContainerReplacementServiceTemplate.Fields.Add(field);

            #region Environmental Biotech

            var enviroFields = new FieldsDesignData().DesignFields.ToArray();

            EnvironmentalBiotechServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{B82D1251-95E0-485E-9667-4A7387D46FA1}"),
                Name = "Environmental Biotech",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceTwo,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            EnvironmentalBiotechServiceTemplate.Invoice.Id = EnvironmentalBiotechServiceTemplate.Id;

            foreach (var field in enviroFields)
                EnvironmentalBiotechServiceTemplate.Fields.Add(field);

            #endregion

            OilGreaseCompanyServiceTemplates = new List<ServiceTemplate>
            {
                OilServiceTemplate,
                SmallGreaseTrapServiceTemplate,
                InterceptorServiceTemplate,
                HydrojettingServiceTemplate,
                ContainerReplacementServiceTemplate,
                EnvironmentalBiotechServiceTemplate
            };

            #endregion

            #region Same Day Delivery

            DirectServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{C8E89404-3547-4A75-9E90-0B3BF48B04F1}"),
                Name = "Direct",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceThree,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            DirectServiceTemplate.Invoice.Id = DirectServiceTemplate.Id;

            var directFields = new FieldsDesignData().DesignFields.ToArray();
            foreach (var field in directFields)
                DirectServiceTemplate.Fields.Add(field);

            RushServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{88E8A760-0FEC-478F-867D-4AE07EDEDD19}"),
                Name = "Rush",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoice,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            RushServiceTemplate.Invoice.Id = RushServiceTemplate.Id;

            var rushFields = new FieldsDesignData().DesignFields.ToArray();
            foreach (var field in rushFields)
                RushServiceTemplate.Fields.Add(field);

            RegularServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{CE0EC8C5-6B39-41BE-922F-A1E1DDD367C5}"),
                Name = "Regular",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceTwo,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            RegularServiceTemplate.Invoice.Id = RegularServiceTemplate.Id;

            var regularFields = new FieldsDesignData().DesignFields.ToArray();
            foreach (var field in regularFields)
                RegularServiceTemplate.Fields.Add(field);

            EconomyServiceTemplate = new ServiceTemplate
            {
                Id = new Guid("{BE09BB53-DE15-4E6C-BF7A-1595EA91DF56}"),
                Name = "Economy",
                ServiceTemplateLevel = ServiceTemplateLevel.FoundOpsDefined,
                OwnerServiceProvider = BusinessAccountsDesignData.FoundOps,
                Invoice = new InvoicesDesignData().DesignInvoiceThree,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };
            EconomyServiceTemplate.Invoice.Id = EconomyServiceTemplate.Id;

            var economyFields = new FieldsDesignData().DesignFields.ToArray();
            foreach (var field in economyFields)
                EconomyServiceTemplate.Fields.Add(field);

            SameDayDeliveryCompanyServiceTemplates = new List<ServiceTemplate>
                                                         {
                                                             DirectServiceTemplate,
                                                             RushServiceTemplate,
                                                             RegularServiceTemplate,
                                                             EconomyServiceTemplate
                                                         };

            #endregion
        }
Example #30
0
 public SchemaController()
 {
     serviceTemplate = new ServiceTemplate();
     serviceSchema   = new ServiceSchema();
 }
Example #31
0
 public static TTarget MapTo <TTarget>(this ServiceTemplate source) where TTarget : ServiceTemplateViewModel
 {
     return(Mapper.Map <ServiceTemplate, TTarget>(source));
 }
Example #32
0
        private ResponseNotification Validation(Notification inputNotification)
        {
            ResponseNotification result = new ResponseNotification()
            {
                Error = false, Status = 1, Message = "OK"
            };

            //Validamos Plantilla

            #region template
            if (inputNotification.TemplateSend.IdTemplate <= 0)
            {
                result.Error   = true;
                result.Status  = 101;
                result.Message = "Template has not an identifier(Template.id_template)";
                return(result);
            }
            if (!ServiceTemplate.ExistTemplate(inputNotification.TemplateSend.IdTemplate))
            {
                result.Error   = true;
                result.Status  = 102;
                result.Message = "Template identified don't exist ";
                return(result);
            }

            if (inputNotification.TemplateSend.Field.Length.Equals(0))
            {
                result.Error   = true;
                result.Status  = 103;
                result.Message = "Plantilla no incluye parametros";
                return(result);
            }
            foreach (var field in inputNotification.TemplateSend.Field)
            {
                if (string.IsNullOrEmpty(field.Value))
                {
                    result.Error   = true;
                    result.Status  = 104;
                    result.Message = "The field:" + field.Field + " no puede estas vacio";
                    return(result);
                }
            }


            #region Mail
            #region from
            if (inputNotification.MailSend.From.Name.Trim() == string.Empty)
            {
                result.Error   = true;
                result.Status  = 201;
                result.Message = "Mail  from  sender  there is not a name ";
                return(result);
            }
            if (inputNotification.MailSend.From.Address.Trim() == string.Empty)
            {
                result.Error   = true;
                result.Status  = 202;
                result.Message = "The Addres  there is  empty";
                return(result);
            }
            var isMail = ServiceMessenger.IsMailValid(inputNotification.MailSend.From.Address.Trim());
            if (isMail == false)
            {
                result.Error   = true;
                result.Status  = 203;
                result.Message = "The Address format is Incorrect";
                return(result);
            }



            #endregion

            #region To
            foreach (var email in inputNotification.MailSend.To)
            {
                if (email.Name.Trim() == string.Empty)
                {
                    result.Error   = true;
                    result.Status  = 204;
                    result.Message = "The Email to destination have not a name";
                    return(result);
                }
                if (email.Address.Trim() == string.Empty)
                {
                    result.Error   = true;
                    result.Status  = 205;
                    result.Message = "the Email has not a Address available";
                    return(result);
                }
                isMail = ServiceMessenger.IsMailValid(email.Address.Trim());
                if (isMail == false)
                {
                    result.Error   = true;
                    result.Status  = 206;
                    result.Message = "The Email has not a correct format";
                    return(result);
                }
            }

            #endregion
            #region Cc
            if (inputNotification.MailSend.CC != null && inputNotification.MailSend.CC.Length > 0)
            {
                foreach (var email in inputNotification.MailSend.CC)
                {
                    if (email.Name.Trim() == string.Empty)
                    {
                        result.Error   = true;
                        result.Status  = 207;
                        result.Message = "Mail to Copy has not a name";
                        return(result);
                    }

                    if (email.Address.Trim() == string.Empty)
                    {
                        result.Error   = true;
                        result.Status  = 208;
                        result.Message = "mail to Copy has not a Address Avalable";
                    }
                    isMail = ServiceMessenger.IsMailValid(email.Address.Trim());
                    if (isMail == false)
                    {
                        result.Error   = true;
                        result.Status  = 209;
                        result.Message = "The Address has not the correct format";
                        return(result);
                    }
                }
            }
            #endregion

            #region BCC
            if (inputNotification.MailSend.DCC != null && inputNotification.MailSend.DCC.Length > 0)
            {
                foreach (var email in inputNotification.MailSend.DCC)
                {
                    if (email.Name.Trim() == string.Empty)
                    {
                        result.Error   = true;
                        result.Status  = 210;
                        result.Message = "Mail of Copy hidden has not a name";
                        return(result);
                    }

                    if (email.Address.Trim() == string.Empty)
                    {
                        result.Error   = true;
                        result.Status  = 211;
                        result.Message = "Adrress there are ";
                        return(result);
                    }

                    isMail = ServiceMessenger.IsMailValid(email.Address.Trim());
                    if (isMail == false)
                    {
                        result.Error   = true;
                        result.Status  = 212;
                        result.Message = "The Address has not the correct format";
                        return(result);
                    }
                }
            }
            #endregion


            if (inputNotification.MailSend.Subject.Trim() == string.Empty)
            {
                result.Error   = true;
                result.Status  = 213;
                result.Message = "The Mail there is not  a Subject";
                return(result);
            }

            #region Remainder
            if (inputNotification.ReminderSend.IsRemainder)
            {
                var dateNow = DateTime.UtcNow.AddHours((int.Parse(Environment.GetEnvironmentVariable("UTC")) * -1));
                if (inputNotification.ReminderSend.End <= dateNow)
                {
                    result.Error   = true;
                    result.Status  = 300;
                    result.Message = "the date Begin have to be mayor  than  the date and hours now " + dateNow.ToString("dd/MM/yyyy HH:mm");
                    return(result);
                }

                if (inputNotification.ReminderSend.End <= inputNotification.ReminderSend.Begin)
                {
                    result.Error   = true;
                    result.Status  = 301;
                    result.Message = "The expire date dont have equal or less than  the date begin";
                    return(result);
                }

                if (inputNotification.ReminderSend.Timer == 0)
                {
                    result.Error   = true;
                    result.Status  = 302;
                    result.Message = "The timer has not  cero";
                    return(result);
                }
            }

            #endregion

            return(result);

            #endregion

            #endregion
        }
Example #33
0
 public static ServiceTemplate CreateServiceTemplate(global::System.Guid ID, global::System.Guid stampId, global::System.Collections.ObjectModel.ObservableCollection<UserAndRole> grantedToList, global::System.Collections.ObjectModel.ObservableCollection<ServiceSetting> serviceSettings, global::System.Collections.ObjectModel.ObservableCollection<CustomProperty> customProperty)
 {
     ServiceTemplate serviceTemplate = new ServiceTemplate();
     serviceTemplate.ID = ID;
     serviceTemplate.StampId = stampId;
     if ((grantedToList == null))
     {
         throw new global::System.ArgumentNullException("grantedToList");
     }
     serviceTemplate.GrantedToList = grantedToList;
     if ((serviceSettings == null))
     {
         throw new global::System.ArgumentNullException("serviceSettings");
     }
     serviceTemplate.ServiceSettings = serviceSettings;
     if ((customProperty == null))
     {
         throw new global::System.ArgumentNullException("customProperty");
     }
     serviceTemplate.CustomProperty = customProperty;
     return serviceTemplate;
 }