Beispiel #1
0
        public WrapperContact CreateSingleContact(ContactENT Obj)
        {
            WrapperContact data = new WrapperContact();

            data.Contact = new ContactCRUD().CreateSingle(Obj);
            return(data);
        }
Beispiel #2
0
        public ContactENT UpdateSelectSingle(ContactENT Obj)
        {
            NbkDbEntities dbcontext = new NbkDbEntities();
            ContactBook   Data      = new ContactBook()
            {
                Id          = Obj.Id,
                Name        = Obj.Name,
                CompanyName = Obj.CompanyName,
                ContactNo   = Obj.ContactNo,
                Email       = Obj.Email
            };


            dbcontext.ContactBook.Attach(Data);
            var update = dbcontext.Entry(Data);

            update.Property(x => x.Name).IsModified        = true;
            update.Property(x => x.CompanyName).IsModified = true;
            update.Property(x => x.ContactNo).IsModified   = true;
            update.Property(x => x.Email).IsModified       = true;

            dbcontext.SaveChanges();

            return(Obj);
        }
Beispiel #3
0
        public ContactENT SelectSingle(int Id)
        {
            NbkDbEntities dbcontext = new NbkDbEntities();
            ContactBook   Obj       = dbcontext.ContactBook.Where(x => x.Id == Id).FirstOrDefault();
            ContactENT    Data      = new ContactENT()
            {
                Id          = Obj.Id,
                Name        = Obj.Name,
                CompanyName = Obj.CompanyName,
                ContactNo   = Obj.ContactNo,
                Email       = Obj.Email
            };

            return(Data);
        }
Beispiel #4
0
        public ContactENT CreateSingle(ContactENT Obj)
        {
            NbkDbEntities dbcontext = new NbkDbEntities();
            ContactBook   Data      = new ContactBook()
            {
                Name        = Obj.Name,
                CompanyName = Obj.CompanyName,
                ContactNo   = Obj.ContactNo,
                Email       = Obj.Email
            };


            dbcontext.ContactBook.Add(Data);
            dbcontext.SaveChanges();

            Obj.Id = Data.Id;

            return(Obj);
        }
Beispiel #5
0
        public string EmailSubjectReplacements(EmailTemplateENT template, ProjectENT projectDetail, ContactENT customer, ContactENT contactPerson, BuildingSupplierENT buildingSupplier, Users user)
        {
            string content = "";

            template.Title = template.Title.Replace("#CustomerName#", customer.Name);
            template.Title = template.Title.Replace("#Description#", projectDetail.Description);
            template.Title = template.Title.Replace("#Name#", user.FullName);
            template.Title = template.Title.Replace("#PhoneNumber#", user.ContactNo);
            template.Title = template.Title.Replace("#Email#", user.Email);
            template.Title = template.Title.Replace("#Designation#", user.Designation);
            if (contactPerson != null)
            {
                template.Title = template.Title.Replace("#ansvarlig#", contactPerson.Name);
            }
            else
            {
                template.Title = template.Title.Replace("#ansvarlig#", "");
            }
            template.Title = template.Title.Replace("#Address#", projectDetail.Address);
            template.Title = template.Title.Replace("#ProjectTitle#", projectDetail.Title);
            template.Title = template.Title.Replace("#CustomerPhone#", customer.ContactNo);
            template.Title = template.Title.Replace("#BuildingSupplier#", buildingSupplier.Title);
            content        = template.Title;

            return(content);
        }