Exemple #1
0
        public void Open()
        {
            VideoOS.Platform.SDK.Environment.Initialize();
            VideoOS.Platform.SDK.Environment.AddServer(_uri, _cc);
            VideoOS.Platform.SDK.Environment.Login(_uri);
            _loginSettings = LoginSettingsCache.GetLoginSettings(_uri.Host, _uri.Port);
            CurrentSite    = MasterSite;
            if (!IncludeChildSites)
            {
                return;
            }

            var stack = new Stack <Item>(MasterSite.GetChildren());

            while (stack.Count > 0)
            {
                var item = stack.Pop();
                AddSite(item.FQID.ServerId.Uri);
                item.GetChildren().ForEach(stack.Push);
            }
        }
        public ActionResult AddEmployee(MasterSiteViewModel local)
        {
            var place = _context.SiteAdmin.SingleOrDefault(m => m.Placeid == local.Placeid);

            if (place == null)
            {
                return(HttpNotFound("Please Contact Admin"));
            }



            if (!ModelState.IsValid)
            {
                var subContracts   = _context.Sub.Where(m => m.PlaceId == place.Placeid).ToList();
                var listselectitem = new List <SelectListItem>();
                if (subContracts == null)
                {
                    ;
                }
                {
                    // listselectitem.Add(new SelectListItem{Value = "0",Text="Only Direct Employee No Subcontracators available"});
                }
                foreach (var sub in subContracts)
                {
                    listselectitem.Add(new SelectListItem {
                        Value = sub.SubContractId.ToString(), Text = sub.SubContractorName
                    });
                }
                listselectitem.Add(new SelectListItem {
                    Value = "0", Text = "Direct"
                });


                var master = new MasterSiteViewModel()
                {
                    name          = "",
                    Design        = "",
                    SubContractor = listselectitem,
                    esielig       = true,
                    pfelig        = true,
                    Placeid       = (int)place.Placeid
                };

                return(View("AddlocalEmployee", master));
            }



            var max = _context.Master.OrderByDescending(m => m.Id).FirstOrDefault();

            if (max == null)
            {
                return(HttpNotFound("Please Contact Admin Max"));
            }
            int newId = max.EmpId + 1;

            var newEmployee = new MasterSite()
            {
                EmpId        = newId,
                placeid      = local.Placeid.ToString(),
                name         = local.name,
                Design       = local.Design,
                perdaysalary = local.perdaysalary,
                otpperhour   = local.otpperhour,
                pfuan        = local.pfuan,
                dob          = local.dob.ToShortDateString(),
                fname        = local.fname,
                bankacno     = local.bankacno,
                BankName     = local.BankName,
                esicode      = local.esicode,
                ifsccode     = local.ifsccode,
                address      = local.address,
                state        = local.state,
                pincode      = local.pincode,
                phoneno      = local.phoneno,
                emailId      = local.emailId,
                aadharno     = local.aadharno,
                panno        = local.panno,
                doj          = local.doj.ToShortDateString(),
                SUBID        = local.SubId,
                pfelig       = local.pfelig,
                esielig      = local.esielig,
                misc         = local.misc,
                pfMemberId   = local.pfmember,
            };

            _context.Master.Add(newEmployee);
            _context.SaveChanges();

            return(RedirectToAction("ShowEmployees", "Admin", new{ id = local.Placeid }));
        }