Ejemplo n.º 1
0
 public ApprovalViewModel(ICommonInfo dimensionService)
 {
     QueryCriteria           = new ApplicationQueryCriteria();
     Stores                  = dimensionService.GetStoreList();
     ApprovalStatuses        = EnumerationUtility.ToList <ApprovalStatus>();
     QueryCommand            = new AsyncDelegateCommand(OnQuery);
     ApproveCommand          = new AsyncDelegateCommand(OnApprove, CanCommandExecute);
     SelectAllCommand        = new DelegateCommand <bool?>(OnSelectAll);
     ReloadDepartmentCommand = new AsyncDelegateCommand(OnDepartmentReload);
 }
Ejemplo n.º 2
0
 public AssociateViewModel(ICommonInfo dimensionService)
 {
     QueryCriteria           = new AssociateQueryCriteria();
     Stores                  = dimensionService.GetStoreList();
     PermissionLevels        = EnumerationUtility.ToList <AssociatePermission>();
     QueryCommand            = new AsyncDelegateCommand(OnQuery);
     RenotifyCommand         = new AsyncDelegateCommand(OnNotify, CanCommandExecute);
     DemoteCommand           = new AsyncDelegateCommand(OnDemote, CanCommandExecute);
     SelectAllCommand        = new DelegateCommand <bool?>(OnSelectAll);
     ReloadDepartmentCommand = new AsyncDelegateCommand(OnDepartmentReload);
 }
Ejemplo n.º 3
0
        public TreeRootData GetTestKnowlwdgeTreeNode(SessionPara para, SQLTransaction trans)
        {
            TreeRootData rootData   = new TreeRootData();
            var          rootTxt    = Dictionarys.Instance.GetText("TestResourceLib", "KnowledgeType", para.Lang);
            var          rootNodeId = "KNOWLEDGEROOT_" + para.CompanyID.Split('_')[1];

            rootData.RootData = new List <TreeNodeObject>();
            var rootNode = ServiceUtility.GetTreeNodeObject(rootTxt, rootNodeId, "", "KNOWLEDGEROOT", "-1", "", "KNOWLEDGEROOT", true);

            rootNode.Children = new List <TreeNodeObject>();
            var enumData = EnumerationUtility.GetDBEnumerationItem(para, trans, "KnowledgeType");

            foreach (var key in enumData.Keys)
            {
                var tempNode = ServiceUtility.GetTreeNodeObject(enumData[key], key, "", "KNOWLEDGETYPE", "1", "", "KNOWLEDGETYPE", true);
                rootNode.Children.Add(tempNode);
            }
            rootData.RootData.Add(rootNode);
            rootNode.ContentPermission = true;
            return(rootData);
        }
Ejemplo n.º 4
0
        public TreeRootData GetProjectCapabilityTreeRootNode(SessionPara para, SQLTransaction trans)
        {
            TreeRootData rootData = new TreeRootData();

            rootData.RootData = new List <TreeNodeObject>();
            string rootNodeType    = "PROJECTROOT";
            string childNodeType   = "RESOURCETYPE";
            var    projectNodeText = Dictionarys.Instance.GetText("TestResourceLib", "TestProject", para.Lang);
            var    enumData        = EnumerationUtility.GetDBEnumerationItem(para, trans, "OutResourceType");
            var    rootNode        = ServiceUtility.GetTreeNodeObject(projectNodeText, rootNodeType, rootNodeType, rootNodeType, "-1", "", rootNodeType, true);

            rootData.RootData.Add(rootNode);
            if (enumData.Keys.Count > 0)
            {
                rootNode.Children = new List <TreeNodeObject>();
                foreach (var key in enumData.Keys)
                {
                    var childNode = ServiceUtility.GetTreeNodeObject(enumData[key], key, key, childNodeType, "1", "", childNodeType, false);
                    rootNode.Children.Add(childNode);
                }
            }
            return(rootData);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hostname">Fully qualified host name, i.e. host.domain.com</param>
        /// <param name="ipAddress">The IP Address to update to.</param>
        public override bool UpdateHostname(string hostname, string ipAddress)
        {
            if (HasIpAddresssChanged(hostname, ipAddress) == false)
            {
                return(true);                                                                // No change, no need to update
            }
            if (IsValidIpAddress(ipAddress) == false)
            {
                logger.Error(string.Format("Invalid IP Address provided: {0}", ipAddress));
                return(false);
            }

            var zones = GetHostedZones();

            if (zones == null)
            {
                return(false);
            }

            try
            {
                if (!LastUpdateIpAddresses.ContainsKey(hostname))
                {
                    InitializeLastUpdateIpAddresses(hostname);
                }

                var lastIpAddress = LastUpdateIpAddresses[hostname];

                var deleteRequest  = GetChangeResourceRecordSetsRequest(hostname, lastIpAddress, EnumerationUtility.GetStringValue(ChangeActionType.Delete), zones);
                var deleteResponse = client.ChangeResourceRecordSets(deleteRequest);
            }
            //Ignore, if delete fails, its probably because the record didn't already exists
            catch (AmazonRoute53Exception ex)
            {
                logger.Warn(ex);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            try
            {
                var createRequest  = GetChangeResourceRecordSetsRequest(hostname, ipAddress, EnumerationUtility.GetStringValue(ChangeActionType.Create), zones);
                var createResponse = client.ChangeResourceRecordSets(createRequest);

                //ChangeInfo info: http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/?topic=html/T_Amazon_Route53_Model_ChangeInfo.htm
                //response.ChangeResourceRecordSetsResult.ChangeInfo.Status

                LastUpdateIpAddresses[hostname] = ipAddress;
                return(true);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(false);
            }
        }