コード例 #1
0
        public ActionResult CheckSetup(T100 t)
        {
            if (!ModelState.IsValid)
            {
                return(View(t));
            }
            T100 NewT = db.T100.Find(t.Id);

            NewT.BankName        = t.BankName;
            NewT.BankInfo1       = t.BankInfo1;
            NewT.BankInfo2       = t.BankInfo2;
            NewT.BankInfo3       = t.BankInfo3;
            NewT.TransitCode     = t.TransitCode;
            NewT.BankRouteNo     = t.BankRouteNo;
            NewT.BankAccountNo   = t.BankAccountNo;
            NewT.BlankBankStock  = t.BlankBankStock;
            NewT.CurrentCheckNo  = t.CurrentCheckNo;
            NewT.OffsetLeft      = t.OffsetLeft;
            NewT.OffsetRight     = t.OffsetRight;
            NewT.OffsetUp        = t.OffsetUp;
            NewT.OffsetDown      = t.OffsetDown;
            NewT.ExField1        = t.ExField1;
            NewT.ExField2        = t.ExField2;
            NewT.Logo            = t.Logo;
            NewT.Signature       = t.Signature;
            NewT.Company1        = t.Company1;
            NewT.Company2        = t.Company2;
            NewT.Company3        = t.Company3;
            NewT.Company4        = t.Company4;
            db.Entry(NewT).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("CheckSetup"));
        }
コード例 #2
0
        public ActionResult CheckSetup()
        {
            AppUser user           = LoginUser;
            T100    model          = db.T100.Where(t => t.CompanyId == user.CompanyId).SingleOrDefault();
            int     CurrentCheckNo = 0;
            var     MaxList        = db.T105.Where(t => t.CompanyId == user.CompanyId).GroupBy(t => t.Id).Select(t => t.Max(x => x.CheckNo)).ToList();

            foreach (var m in MaxList)
            {
                CurrentCheckNo = m;
            }
            ;
            ViewBag.CurrentCheckNo = CurrentCheckNo;
            return(View(model));
        }
コード例 #3
0
ファイル: nullenum1000.cs プロジェクト: l1183479157/coreclr
 static bool Do100(T100 t) {
   Nullable<T100> n = new Nullable<T100>(t);
   return Ensure(n.HasValue && n.Value == t);
 }
コード例 #4
0
        public async Task <ActionResult> CompleteRegist(CompleteRegistModel viewModel)
        {
            // Ensure we have a valid viewModel to work with
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var user = await UserManager.FindByEmailAsync(viewModel.Email);

            if (user != null)
            {
                //user.EmailConfirmed = true;
                user.PayRollUser         = viewModel.FName + " " + viewModel.LName;
                user.UserName            = viewModel.Email;
                user.Company.ContactName = viewModel.FName + " " + viewModel.LName;
                user.LastLoginDate       = DateTime.UtcNow;
                //user.PasswordHash= UserManager.PasswordHasher.HashPassword(viewModel.Password);
                //var result2 = await UserManager.ConfirmEmailAsync(user.Id, viewModel.code);
                IdentityResult result = await UserManager.ConfirmEmailAsync(user.Id, viewModel.code);

                if (result.Succeeded)
                {
                    //await UserManager.ResetPasswordAsync(user.Id, viewModel.code, viewModel.Password);
                    var resultPW = await UserManager.ChangePasswordAsync(user.Id, "Pay123456", viewModel.Password);

                    if (!resultPW.Succeeded)
                    {
                        AddErrors(resultPW);
                        return(View(viewModel));
                    }
                    var resultUp = await UserManager.UpdateAsync(user);

                    if (resultUp.Succeeded)
                    {
                        Customer cus = new Customer()
                        {
                            Id           = Guid.NewGuid(),
                            CustomerName = "Default Customer",
                            AddDate      = DateTime.Now,
                            CompanyId    = user.CompanyId
                        };
                        db.Customer.Add(cus);
                        Job job = new Job()
                        {
                            JobName = "Default Job", status = "0", CompanyId = user.CompanyId, Customer = new List <Customer>()
                        };
                        db.Job.Add(job);
                        job.Customer.Add(cus);
                        db.SaveChanges();
                        Employee em = new Employee()
                        {
                            EmployeeId = Guid.NewGuid(),
                            Email      = user.Email,
                            Address1   = user.Company.Address1,
                            Address2   = user.Company.Address2,
                            State      = user.Company.State,
                            City       = user.Company.City,
                            DefaultJob = job.JobId,
                            TimeZone   = user.TimeZone,
                            ZipCode    = user.Company.Zip,
                            Phone      = viewModel.Telephone,
                            FName      = viewModel.FName,
                            LName      = viewModel.LName,
                            SSN        = viewModel.SSN,
                            UserRole   = "Admin",
                            F99        = 0,
                            F106       = "Single",
                            F114       = 1,
                            F115       = 1,
                            F116       = 1,
                            F117       = 1,
                            F118       = 1,
                            F119       = 1,
                            F124       = 0,
                            F103       = DateTime.UtcNow,
                            F104       = DateTime.UtcNow,
                            F105       = DateTime.UtcNow,
                            CompanyId  = user.CompanyId,
                            AppUserId  = user.Id,
                            Job        = new List <Job>()
                        };
                        db.Employee.Add(em);
                        em.Job.Add(job);

                        Company c = db.Company.Where(t => t.CompanyId == user.CompanyId).SingleOrDefault();
                        if (c != null)
                        {
                            c.ContactName = user.PayRollUser;
                            c.Status      = "0";
                        }
                        db.Entry <Company>(c).State = System.Data.Entity.EntityState.Modified;

                        T100 t100 = new T100
                        {
                            Id             = Guid.NewGuid(),
                            BankName       = "My Bank",
                            BankInfo1      = "Bank Road",
                            TransitCode    = "67-76890",
                            BankRouteNo    = "123456789",
                            BankAccountNo  = "0123456789",
                            StartCheckNo   = 100,
                            CurrentCheckNo = 1000,
                            CheckWidth     = 0,
                            CheckHeight    = 0,
                            OffsetLeft     = 0,
                            OffsetRight    = 0,
                            OffsetUp       = 0,
                            OffsetDown     = 0,
                            Logo           = "",
                            Signature      = "",
                            Company1       = c.CompanyName,
                            Company2       = c.Address1,
                            Company3       = c.City + ", " + c.State + " " + c.Zip,
                            Company4       = "(111) 111-1111",
                            BlankBankStock = false,
                            ExField1       = "Bottom",
                            ExField2       = false,
                            ExField3       = "",
                            nodisplaymicr  = false,
                            CompanyId      = c.CompanyId
                        };
                        db.T100.Add(t100);
                        db.SaveChanges();
                        //await SignInAsync(user, true);
                        await ApplicationSignInManager.PasswordSignInAsync(user.UserName, viewModel.Password, true, shouldLockout : false);

                        RollPayInitialize(db, user.CompanyId);
                        SignCookieAsync(user);
                        return(RedirectToLocal());
                    }
                    else
                    {
                        AddErrors(resultUp);
                        return(View(viewModel));
                    }
                }
                else
                {
                    AddErrors(result);
                    return(View(viewModel));
                }
            }
            return(View(viewModel));
        }