Пример #1
0
        //Save Tasks to the database to the Tasks table
        //public  static void SaveTask(TaskViewModel TaskViewModel)
        //{
        //    MitBudDBEntities db = new MitBudDBEntities();
        //    AspNetUser asp = new AspNetUser();
        //    Task Task = new Task();
        //    AccountController account = new AccountController();

        //    RegisterClient r = new RegisterClient();
        //    var s = r;
        //    s.Name = TaskViewModel.ClientName;
        //    s.Email = TaskViewModel.ClientEmail;
        //    s.Password = "******";
        //    s.ConfirmPassword = "******";
        //    account.Register_client(r);



        //    Task.Title = TaskViewModel.Title;


        //    Task.Description = TaskViewModel.Description;
        //    Task.Category = TaskViewModel.Category;
        //    Task.ClientName = TaskViewModel.ClientName;
        //    Task.ClientAddress = TaskViewModel.ClientName;
        //    Task.ClientPostCode = TaskViewModel.ClientPostCode;
        //    Task.ClientTelephone = TaskViewModel.ClientTelephone;
        //    Task.ClientEmail = TaskViewModel.ClientEmail;
        //    Task.WhoAreYou = TaskViewModel.WhoAreYou;
        //    Task.TaskCost = TaskViewModel.TaskCost;
        //    db.Tasks.Add(Task);
        //    db.SaveChanges();


        //}


        public static void SaveTask(TaskViewModel TaskViewModel, string userId)
        {
            MitBudDBEntities db   = new MitBudDBEntities();
            Task             Task = new Task();

            Task.Client_id       = userId;
            Task.Title           = TaskViewModel.Title;
            Task.Description     = TaskViewModel.Description;
            Task.Category        = TaskViewModel.Category;
            Task.ClientName      = TaskViewModel.ClientName;
            Task.ClientAddress   = TaskViewModel.ClientName;
            Task.ClientPostCode  = TaskViewModel.ClientPostCode;
            Task.ClientTelephone = TaskViewModel.ClientTelephone;
            Task.ClientEmail     = TaskViewModel.ClientEmail;
            Task.WhoAreYou       = TaskViewModel.WhoAreYou;
            Task.TaskCost        = TaskViewModel.TaskCost;
            db.Tasks.Add(Task);
            db.SaveChanges();

            //SendPasswordResetEmail(TaskViewModel.ClientEmail, TaskViewModel.ClientName);


            //ChangePasswordBindingModel ch = new ChangePasswordBindingModel();
            //ch.OldPassword = randomPass;
        }
Пример #2
0
        //Save Task to the database in the Tasks table
        public static void SaveTaskRegisteredUser(TaskViewModel taskViewModel, string userId)
        {
            MitBudDBEntities db   = new MitBudDBEntities();
            Task             Task = new Task();

            Task.Client_id         = userId;
            Task.Title             = taskViewModel.Title;
            Task.Description       = taskViewModel.Description;
            Task.Category          = taskViewModel.Category;
            Task.ClientName        = taskViewModel.ClientName;
            Task.ClientStreetName  = taskViewModel.ClientStreetName;
            Task.ClientHouseNumber = taskViewModel.ClientHouseNumber;
            Task.ClientPostCode    = taskViewModel.ClientPostCode;
            Task.Region            = taskViewModel.Region;
            Task.ClientCity        = taskViewModel.ClientCity;
            Task.ClientTelephone   = taskViewModel.ClientTelephone;
            Task.ClientEmail       = taskViewModel.ClientEmail;
            Task.WhoAreYou         = taskViewModel.WhoAreYou;
            Task.TaskCost          = taskViewModel.TaskCost;
            Task.Date        = taskViewModel.Date;
            Task.DesiredDate = taskViewModel.DesiredDate;
            Task.Image       = taskViewModel.Image;
            Task.Status      = taskViewModel.Status;
            db.Tasks.Add(Task);
            db.SaveChanges();

            //SendPasswordResetEmail(taskViewModel.ClientEmail, taskViewModel.ClientName);


            //ChangePasswordBindingModel ch = new ChangePasswordBindingModel();
            //ch.OldPassword = randomPass;
        }
