Пример #1
0
        public Task <object> InsertAsync(SmtpModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Smtp ArgumentNullException Insert Async");
            }

            Smtp dto = AutoMapperGenericHelper <SmtpModel, Smtp> .Convert(model);

            var id = _smtpRepository.Insert(dto);

            return(Task.FromResult <object>(id));
        }
Пример #2
0
        public Task UpdateAsync(ClientsModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Client ArgumentNullException Insert Async");
            }

            Clients dto = AutoMapperGenericHelper <ClientsModel, Clients> .Convert(model);

            _clientRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
Пример #3
0
        public Task UpdateAsync(UsersModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("User ArgumentNullException Insert Async");
            }

            Users dto = AutoMapperGenericHelper <UsersModel, Users> .Convert(model);

            _usersRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
        public Task UpdateAsync(PagesModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("PagesModel ArgumentNullException Insert Async");
            }

            Pages dto = AutoMapperGenericHelper <PagesModel, Pages> .Convert(model);

            _pagesRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
        public Task <object> InsertAsync(RolesModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Role ArgumentNullException Insert Async");
            }

            Roles dto = AutoMapperGenericHelper <RolesModel, Roles> .Convert(model);

            var id = _rolesRepository.Insert(dto);

            return(Task.FromResult <object>(id));
        }
Пример #6
0
        public Task SaveOrUpdateAsync(ControllerActionsModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("ControllerActions ArgumentNullException Insert Async");
            }

            ControllerActions dto = AutoMapperGenericHelper <ControllerActionsModel, ControllerActions> .Convert(model);

            _controllerActionsRepository.SaveOrUpdate(dto);

            return(Task.FromResult <object>(null));
        }
Пример #7
0
        public Task UpdateAsync(SmtpModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Smtp ArgumentNullException Update Async");
            }

            Smtp dto = AutoMapperGenericHelper <SmtpModel, Smtp> .Convert(model);

            _smtpRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
        public Task UpdateAsync(RolesModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Role ArgumentNullException UpdateAsync");
            }


            Roles dto = AutoMapperGenericHelper <RolesModel, Roles> .Convert(model);

            _rolesRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
        public Task <object> InsertAsync(EmpLeaveDetailModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("EmpLeaveDetailModel ArgumentNullException Insert Async");
            }

            EmpLeaveDetail dto = AutoMapperGenericHelper <EmpLeaveDetailModel, EmpLeaveDetail> .Convert(model);



            var id = _empLeaveDetailRepository.Insert(dto);

            return(Task.FromResult <object>(id));
        }
