Exemplo n.º 1
0
        public static Org Get(OrgType type)
        {
            Org org = null;

            _roots.TryGetValue(type, out org);
            return(org);
        }
Exemplo n.º 2
0
 public static void Add(OrgType type, Org org)
 {
     lock (_lock)
     {
         _roots.Add(type, org);
     }
 }
Exemplo n.º 3
0
 public IList <Org> GetChildOrgs(string orgId, OrgType type)
 {
     return((IList <Org>)CacheHelper.Get("GetChildOrgs_" + orgId + "_" + type.ToString(), () =>
     {
         return Config.Logic.OrgService.GetChildOrgs(orgId, type);
     }));
 }
Exemplo n.º 4
0
 public static Type ExtAttrType(OrgType type)
 {
     OrgTypeInfo typeInfo = null;
     if (_registry.TryGetValue(type, out typeInfo))
         return typeInfo.ExtAttrType;
     return null;
 }
Exemplo n.º 5
0
        private bool SignIn(string name, string pwd, string orgId, OrgType orgType)
        {
            NCI_User user = null;

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pwd) && UserCheck(name, pwd, orgId, orgType, ref user))
            {
                IAuthenticationService authenticationService = IOCContainer.Instance.Resolve <IAuthenticationService>();
                ClientUserData         clientUserData        = new ClientUserData()
                {
                    UserId    = user.UserId,
                    UserIdInt = user.UserId,
                    Account   = user.Account,
                    UserName  = user.UserName,
                    OrgId     = orgId,// 超级管理员可能登陆进入不同Org, 因此这里用登陆选择的ORG.
                    RoleType  = user.RoleType,
                    OrgType   = (int)orgType,
                    RoleId    = user.RoleId,
                    LoginName = user.Account,
                    GovId     = user.BelongToGovId
                };
                authenticationService.SignIn(clientUserData, true);
                return(true);
            }

            return(false);
        }
Exemplo n.º 6
0
 public StringGuidListResult GetTypeAssessmentSets(
     Guid SessionID,
     OrgType type)
 {
     lock ((object)this._AssessmentsClient)
         return(this.AssessmentsClient.GetTypeAssessmentSets(SessionID, type));
 }
Exemplo n.º 7
0
        public IEnumerable <StudentDrillDownQuery> GetStudentMultipleEnrollmentsDrilldownData(
            IOdsDataService odsDataService,
            OrgType orgType,
            int?schoolId,
            int edOrgId,
            int drillDownColumnIndex,
            string fourDigitSchoolYear)
        {
            var cacheKey = $"GetStudentMultipleEnrollmentsDrilldownData_{orgType}_{schoolId}_{edOrgId}_{drillDownColumnIndex}_{fourDigitSchoolYear}";

            lock (LockObject)
            {
                // if (!Cache.Contains(cacheKey))
                {
                    var results = odsDataService.GetMultipleEnrollmentStudentDrillDown(
                        orgType,
                        schoolId,
                        edOrgId,
                        drillDownColumnIndex,
                        fourDigitSchoolYear);

                    Cache.Add(cacheKey, results, CacheExpirationOffset);
                }

                return(Cache.Get(cacheKey) as IEnumerable <StudentDrillDownQuery>);
            }
        }
Exemplo n.º 8
0
 public static void Add(OrgType type, Org org)
 {
     lock (_lock)
     {
         _roots.Add(type, org);
     }
 }
Exemplo n.º 9
0
 public static bool HasExtAttr(OrgType type)
 {
     OrgTypeInfo typeInfo = null;
     if (_registry.TryGetValue(type, out typeInfo))
         return typeInfo.HasExtAttr;
     return false;
 }
