示例#1
0
 public ActionResult IdentityMaster(IdentityMasters objMaster)
 {
     if (ModelState.IsValid)
     {
         tblIdentityMaster master = new tblIdentityMaster();
         master.ProofName    = objMaster.ProofName;
         master.ProofCode    = objMaster.ProofCode;
         master.CreatedDate  = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
         master.ModifiedDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
         objAdminEnti.tblIdentityMasters.Add(master);
         objAdminEnti.SaveChanges();
         TempData["Success"] = "Id Proof added successfully.";
         return(RedirectToAction("IdentityMaster"));
     }
     return(View());
 }
示例#2
0
        public ActionResult AssetMaster(AssetMasters objMaster)
        {
            tblAssetDetail master = new tblAssetDetail();

            master.AssetTypeID       = objMaster.AssetTypeID;
            master.AssetCompanyID    = objMaster.AssetCompanyID;
            master.AssetModelName    = objMaster.AssetModelName;
            master.ManufacturingDate = objMaster.ManufacturingDate;
            master.ExpiryDate        = objMaster.ExpiryDate;
            master.LicesenceNo       = objMaster.LicesenceNo;
            master.CreatedDate       = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
            master.ModifiedDate      = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
            master.CreatedBy         = "admin";
            objAdminEnti.tblAssetDetails.Add(master);
            objAdminEnti.SaveChanges();
            TempData["Success"] = "Asset added successfully.";
            return(RedirectToAction("AssetMaster"));
        }
示例#3
0
        public ActionResult EmployeeMaster(EmployeeMasters objMaster)
        {
            tblEmployeeDetail master = new tblEmployeeDetail();

            master.EmpName          = objMaster.EmpName;
            master.EmpCode          = objMaster.EmpCode;
            master.EmpDesignationID = objMaster.EmpDesignationID;
            master.EmpDept          = objMaster.EmpDept;
            master.PhoneNo          = objMaster.PhoneNo;
            master.CreatedDate      = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
            master.ModifiedDate     = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
            master.IsActive         = true;
            objAdminEnti.tblEmployeeDetails.Add(master);
            objAdminEnti.SaveChanges();
            TempData["Success"] = "Employee added successfully.";
            return(RedirectToAction("EmployeeMaster"));

            // return View();
        }
示例#4
0
        public Boolean ReturnPass(string id)
        {
            var result = objVisEnti.tblVisitorVisitDetails.SingleOrDefault(b => b.GovIdNo == id);

            if (result != null)
            {
                result.IsPassReturned = true;
                objVisEnti.SaveChanges();
                TempData["SuccessReturn"] = "Pass returned successfully";
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        public Boolean SubmitAsset(int id)
        {
            var result   = objVisEnti.tblAssetIssueDetails.SingleOrDefault(b => b.AssetId == id);
            var assetTbl = objVisEnti.tblAssetDetails.SingleOrDefault(b => b.ID == id);

            if (result != null)
            {
                result.IsSubmited          = true;
                result.AssetSubmitDateTime = DateTime.Now;
                if (assetTbl != null)
                {
                    assetTbl.IsIssued = false;
                }
                objVisEnti.SaveChanges();
                TempData["SuccessSubmit"] = "Asset Submitted successfully";
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public ActionResult CreateVisitor(clsVisitor objVisitor)
 {
     try
     {
         if (Session["CapturedImage"].ToString() != null)
         {
             // TODO: Add insert logic here
             if (ModelState.IsValid)
             {
                 tblVisitor dbVis = new tblVisitor();
                 dbVis.VisitorId   = objVisitor.VisitorId;
                 dbVis.Name        = objVisitor.Name.ToUpper();
                 dbVis.EmailId     = objVisitor.Email;
                 dbVis.MobileNo    = objVisitor.MobileNo.ToString();
                 dbVis.AssetId     = objVisitor.AssetId.ToString();
                 dbVis.Form        = objVisitor.Form;
                 dbVis.ToMeet      = objVisitor.ToMeet;
                 dbVis.SubLocation = objVisitor.SubLocation;
                 dbVis.Building    = objVisitor.Building;
                 dbVis.Gate        = objVisitor.Gate;
                 dbVis.Purpose     = objVisitor.Purpose;
                 dbVis.TimeIn      = objVisitor.TimeIn.ToString();
                 dbVis.ValidUpto   = objVisitor.ValidUpto.ToString();
                 dbVis.Remark      = objVisitor.Remark;
                 dbVis.ImagePath   = Session["CapturedImage"].ToString();
                 dbVis.GovId       = objVisitor.GovId.ToString();
                 dbVis.DOB         = objVisitor.DOB.ToString();
                 dbVis.CreatedBy   = objVisitor.CreatedBy;
                 dbVis.CreatedDate = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                 objVisEnti.tblVisitors.Add(dbVis);
                 objVisEnti.SaveChanges();
                 TempData["Success"] = "Visitor added Successfully!";
                 return(RedirectToAction("PrintPass", new { id = dbVis.Id }));
             }
             else
             {
                 return(View(objVisitor));
             }
         }
         else
         {
             TempData["Success"] = "please take Photo first!";
             return(View(objVisitor));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Save" + ex.Message);
         return(View(objVisitor));
     }
     //catch (DbEntityValidationException e)
     //{
     //    foreach (var eve in e.EntityValidationErrors)
     //    {
     //        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
     //            eve.Entry.Entity.GetType().Name, eve.Entry.State);
     //        foreach (var ve in eve.ValidationErrors)
     //        {
     //            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
     //                ve.PropertyName, ve.ErrorMessage);
     //        }
     //    }
     //    throw;
     //}
 }