Пример #10
0
        public Task <PagesModel> GetAsync(int id)
        {
            var dal = _pagesRepository.Get(id);

            if (dal == null)
            {
                return(Task.FromResult <PagesModel>(null));
            }
            else
            {
                PagesModel model = AutoMapperGenericHelper <Pages, PagesModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
Пример #11
0
        public Task <ControllerActionsModel> GetControllerActionsByControllerAndActionAsync(string controller, string action)
        {
            var dal = _controllerActionsRepository.GetByControllerAndActionAsync(controller, action);

            if (dal == null)
            {
                return(Task.FromResult <ControllerActionsModel>(null));
            }
            else
            {
                ControllerActionsModel model = AutoMapperGenericHelper <ControllerActions, ControllerActionsModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
Пример #12
0
        public Task <ControllerActionsModel> GetAsync(int id)
        {
            var dal = _controllerActionsRepository.Get(id);

            if (dal == null)
            {
                return(Task.FromResult <ControllerActionsModel>(null));
            }
            else
            {
                ControllerActionsModel model = AutoMapperGenericHelper <ControllerActions, ControllerActionsModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
Пример #13
0
        public Task UpdateAsync(EmpEmployeePkModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("EmpEmployeePkModel ArgumentNullException Insert Async");
            }

            EmpEmployeePk dto = AutoMapperGenericHelper <EmpEmployeePkModel, EmpEmployeePk> .Convert(model);



            _empEmployeePkRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
Пример #14
0
        public Task <ClientsModel> GetByClientIdAsync(string clientId)
        {
            var dal = _clientRepository.GetByClientIdAsync(clientId);

            if (dal == null)
            {
                return(Task.FromResult <ClientsModel>(null));
            }
            else
            {
                ClientsModel model = AutoMapperGenericHelper <Clients, ClientsModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
Пример #15
0
        public Task <SmtpModel> GetAsync(int id)
        {
            var dal = _smtpRepository.Get(id);

            if (dal == null)
            {
                return(Task.FromResult <SmtpModel>(null));
            }
            else
            {
                SmtpModel model = AutoMapperGenericHelper <Smtp, SmtpModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
Пример #16
0
        public Task <UsersModel> GetByUserNameAsync(string userName)
        {
            var dal = _usersRepository.GetByUserNameAsync(userName);

            if (dal == null)
            {
                return(Task.FromResult <UsersModel>(null));
            }
            else
            {
                UsersModel model = AutoMapperGenericHelper <Users, UsersModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
        public Task <EmpIdentityModel> GetAsync(int id)
        {
            var dal = _empIdentityRepository.Get(id);

            if (dal == null)
            {
                return(Task.FromResult <EmpIdentityModel>(null));
            }
            else
            {
                EmpIdentityModel model = AutoMapperGenericHelper <EmpIdentity, EmpIdentityModel> .Convert(dal);

                return(Task.FromResult(model));
            }
        }
        public Task UpdateAsync(EmpIdentityModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("EmpIdentityModel ArgumentNullException Insert Async");
            }

            EmpIdentity dto = AutoMapperGenericHelper <EmpIdentityModel, EmpIdentity> .Convert(model);

            EmpEmployeePk pk1 = _empEmployeePkRepository.Get((int)model.EmployeePkId);

            dto.EmpEmployeePk = pk1;
            if (pk1 == null)
            {
                throw new ArgumentNullException("EmployeePkId ArgumentNullException Insert Async");
            }


            _empIdentityRepository.Update(dto);

            return(Task.FromResult <object>(null));
        }
        public Task <IList <EmpIdentityModel> > GetAllAsync()
        {
            var dal = _empIdentityRepository.GetAll();

            if (dal == null)
            {
                return(Task.FromResult <IList <EmpIdentityModel> >(null));
            }
            else
            {
                IList <EmpIdentityModel> modelList = new List <EmpIdentityModel>();

                foreach (var user in dal)
                {
                    modelList.Add(AutoMapperGenericHelper <EmpIdentity, EmpIdentityModel> .Convert(user));
                }

                return(Task.FromResult <IList <EmpIdentityModel> >(modelList));
                //IQueryable<EmpIdentityModel> modelList = AutoMapperGenericHelper<EmpIdentity, EmpIdentityModel>.ConvertAsQueryable(dal);
                //return Task.FromResult<IList<EmpIdentityModel>>(modelList.ToList());
            }
        }
        public Task <object> InsertAsync(EmpEducationModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("EmpEducationModel ArgumentNullException Insert Async");
            }

            EmpEducation dto = AutoMapperGenericHelper <EmpEducationModel, EmpEducation> .Convert(model);

            EmpEmployeePk pk1 = _empEmployeePkRepository.Get((int)model.EmployeePkId);

            dto.EmpEmployeePk = pk1;
            if (pk1 == null)
            {
                throw new ArgumentNullException("EmployeePkId ArgumentNullException Insert Async");
            }


            var id = _empEducationRepository.Insert(dto);

            return(Task.FromResult <object>(id));
        }
Пример #21
0
        public void SendMail(EmailModel model)
        {
            var       smtpailObj = Get(1);
            SmtpModel obj        = AutoMapperGenericHelper <Smtp, SmtpModel> .Convert(smtpailObj);


            MailMessage msg = new MailMessage();

            if (obj != null)
            {
                //gelen string list e göre alıcıları msg a ekler.
                if (model.Recipient != null)
                {
                    foreach (string currentEmailAddress in model.Recipient)
                    {
                        msg.To.Add(new MailAddress(currentEmailAddress.Trim()));
                    }
                }
                else
                {
                    //gelen yoksa default kullanıcıyı ekler.
                    msg.To.Add(new MailAddress(obj.DefaultTo.Trim()));
                }
                //filename ve filecontent dictionary den okunup attachment olarak eklenir
                if (model.dictionaryMail != null && model.dictionaryMail.Keys.Count() > 0)
                {
                    foreach (KeyValuePair <string, byte[]> entry in model.dictionaryMail)
                    {
                        Attachment attc = new Attachment(new MemoryStream(entry.Value), entry.Key);
                        msg.Attachments.Add(attc);
                    }
                }


                string sendFromEmail    = obj.UserMail;
                string sendFromPassword = obj.UserPw;

                msg.From       = new MailAddress(sendFromEmail);
                msg.Subject    = model.Subject;
                msg.Body       = model.Body;
                msg.IsBodyHtml = true;
                SmtpClient client = new SmtpClient(obj.SmtpHost);
                client.Port                  = obj.SmtpPort;
                client.EnableSsl             = true;
                client.UseDefaultCredentials = false;
                NetworkCredential cred = new NetworkCredential(sendFromEmail, sendFromPassword);
                client.Credentials    = cred;
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

                try
                {
                    client.Send(msg);
                    msg.Dispose();
                }
                catch (Exception e)
                {
                    e.ToString();
                }
            }
        }