Пример #3
0
        //Save Tasks to the database to the Tasks table
        public static void SaveTaskForLoggedInUser(TaskViewModel taskViewModel, string userId)
        {
            var regionName        = Denmark_addressess.GetMunicipalityCode(taskViewModel.ClientStreetName, taskViewModel.ClientPostCode.ToString(), taskViewModel.ClientHouseNumber, taskViewModel.ClientCity);
            MitBudDBEntities db   = new MitBudDBEntities();
            Task             Task = new Task();

            Task.Title             = taskViewModel.Title;
            Task.Client_id         = userId;
            Task.Description       = taskViewModel.Description;
            Task.Category          = taskViewModel.Category;
            Task.ClientName        = taskViewModel.ClientName;
            Task.ClientStreetName  = taskViewModel.ClientStreetName;
            Task.ClientHouseNumber = taskViewModel.ClientHouseNumber;
            Task.ClientPostCode    = taskViewModel.ClientPostCode;
            Task.Region            = regionName;
            Task.ClientCity        = taskViewModel.ClientCity;
            Task.ClientTelephone   = taskViewModel.ClientTelephone;
            Task.ClientEmail       = taskViewModel.ClientEmail;
            Task.WhoAreYou         = taskViewModel.WhoAreYou;
            Task.TaskCost          = taskViewModel.TaskCost;
            Task.Date        = taskViewModel.Date;
            Task.DesiredDate = taskViewModel.DesiredDate;
            Task.Image       = taskViewModel.Image;
            Task.Status      = taskViewModel.Status;
            db.Tasks.Add(Task);
            db.SaveChanges();
        }
        public static void updateCredit(int?credit, string UserId)
        {
            MitBudDBEntities db = new MitBudDBEntities();
            //Company company = new Company();
            var findCompanyCredit = db.Companies.Where(x => x.UserId == UserId).SingleOrDefault();

            findCompanyCredit.CompanyCredit = credit;
            db.SaveChanges();
        }
Пример #5
0
        public static void SaveCategory(RegisterCompany registerViewModel, string UserId)
        {
            MitBudDBEntities db = new MitBudDBEntities();
            Company_Category company_category = new Company_Category();

            company_category.CompanyUserId = UserId;
            company_category.Name          = registerViewModel.Category;

            db.Company_Category.Add(company_category);
            db.SaveChanges();
        }
Пример #6
0
        public static void SaveClientInfo(RegisterClient registerViewModel, string UserId)
        {
            MitBudDBEntities db     = new MitBudDBEntities();
            Client           client = new Client();

            client.Client_Id = UserId;
            client.Name      = registerViewModel.Name;
            client.Email     = registerViewModel.Email;

            db.Clients.Add(client);
            db.SaveChanges();
        }
Пример #7
0
        public static void SaveConversation(ConversationViewModel conversation, string UserId)
        {
            MitBudDBEntities db   = new MitBudDBEntities();
            Task             task = new Task();
            Conversation     con  = new Conversation();

            con.Company_Id = UserId;
            con.Message    = conversation.Message;
            con.Client_Id  = conversation.Client_id;
            db.Conversations.Add(con);
            db.SaveChanges();
        }
Пример #8
0
        public static void SaveTaskStatus(int TaskId, string userId, int?status)
        {
            MitBudDBEntities db = new MitBudDBEntities();


            var findTaskId = db.Tasks.Where(x => x.TaskId == TaskId).SingleOrDefault();

            //Task task = new Task();
            findTaskId.Status = status;
            // db.Tasks.Add(task);
            db.SaveChanges();
        }
Пример #9
0
        public static void SaveCompanyInfo(RegisterCompany registerViewModel, string UserId)
        {
            MitBudDBEntities db      = new MitBudDBEntities();
            Company          company = new Company();

            company.UserId        = UserId;
            company.CompanyName   = registerViewModel.CompanyName;
            company.Telephone     = registerViewModel.Telephone;
            company.CompanySize   = registerViewModel.CompanySize;
            company.City          = registerViewModel.City;
            company.CVR           = registerViewModel.CVR;
            company.Email         = registerViewModel.Email;
            company.ContactPerson = registerViewModel.ContactPerson;
            company.Address       = registerViewModel.Address;
            company.PostCode      = registerViewModel.PostCode;
            db.Companies.Add(company);
            db.SaveChanges();
        }
