Example #1
0
        public ActionResult InsertStaff(SA_User entity, int count)
        {
            string quHao = _xinZhengQuYuService.GetByAreaName(entity.City).QuHao;//).QuHao;
            string city  = GetOrganizationAreaPath().Substring(GetOrganizationAreaPath().LastIndexOf("/") + 1);

            if (ModelState.IsValid)
            {
                for (int i = 0; i < count; i++)
                {
                    entity.CreatedBy   = GetCurrentUserName();
                    entity.CreatedDate = DateTime.Today;
                    string xuLieHao = quHao + RandomNumber.GetRnd(5, true, true, false, false);
                    entity.Account  = xuLieHao;
                    entity.Name     = xuLieHao;
                    entity.City     = city;
                    entity.Password = entity.Password ?? "123456";
                    _service.AddUser(entity);
                    _service.Save();
                }


                var parentNode = this.GetCmp <TreePanel>("treePanelSAOrganization").GetNodeById(entity.MainOrgId);
                parentNode.Set("leaf", false);
                parentNode.Reload();
                parentNode.ExpandChildren(true);
                this.GetCmp <Window>("windowSA_User").Hide();
                //this.GetCmp<Window>("windowSA_Organization").Hide();
                //this.GetCmp<Store>("storeSAOrganization").Reload();

                return(this.Direct());
            }
            return(this.Direct());
        }