示例#1
0
 public async Task<OpObject> SendMail(CMail Mail)
 {
     IsolatedContext IsoContext = new IsolatedContext();
     return await Execute(new Func<Task>(async () =>
     {
         /* Oh no, problem is STService Town, contact the organization repo */
         using (MaintienceRepository MainRepo = new MaintienceRepository())
         {
             /* Well then, lets try to create this organization */
             IsoContext.RetObj = await MainRepo.InsertMail(Mail);
         }
     }), IsoContext);
 }
示例#2
0
        /* Create User */
        public async Task<OpObject> CreateUser(CCustomer CustomerInfo)
        {
            /* Create return object */
            IsolatedContext IsoContext = new IsolatedContext();

            /* Execute function */
            return await Execute(new Func<Task>(async () =>
            {
                using (UserRepository UserRepo = new UserRepository())
                {
                    /* Done */
                    IsoContext.RetObj = await UserRepo.Create(CustomerInfo, true);

                    /* Sanity */
                    if (IsoContext.RetObj.Code != StatusCode.Ok)
                        return;

                    /* Create a confirmation code and send the email 
                     * to the given user */
                    using (MaintienceRepository MainRepo = new MaintienceRepository()) {
                        /* Create a new confcode */
                        String uId = (String)IsoContext.RetObj.Data;
                        String ConfCode = await MainRepo.CreateCode(CodeType.Confirmation, uId);

                        /* Send a new mail */
                        IsoContext.RetObj = await MainRepo.InsertMail(new CMail() {
                            MailTo = CustomerInfo.Email,
                            Type = MailType.NoReply,
                            Subject = "NRG Models Confirmation",
                            Body = "",
                            IsHtml = false
                        });
                    }
                }
            }), IsoContext);
        }