Exemplo n.º 10
0
        public ActionResult DeleteConfirmed(int id)
        {
            OrgType orgType = db.OrgType.Find(id);

            db.OrgType.Remove(orgType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 11
0
 public GetAssessmentDetailsResult GetAssessmentDetails(
     Guid SessionID,
     Guid id,
     OrgType type)
 {
     lock ((object)this._AssessmentsClient)
         return(this.AssessmentsClient.GetAssessmentDetails(SessionID, id, type));
 }
Exemplo n.º 12
0
 public AssessmentSetHistoryResult GetAssessmentSetHistory(
     Guid SessionID,
     Guid objectid,
     OrgType type)
 {
     lock ((object)this._AssessmentsClient)
         return(this.AssessmentsClient.GetAssessmentSetHistory(SessionID, objectid, type));
 }
Exemplo n.º 13
0
        public void WhenICallTheAddOrgTypePostApiEndpointToAddAOrgTypeItChecksIfExistsPullsItemEditsItAndDeletesIt()
        {
            HttpResponseMessage response;

            _addItem = Add(_addItem, out response);

            Assert.IsNotNull(response);
            ScenarioContext.Current[AddItemKey] = response;
        }
Exemplo n.º 14
0
 public override void Load(System.Data.IDataRecord record)
 {
     Id    = record.GetInt32(0);
     OKPO  = record.GetString(1);
     SOATO = record.GetString(2);
     INN   = record.GetString(3);
     Name  = record.GetString(4);
     Type  = (OrgType)record.GetByte(5);
 }
Exemplo n.º 15
0
 public override void Load(System.Data.IDataRecord record)
 {
     Id = record.GetInt32(0);
     OKPO = record.GetString(1);
     SOATO = record.GetString(2);
     INN = record.GetString(3);
     Name = record.GetString(4);
     Type = (OrgType)record.GetByte(5);
 }
Exemplo n.º 16
0
        protected override int GetOrganizationIdAdditional(OrgType organizationType, int importOrganizationId)
        {
            if (organizationType == OrgType.ResourceProvider &&
                this.existingPublicServiceOrgs.Contains(importOrganizationId))
            {
                return(importOrganizationId);
            }

            return(0);
        }
Exemplo n.º 17
0
 public ActionResult Edit([Bind(Include = "Id,NmOrgType,Description")] OrgType orgType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orgType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(orgType));
 }
Exemplo n.º 18
0
        public static bool HasExtAttr(OrgType type)
        {
            OrgTypeInfo typeInfo = null;

            if (_registry.TryGetValue(type, out typeInfo))
            {
                return(typeInfo.HasExtAttr);
            }
            return(false);
        }
Exemplo n.º 19
0
        public static Type ExtAttrType(OrgType type)
        {
            OrgTypeInfo typeInfo = null;

            if (_registry.TryGetValue(type, out typeInfo))
            {
                return(typeInfo.ExtAttrType);
            }
            return(null);
        }
Exemplo n.º 20
0
        public List <StudentDrillDownQuery> GetMultipleEnrollmentStudentDrillDown(
            OrgType orgType,
            int?schoolEdOrgId,
            int?districtEdOrgId,
            int?columnIndex,
            string fourDigitOdsDbYear)
        {
            var returnedList = new List <StudentDrillDownQuery>();

            using (var rawOdsContext = new RawOdsDbContext(fourDigitOdsDbYear))
            {
                var conn = rawOdsContext.Database.Connection;
                try
                {
                    conn.Open();
                    var queryCmd = conn.CreateCommand();
                    queryCmd.CommandType = System.Data.CommandType.StoredProcedure;
                    queryCmd.CommandText = MultipleEnrollmentsCountReportQuery.MultipleEnrollmentsStudentDetailsQuery;

                    queryCmd.Parameters.Add(new SqlParameter("@schoolid", System.Data.SqlDbType.Int));
                    queryCmd.Parameters["@schoolid"].Value = schoolEdOrgId.HasValue &&
                                                             orgType == OrgType.School ? schoolEdOrgId.Value : (object)DBNull.Value;

                    queryCmd.Parameters.Add(new SqlParameter("@distid", System.Data.SqlDbType.Int));
                    queryCmd.Parameters["@distid"].Value = districtEdOrgId.HasValue &&
                                                           (orgType == OrgType.District || orgType == OrgType.School) ? districtEdOrgId.Value : (object)DBNull.Value;

                    queryCmd.Parameters.Add(new SqlParameter("@columnIndex", System.Data.SqlDbType.Int));
                    queryCmd.Parameters["@columnIndex"].Value = columnIndex ?? (object)DBNull.Value;

                    using (var reader = queryCmd.ExecuteReader())
                    {
                        returnedList = ReadStudentDrillDownDataReader(reader);
                    }

                    return(returnedList);
                }
                catch (Exception ex)
                {
                    LoggingService.LogErrorMessage($"While providing student details on multiple enrollments: {ex.ChainInnerExceptionMessages()}");
                    throw;
                }
                finally
                {
                    if (conn != null && conn.State != System.Data.ConnectionState.Closed)
                    {
                        try
                        {
                            conn.Close();
                        }
                        catch (Exception) { }
                    }
                }
            }
        }
Exemplo n.º 21
0
        public ActionResult Create([Bind(Include = "Id,NmOrgType,Description")] OrgType orgType)
        {
            if (ModelState.IsValid)
            {
                db.OrgType.Add(orgType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(orgType));
        }
Exemplo n.º 22
0
        private static Org LoadTree(ISession session, OrgType type)
        {
            Org root = Root(session, type);

            if (root == null)
            {
                return(null);
            }
            LoadTree(session, root);
            return(root);
        }
Exemplo n.º 23
0
        public static void DeleteOrg(ISession session, OrgType type, int id)
        {
            Org org = Org.Get(session, type, id);
            if (org == null) return;
            org.Deleted = true;
            org.Update(session, "Deleted");

            Org parent = Org.Get(session, type, org.ParentId);
            if (parent == null) return;
            parent.RemoveChild(org);
        }
Exemplo n.º 24
0
 public OrgnizationSystem(string name, string abv, string orgnum, DOBSystem dob, OrgType type, List <ServerSystem> server)
 {
     Name         = name;
     Abv          = abv;
     ORGNum       = orgnum;
     FoundingDate = dob;
     Type         = type;
     Server       = server;
     //Month = month;
     //Year = year;
     //Age = age;
 }
Exemplo n.º 25
0
        public OrgType PostSave(OrgType orgtype)
        {
            if (orgtype.Id > 0)
            {
                DbService.db().Update(orgtype);
            }
            else
            {
                DbService.db().Save(orgtype);
            }

            return(orgtype);
        }
Exemplo n.º 26
0
        public static HG_OrderItem PaybleAmt(Int64 OID)
        {
            HG_OrderItem objOrdItm = new HG_OrderItem();
            var          OrderItms = new HG_OrderItem().GetAll(OID);

            for (int i = 0; i < OrderItms.Count; i++)
            {
                objOrdItm.CostPrice += OrderItms[i].Count * OrderItms[i].CostPrice;
                objOrdItm.TaxInItm  += OrgType.TotalTax(OrderItms[i].CostPrice, OrderItms[i].TaxInItm, OrderItms[i].Count);
                objOrdItm.Price     += OrderItms[i].Count * OrderItms[i].Price;
            }
            return(objOrdItm);
        }
Exemplo n.º 27
0
 public static IOrganization NewOrg(this IEntitySession session, OrgType orgType, string legalName, 
     string extendedName = null, string legalId = null, string dba = null)
 {
     Util.Check(!string.IsNullOrWhiteSpace(legalName), "LegalName may not be empty");
       var party = session.NewParty(PartyKind.Org, legalName);
       var org = session.NewEntity<IOrganization>();
       org.Party = party;
       org.OrgType = orgType;
       org.LegalName = legalName;
       org.ExtendedName = extendedName ?? legalName;
       org.DbaAlias = dba ?? legalName;
       org.LegalId = legalId;
       return org;
 }
Exemplo n.º 28
0
        // GET: OrgTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrgType orgType = db.OrgType.Find(id);

            if (orgType == null)
            {
                return(HttpNotFound());
            }
            return(View(orgType));
        }
Exemplo n.º 29
0
        public static HG_OrderItem ActualAmtToPay(Int64 OID)
        {
            HG_OrderItem objOrdItm = new HG_OrderItem();
            var          OrderItms = new HG_OrderItem().GetAll(OID);

            OrderItms = OrderItms.FindAll(x => x.Status != 4);
            for (int i = 0; i < OrderItms.Count; i++)
            {
                objOrdItm.CostPrice += OrderItms[i].Count * OrderItms[i].CostPrice;
                objOrdItm.TaxInItm  += OrgType.TotalTax(OrderItms[i].CostPrice, OrderItms[i].TaxInItm, OrderItms[i].Count);
                objOrdItm.Price     += OrderItms[i].Count * OrderItms[i].Price;
            }
            return(objOrdItm);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 获取整个Org树
        /// </summary>
        /// <param name="session"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static Org Get(ISession session, OrgType type)
        {
            Org root = OrgCache.Get(type);

            if (root == null)
            {
                root = LoadTree(session, type);
                if (root != null)
                {
                    OrgCache.Add(type, root);
                }
            }
            return(root);
        }
Exemplo n.º 31
0
        public static IOrganization NewOrg(this IEntitySession session, OrgType orgType, string legalName,
                                           string extendedName = null, string legalId = null, string dba = null)
        {
            Util.Check(!string.IsNullOrWhiteSpace(legalName), "LegalName may not be empty");
            var party = session.NewParty(PartyKind.Org, legalName);
            var org   = session.NewEntity <IOrganization>();

            org.Party        = party;
            org.OrgType      = orgType;
            org.LegalName    = legalName;
            org.ExtendedName = extendedName ?? legalName;
            org.DbaAlias     = dba ?? legalName;
            org.LegalId      = legalId;
            return(org);
        }
Exemplo n.º 32
0
        public static Org Root(ISession session, OrgType type)
        {
            IList <Org> list = session.CreateEntityQuery <Org>()
                               .Where(Exp.Eq("IsRoot", true) & Exp.Eq("OrgType", type) & Exp.NEq("Deleted", true))
                               .List <Org>();

            if (OrgTypeRegistry.HasExtAttr(type) && list.Count > 0)
            {
                foreach (Org o in list)
                {
                    //有问题,因为不会加载ExtAttr与Org的对应关系,但合作企业的根节点为虚拟节点,所以不会遇到
                    o.ExtAttr = EntityManager.Retrieve(session, OrgTypeRegistry.ExtAttrType(type), o.OrgId) as IOrgExtend;
                }
            }
            return(list.Count <= 0 ? null : list[0]);
        }
Exemplo n.º 33
0
 public async Task <List <QueryItem> > ListAllOrgByType(OrgType orgType)
 {
     return(await WithConnection(async c =>
     {
         var result = await c.QueryAsync <QueryItem>(
             "SELECT id,name FROM org_tree where node_type=@type and is_del=@IsDel",
             new { type = orgType, IsDel = IsDeleted.no });
         if (result.Count() > 0)
         {
             return result.ToList();
         }
         else
         {
             return new List <QueryItem>();
         }
     }));
 }
Exemplo n.º 34
0
        public void ThenTheAddResultShouldBeAOrgTypeIdCheckExistsGetByIdEditAndDeleteWithHttpResponseReturns()
        {
            //did we get a good result
            Assert.IsTrue(_addItem != null && _addItem.Id > 0);

            //set the returned AddID to current Get
            _addedIdValue  = _addItem.Id;
            _getIdValue    = _addedIdValue;
            _existsIdValue = _getIdValue;

            //check that the item exists
            var itemReturned = Exists(_existsIdValue);

            Assert.IsTrue(itemReturned);

            //use the value used in exists check
            _getIdValue = _addItem.Id;
            Assert.IsTrue(_getIdValue == _addedIdValue);

            //pull the item by Id
            var resultGet = GetById <OrgType>(_getIdValue);

            Assert.IsNotNull(resultGet);
            _getIdValue = resultGet.Id;
            Assert.IsTrue(_getIdValue == _addedIdValue);

            //Now, let's Edit the newly added item
            _editIdValue = _getIdValue;
            _editItem    = resultGet;
            Assert.IsTrue(_editIdValue == _addedIdValue);

            //do an update
            var updateResponse = Update(_editIdValue, _editItem);

            Assert.IsNotNull(updateResponse);

            //pass the item just updated
            _deletedIdValue = _editIdValue;
            Assert.IsTrue(_deletedIdValue == _addedIdValue);

            //delete this same item
            var deleteResponse = Delete(_deletedIdValue);

            Assert.IsNotNull(deleteResponse);
        }
Exemplo n.º 35
0
 public ActionResult Create(OrgType orgType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.OrgTypes.Add(orgType);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(orgType));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(View(orgType));
     }
 }
