示例#1
0
        public async Task <IActionResult> PutSiteMasterTbl([FromRoute] long id, [FromBody] SiteMasterTbl siteMasterTbl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != siteMasterTbl.SiteId)
            {
                return(BadRequest());
            }

            _context.Entry(siteMasterTbl).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SiteMasterTblExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("Id,Availability,SparepartRequestId,WoId,WoDesc,Date,Status,SiteId,Qty,Notes")] SparepartRequestTbl sparepartRequestTbl)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sparepartRequestTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sparepartRequestTbl));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("Id,RequestId,RequestDesc,SiteId,LocationId,AssetId,AssetDesc,Date,Status")] WoRequestTbl woRequestTbl)
        {
            if (ModelState.IsValid)
            {
                _context.Add(woRequestTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(woRequestTbl));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("TechnicianId,TechnicianName,CreatedAtTech,ModifyAtTech")] TechnicianTbl technicianTbl)
        {
            if (ModelState.IsValid)
            {
                technicianTbl.CreatedAtTech = DateTime.Now;
                technicianTbl.ModifyAtTech  = DateTime.Now;
                _context.Add(technicianTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(technicianTbl));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("EntityId,SiteId,EntityCode,EntityName,CompanyName,Address,Contact,Pic,CreatedAtEntity,ModifyAtEntity,CreatedBy,ModifyBy")] EntityTbl entityTbl)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                entityTbl.EntityCode = idrunning;
                _context.Add(entityTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(entityTbl));
        }
示例#6
0
        public IActionResult signup(String aa, String bb, String cc, String dd, String ee, LoginTbl login)
        {
            byte[] salt = new byte[128 / 8];
            //using (var rng = RandomNumberGenerator.Create())
            //{
            //    rng.GetBytes(salt);
            //}
            //Console.WriteLine($"Salt: {Convert.ToBase64String(salt)}");

            // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations)
            string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
                                                       password: dd,
                                                       salt: salt,
                                                       prf: KeyDerivationPrf.HMACSHA1,
                                                       iterationCount: 10000,
                                                       numBytesRequested: 256 / 8));
            var a = hashed;

            login.name     = aa;
            login.Email    = bb;
            login.Username = cc;
            login.Pass     = a;
            login.type     = ee;

            if (ModelState.IsValid)
            {
                _db.Add(login);
                _db.SaveChangesAsync();
                //return RedirectToAction("Index", "Home");
                return(Json(new { success = true }));
            }
            return(View());
        }
示例#7
0
        public async Task <IActionResult> Create(AssetGroupTbl assetGroup)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                assetGroup.AssetGroupCode      = idrunning;
                assetGroup.CreatedAtAssetGroup = DateTime.Now;
                assetGroup.ModifyAtAssetGroup  = DateTime.Now;
                _db.Add(assetGroup);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(assetGroup));
        }
示例#8
0
        public async Task <IActionResult> Create([Bind("AssetId,AssetGroupId,SiteId,EntityId,AssetCode,AssetName,SerialNumber,ValidityDate,Location,Valuation,CreatedAtAsset,ModifyAtAsset")] AssetTbl assetTbl)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                assetTbl.AssetCode      = idrunning;
                assetTbl.CreatedAtAsset = DateTime.Now;
                assetTbl.ModifyAtAsset  = DateTime.Now;
                _context.Add(assetTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(assetTbl));
        }
示例#9
0
        public async Task <IActionResult> Create(SiteMasterTbl siteMaster)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                siteMaster.SiteCode      = idrunning;
                siteMaster.ModifyAtSite  = DateTime.Now;
                siteMaster.CreatedAtSite = DateTime.Now;
                _db.Add(siteMaster);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(siteMaster));
        }
示例#10
0
        public async Task <IActionResult> Create(TaskTbl taskTbl)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                taskTbl.TaskCode      = idrunning;
                taskTbl.Date          = DateTime.Now;
                taskTbl.CreatedAtTask = DateTime.Now;
                taskTbl.ModifyAtTask  = DateTime.Now;
                _db.Add(taskTbl);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(taskTbl));
        }
示例#11
0
        public async Task <IActionResult> Create([Bind("SupplierId,SupplierCode,Description,Address,Contact,ProductData,CreatedAtSupplier,ModifyAtSupplier")] SupplierTbl supplierTbl)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                supplierTbl.SupplierCode = idrunning;

                supplierTbl.CreatedAtSupplier = DateTime.Now;
                supplierTbl.ModifyAtSupplier  = DateTime.Now;

                _context.Add(supplierTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(supplierTbl));
        }
示例#12
0
        public async Task <IActionResult> Create(SiteMasterTbl siteMaster)
        {
            if (ModelState.IsValid)
            {
                siteMaster.ModifyAtSite  = DateTime.Now;
                siteMaster.CreatedAtSite = DateTime.Now;
                _db.Add(siteMaster);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(siteMaster));
        }
示例#13
0
        public async Task <IActionResult> Create(PeriodTbl period)
        {
            if (ModelState.IsValid)
            {
                period.CreatedAtPeriod = DateTime.Now;
                period.ModifyAtPeriod  = DateTime.Now;
                _db.Add(period);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(period));
        }
示例#14
0
        public async Task <IActionResult> Create(ScheduleMaintenanceTbl scheduleMaintenanceTbl)
        {
            var assetnamess = _context.AssetTbl.Where(x => x.AssetId == scheduleMaintenanceTbl.AssetId).First().AssetName;
            var period      = _context.PeriodTbl.Where(x => x.PeriodId == scheduleMaintenanceTbl.PeriodId).First().Days;


            if (ModelState.IsValid)
            {
                scheduleMaintenanceTbl.LastMaintenance = DateTime.Now;
                scheduleMaintenanceTbl.AssetName       = assetnamess;
                scheduleMaintenanceTbl.NextMaintenance = DateTime.Now.AddDays((double)period);
                //if(scheduleMaintenanceTbl.)
                //{

                //}
                //  scheduleMaintenanceTbl.LastEditedBy = DateTime.Now;
                _context.Add(scheduleMaintenanceTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(scheduleMaintenanceTbl));
        }
示例#15
0
        public async Task <IActionResult> Create(SparepartTbl sparepart)
        {
            if (ModelState.IsValid)
            {
                String idrunning = "";
                idrunning = generateRunningNumber(idrunning);

                sparepart.SparepartCode = idrunning;
                sparepart.CreatedAtSupp = DateTime.Now;
                sparepart.ModifyAtSupp  = DateTime.Now;
                _db.Add(sparepart);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sparepart));
        }