Пример #1
0
 public Organization(Micajah.Common.Bll.Organization org, Micajah.Common.Bll.InstanceCollection insts)
 {
     _innerOrganization = org;
     Instances          = new List <Instance>(insts.Count);
     foreach (Micajah.Common.Bll.Instance inst in insts)
     {
         Instances.Add(new Instance(inst));
     }
 }
Пример #2
0
        public Organization(Micajah.Common.Bll.Organization org, Micajah.Common.Bll.InstanceCollection insts)
        {
            _innerOrganization = org;
            var i = from element in insts
                    orderby element.Active
                    select element;

            Instances = new List <Instance>(insts.Count);
            foreach (Micajah.Common.Bll.Instance inst in i)
            {
                Instances.Add(new Instance(inst));
            }
        }
Пример #3
0
        private object DeleteOrganization(string id)
        {
            Micajah.Common.Bll.Organization org = null;
            Guid orgid = Guid.Empty;

            if (Guid.TryParseExact(id, "N", out orgid))
            {
                org = OrganizationProvider.GetOrganization(orgid);
            }
            else
            {
                org = OrganizationProvider.GetOrganizationByPseudoId(id);
            }
            if (org == null)
            {
                return(new HttpResult("Organization not found", HttpStatusCode.NotFound));
            }
            if (org.Deleted)
            {
                return(new HttpResult("Organization already inactive", HttpStatusCode.NotModified));
            }
            OrganizationProvider.DeleteOrganization(org.OrganizationId);
            return(new HttpResult("Organization " + org.Name + " deleted", HttpStatusCode.OK));
        }
Пример #4
0
 public Organization(Micajah.Common.Bll.Organization org, Micajah.Common.Bll.InstanceCollection insts)
 {
     _innerOrganization = org;
     Instances=new List<Instance>(insts.Count);
     foreach (Micajah.Common.Bll.Instance inst in insts) Instances.Add(new Instance(inst));
 }
Пример #5
0
        public virtual bool InactivateLogin
        (
            int UId,
            int DId,
            bool btAllTkt,
            string user_name
        )
        {
            bool _result = true;

            MC3DeptInfo _instInfo = GetInstanceInfoByDepartmentId(DId);

            if (_instInfo.OrganizationId == Guid.Empty)
            {
                return(false);
            }

            Micajah.Common.Bll.Providers.LoginProvider _login = new Micajah.Common.Bll.Providers.LoginProvider();
            Guid _userId = _login.GetLoginId(user_name);

            if (_userId == Guid.Empty)
            {
                return(false);
            }

            Micajah.Common.Bll.Organization _org = Micajah.Common.Bll.Providers.OrganizationProvider.GetOrganization(_instInfo.OrganizationId);
            if (_org == null)
            {
                return(false);
            }
            Micajah.Common.Bll.Providers.UserProvider.UpdateUserActive(_userId, _org.OrganizationId, false);

            //  Create the Database object, using the default database service. The
            //  default database service is determined through configuration.
            Database db = GetDatabase();

            string    sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_InactivateLogin";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            // Add procedure parameters
            db.AddInParameter(dbCommand, "UId", DbType.Int32, UId);
            db.AddInParameter(dbCommand, "DId", DbType.Int32, DId);
            db.AddInParameter(dbCommand, "btAllTkt", DbType.Boolean, btAllTkt);

            base.LoadFromSqlNoExec(dbCommand);

            /*
             * int ErrorCode = 0;
             *
             * string _error_code = db.GetParameterValue(dbCommand, "@RETURN_VALUE").ToString();
             * if (_error_code.Length > 0)
             *  ErrorCode = Int32.Parse(_error_code);
             * else
             *  ErrorCode = 0;
             *
             * if (ErrorCode == 1)
             *  _result = true;
             */

            return(_result);
        }