Exemplo n.º 36
0
 public ActionResult Edit(OrgType orgType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(orgType).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(orgType));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(Redirect("~/ErrorHandler.html"));
     }
 }
Exemplo n.º 37
0
 public OrgTypeInfo(OrgType orgType, Type type, bool hasExtAttr)
 {
     this.OrgType = orgType;
     this.ExtAttrType = type;
     this.HasExtAttr = hasExtAttr;
 }
Exemplo n.º 38
0
 protected virtual int GetOrganizationIdAdditional(OrgType organizationType, int importOrganizationId)
 {
     return 0;
 }
Exemplo n.º 39
0
 /// <summary>
 /// 获取某个Org节点
 /// </summary>
 /// <param name="session"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static Org Get(ISession session, OrgType type, int id)
 {
     return FindInTree(Org.Get(session, type), id);
 }
Exemplo n.º 40
0
 public static SimpleJson GetOrgJSON(ISession session, OrgType type, int orgId)
 {
     return GetOrgJSON(session, Org.Get(session, type, orgId));
 }
Exemplo n.º 41
0
 public static Org Root(ISession session, OrgType type)
 {
     IList<Org> list = session.CreateEntityQuery<Org>()
         .Where(Exp.Eq("IsRoot", true) & Exp.Eq("OrgType", type) & Exp.NEq("Deleted", true))
         .List<Org>();
     if (OrgTypeRegistry.HasExtAttr(type) && list.Count > 0)
         foreach (Org o in list)
             //有问题,因为不会加载ExtAttr与Org的对应关系,但合作企业的根节点为虚拟节点,所以不会遇到
             o.ExtAttr = EntityManager.Retrieve(session, OrgTypeRegistry.ExtAttrType(type), o.OrgId) as IOrgExtend;
     return list.Count <= 0 ? null : list[0];
 }