Пример #10
0
        //Save Tasks to the database to the Tasks table
        //public  static void SaveTask(TaskViewModel TaskViewModel)
        //{
        //    MitBudDBEntities db = new MitBudDBEntities();
        //    AspNetUser asp = new AspNetUser();
        //    Task Task = new Task();
        //    AccountController account = new AccountController();

        //    RegisterClient r = new RegisterClient();
        //    var s = r;
        //    s.Name = TaskViewModel.ClientName;
        //    s.Email = TaskViewModel.ClientEmail;
        //    s.Password = "******";
        //    s.ConfirmPassword = "******";
        //    account.Register_client(r);



        //    Task.Title = TaskViewModel.Title;


        //    Task.Description = TaskViewModel.Description;
        //    Task.Category = TaskViewModel.Category;
        //    Task.ClientName = TaskViewModel.ClientName;
        //    Task.ClientAddress = TaskViewModel.ClientName;
        //    Task.ClientPostCode = TaskViewModel.ClientPostCode;
        //    Task.ClientTelephone = TaskViewModel.ClientTelephone;
        //    Task.ClientEmail = TaskViewModel.ClientEmail;
        //    Task.WhoAreYou = TaskViewModel.WhoAreYou;
        //    Task.TaskCost = TaskViewModel.TaskCost;
        //    db.Tasks.Add(Task);
        //    db.SaveChanges();


        //}

        //public string codd(string a)
        //{
        //    return a;
        //}
        public static void SaveTask(TaskViewModel TaskViewModel)
        {
            AccountController account = new AccountController();
            var randomPass            = GenerateRandomPassword();


            RegisterClient r = new RegisterClient();
            var            s = r;

            s.Email           = TaskViewModel.ClientEmail;
            s.Name            = TaskViewModel.ClientName;
            s.Password        = randomPass;
            s.ConfirmPassword = randomPass;


            account.Register_client(r);



            MitBudDBEntities db   = new MitBudDBEntities();
            Task             Task = new Task();

            Task.Title           = TaskViewModel.Title;
            Task.Description     = TaskViewModel.Description;
            Task.Category        = TaskViewModel.Category;
            Task.ClientName      = TaskViewModel.ClientName;
            Task.ClientAddress   = TaskViewModel.ClientName;
            Task.ClientPostCode  = TaskViewModel.ClientPostCode;
            Task.ClientTelephone = TaskViewModel.ClientTelephone;
            Task.ClientEmail     = TaskViewModel.ClientEmail;
            Task.WhoAreYou       = TaskViewModel.WhoAreYou;
            Task.TaskCost        = TaskViewModel.TaskCost;
            db.Tasks.Add(Task);
            db.SaveChanges();


            // SendPasswordResetEmail(TaskViewModel.ClientEmail, TaskViewModel.ClientName);


            //ChangePasswordBindingModel ch = new ChangePasswordBindingModel();
            //ch.OldPassword = randomPass;
        }
Пример #11
0
        //Save Tasks to the database to the Tasks table
        public static void SaveTaskLoggedIn(TaskViewModel TaskViewModel, string userId)
        {
            GenerateRandomPassword();
            MitBudDBEntities db   = new MitBudDBEntities();
            Task             Task = new Task();

            Task.Title           = TaskViewModel.Title;
            Task.Client_id       = userId;
            Task.Description     = TaskViewModel.Description;
            Task.Category        = TaskViewModel.Category;
            Task.ClientName      = TaskViewModel.ClientName;
            Task.ClientAddress   = TaskViewModel.ClientName;
            Task.ClientPostCode  = TaskViewModel.ClientPostCode;
            Task.ClientTelephone = TaskViewModel.ClientTelephone;
            Task.ClientEmail     = TaskViewModel.ClientEmail;
            Task.WhoAreYou       = TaskViewModel.WhoAreYou;
            Task.TaskCost        = TaskViewModel.TaskCost;
            db.Tasks.Add(Task);
            db.SaveChanges();
        }