Exemplo n.º 42
0
        protected override int GetOrganizationIdAdditional(OrgType organizationType, int importOrganizationId)
        {
            if (organizationType == OrgType.ResourceProvider
                && this.existingPublicServiceOrgs.Contains(importOrganizationId))
            {
                return importOrganizationId;
            }

            return 0;
        }
Exemplo n.º 43
0
        private int GetOrganizationId(OrgType organizationType, int importOrganizationId)
        {
            var organizationId = 0;

            switch (organizationType)
            {
                case OrgType.ManagingOrganization:
                    if (this.existingManagingOrganizations.Contains(importOrganizationId))
                    {
                        organizationId = importOrganizationId;
                    }

                    break;

                case OrgType.CommunalServiceProvider:
                    if (this.existingSupplyResOranizationsg.Contains(importOrganizationId))
                    {
                        organizationId = importOrganizationId;
                    }

                    break;

                case OrgType.HousingServiceProvider:
                    if (this.existingServiceOrganizations.Contains(importOrganizationId))
                    {
                        organizationId = importOrganizationId;
                    }

                    break;

                default:
                    organizationId = GetOrganizationIdAdditional(organizationType, importOrganizationId);
                    break;
            }

            return organizationId;
        }
Exemplo n.º 44
0
        public static SimpleJson SaveOrg(ISession session, Org org, OrgType type, string action, User oper)
        {
            Org original = null;
            switch (action)
            {
                case "create":
                    Org parent = Org.Get(session, type, org.ParentId);
                    if (parent == null) return new SimpleJson().HandleError(string.Format("父节点{0}不存在", org.ParentId));

                    org.CreateBy = oper.UserId;
                    org.CreateDate = DateTime.Now;
                    org.IsVirtual = false;
                    org.IsRoot = false;
                    org.OrgType = type;
                    org.Deleted = false;
                    org.OrgSeq = org.OrgSeq <= 0 ? (short)(Org.MaxSeq(session, org.ParentId) + 1) : org.OrgSeq;
                    org.Create(session);

                    if (OrgTypeRegistry.HasExtAttr(type) && org.ExtAttr != null)
                    {
                        IOrgExtend oext = org.ExtAttr as IOrgExtend;
                        oext.OrgId = org.OrgId;
                        oext.Create(session);
                    }

                    parent.AddChild(org);
                    Org.SortOrg(parent, org);
                    return Org.GetOrgJSON(session, org);
                case "update":
                    original = Org.Get(session, type, org.OrgId);
                    if (original == null) return new SimpleJson().HandleError(string.Format("{0}不存在", org.OrgId));
                    original.OrgCode = org.OrgCode;
                    original.OrgName = org.OrgName;
                    original.Description = org.Description;
                    original.ModifyBy = oper.UserId;
                    original.ModifyDate = DateTime.Now;
                    original.OrgSeq = org.OrgSeq;
                    original.Manager = org.Manager;
                    original.Update(session, "OrgCode", "OrgName", "Description", "ModifyBy", "ModifyDate", "OrgSeq", "Manager");

                    if (OrgTypeRegistry.HasExtAttr(type) && org.ExtAttr != null)
                    {
                        IOrgExtend oext = org.ExtAttr as IOrgExtend;
                        oext.OrgId = org.OrgId;
                        oext.Update(session);
                        original.ExtAttr = oext;
                    }

                    Org.SortOrg(Org.Get(session, type, original.ParentId), original);
                    return Org.GetOrgJSON(session, original);
                default:
                    return new SimpleJson().HandleError(string.Format("无效的操作{0}", action));
            }
        }
Exemplo n.º 45
0
 /// <summary>
 /// 获取整个Org树
 /// </summary>
 /// <param name="session"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static Org Get(ISession session, OrgType type)
 {
     Org root = OrgCache.Get(type);
     if (root == null)
     {
         root = LoadTree(session, type);
         if (root != null)
             OrgCache.Add(type, root);
     }
     return root;
 }
Exemplo n.º 46
0
 public static Org Get(OrgType type)
 {
     Org org = null;
     _roots.TryGetValue(type, out org);
     return org;
 }
Exemplo n.º 47
0
 private static Org LoadTree(ISession session, OrgType type)
 {
     Org root = Root(session, type);
     if (root == null) return null;
     LoadTree(session, root);
     return root;
 }