コード例 #1
0
        public string LoginToInnovator(string innovatorUrl, string database, string userName, string password)
        {
            HttpServerConnection serverConnection = null;

            using (new WaitingCursor())
            {
                try
                {
                    serverConnection = IomFactory.CreateHttpServerConnection(innovatorUrl, database, userName, Innovator.ScalcMD5(password));

                    var result = serverConnection.Login();
                    if (result.isError())
                    {
                        serverConnection = null;
                        return(result.getErrorString());
                    }
                }
                catch (Exception ex)
                {
                    serverConnection = null;
                    return(ex.Message);
                }
            }

            innovatorInstance = new Innovator(serverConnection);
            IsLoggedIn        = true;
            return(string.Empty);
        }
コード例 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Login login = new Login();

            PLMIntegration.Login ArasLogin = new PLMIntegration.Login();
            ArasLogin.CoLanguage = "zh-tw";
            bool resultLogin = ArasLogin.ShowLogin();

            CoErrorMessage = "";
            if (resultLogin == true)
            {
                if (ArasLogin.getInnovator != null)
                {
                    CoInnovator = ArasLogin.getInnovator;
                }
                else if (ArasLogin.getBtnIsLogin == true)
                {
                    CoErrorMessage = "登入錯誤" + ArasLogin.getErrorMessage;
                }
            }
            else
            {
                if (ArasLogin.getErrorMessage != "")
                {
                    CoErrorMessage = "登入錯誤" + ArasLogin.getErrorMessage;
                }
            }
            if (CoErrorMessage != "")
            {
                MessageBox.Show(CoErrorMessage);
            }
        }
コード例 #3
0
 private void btn_disconnection_Click(object sender, EventArgs e)
 {
     mc_conn      = null;
     mc_innovator = null;
     SettingConnectionButton(false);
     SettingCheckItemButton(false);
 }
コード例 #4
0
 private void btn_disconnection_Click_1(object sender, EventArgs e)
 {
     mc_conn.Logout();
     mc_conn      = null;
     mc_innovator = null;
     SettingConnectionButton(false);
 }
コード例 #5
0
        /// <summary>
        /// 获取活动根据Id
        /// </summary>
        /// <returns></returns>
        public static Item GetActivityById(Innovator inn, string id)
        {
            string strAML     = "<AML><Item type='ACTIVITY' action='get' id='" + id + "'></Item></AML>";
            var    returnItem = inn.applyAML(strAML);

            return(returnItem);
        }
コード例 #6
0
        /// <summary>
        /// 获取活动根据活动名称
        /// </summary>
        /// <returns></returns>
        public static Item GetActivityByNames(Innovator inn, List <string> names, string ItemId, string tableName, string activityStatus = "Pending")
        {
            if (names == null || names.Count() == 0)
            {
                return(null);
            }
            string whereStr = " where i.KEYED_NAME in (";

            for (int i = 0; i < names.Count(); i++)
            {
                if (i == (names.Count() - 1))
                {
                    whereStr += "'" + names[i] + "'" + ")";
                }
                else
                {
                    whereStr += "'" + names[i] + "'" + ",";
                }
            }
            whereStr += " and g.id='" + ItemId + "' and i.state='" + activityStatus + "'";
            string sqlStr = @"select i.*  from {0} g inner join 
                              innovator.WORKFLOW t on g.id=t.SOURCE_ID inner join 
                              innovator.WORKFLOW_PROCESS y on t.RELATED_ID=y.ID inner join 
                              innovator.WORKFLOW_PROCESS_ACTIVITY u on y.ID=u.SOURCE_ID inner join
                              innovator.ACTIVITY i on u.RELATED_ID=i.ID";

            sqlStr = sqlStr + whereStr;

            sqlStr = string.Format(sqlStr, tableName);

            var activitys = inn.applyMethod("bcs_RunQuery", "<sqlCommend>" + sqlStr + "</sqlCommend>");

            return(activitys);
        }
コード例 #7
0
        /// <summary>
        /// 自动完成任务
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <param name="ChoicePath"></param>
        public void AutomaticCompletionTask(Innovator inn, string id, decimal totalAmount, bool b_IsBudgetary, string b_Type, string lineLeader, string departmentLeader, ref WORKFLOW_PROCESS_PATH ChoicePath)
        {
            //获取当前活动
            Item activityItem = ActivityDA.GetActivityByItemId(inn, id, "innovator.b_ExpenseReimbursement");

            if (!activityItem.isError() && activityItem.getItemCount() > 0)
            {
                string activityId = activityItem.getItemByIndex(0).getProperty("activityid");
                string keyedName  = activityItem.getItemByIndex(0).getProperty("keyed_name");
                //获取当前任务的操作权限
                bool isOperate = false;
                Item identitys = IdentityDA.GetIdentityByActivityId(inn, activityId);
                if (!identitys.isError() && identitys.getItemCount() == 1)
                {
                    isOperate = true;
                }
                if (isOperate)
                {
                    string lineName = GetLineNameByActivityName(inn, activityId, keyedName, totalAmount, b_IsBudgetary);
                    WORKFLOW_PROCESS_PATH newChoicePath = WorkFlowBll.AutoCompleteActivityByParam(id, "innovator.b_ExpenseReimbursement", lineName);
                    if (newChoicePath != null)
                    {
                        ChoicePath = newChoicePath;
                        AutomaticCompletionTask(inn, id, totalAmount, b_IsBudgetary, b_Type, lineLeader, departmentLeader, ref ChoicePath);
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 删除报销明细
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        public static void DeleteExpenseReimbursementItem(Innovator inn, string id)
        {
            //询价信息
            var R_ReimbursementItem = inn.newItem("R_ReimbursementItem", "get");

            R_ReimbursementItem.setAttribute("where", "source_id='" + id + "'");
            R_ReimbursementItem.setAttribute("select", "related_id");
            var    oldItems   = R_ReimbursementItem.apply();
            string whereItem  = "";
            string requestIds = "";

            if (oldItems.getItemCount() > 0)
            {
                for (int i = 0; i < oldItems.getItemCount(); i++)
                {
                    var item = oldItems.getItemByIndex(i);
                    whereItem  += item.getProperty("related_id") + ",";
                    requestIds += item.getProperty("id") + ",";
                }
                whereItem  = whereItem.Substring(0, whereItem.LastIndexOf(','));
                requestIds = requestIds.Substring(0, requestIds.LastIndexOf(','));
                string amlStr = "<AML><Item type='R_ReimbursementItem' action='purge' idlist='" + requestIds + "'></Item><Item type='b_ReimbursementItem' action='purge'  idlist='" + whereItem + "'></Item></AML>";
                var    result = inn.applyAML(amlStr);
            }
        }
コード例 #9
0
        /// <summary>
        /// 管理员重发凭证邮件
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="b_Employee"></param>
        /// <param name="recordNo"></param>
        public static void ExpenseAccountantCheckSendEmail(Innovator inn, string b_Employee, string recordNo)
        {
            //邮箱列表
            List <string> listEmail = new List <string>();
            List <string> names     = new List <string>();
            string        subject   = "";
            string        body      = "";
            //获取申请人邮箱
            Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, b_Employee);

            if (!applicantIdentity.isError())
            {
                UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names);
            }
            subject = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。";

            body  = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。<br/>";
            body += "打印方式:进入 https://oa.bordrin.com ,打开菜单 报销管理->查询费用报销,找到对应申请单,单击单号后面的打印按钮打印申请单。";

            listEmail = new List <string>();
            listEmail.Add("*****@*****.**");
            listEmail.Add("*****@*****.**");
            listEmail.Add("Kai.Feng @bordrin.com");
            //异步执行
            new Task(() =>
            {
                MailOperator.SendMail(listEmail, subject, body);
            }).Start();
        }
コード例 #10
0
        /// <summary>
        /// 根据ID获取报销单
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item GetExpenseReimbursementObjById(Innovator inn, string id)
        {
            var expenseReimbursement = inn.newItem("b_ExpenseReimbursement", "get");

            expenseReimbursement.setAttribute("id", id);

            //报销明细
            var R_ReimbursementItem = inn.newItem("R_ReimbursementItem", "get");

            R_ReimbursementItem.setAttribute("where", "source_id='" + id + "'");
            R_ReimbursementItem.setAttribute("select", "related_id");
            expenseReimbursement.addRelationship(R_ReimbursementItem);

            //借款明细
            var R_LoanItem = inn.newItem("R_LoanItem", "get");

            R_LoanItem.setAttribute("where", "source_id='" + id + "'");
            R_LoanItem.setAttribute("select", "related_id");
            expenseReimbursement.addRelationship(R_LoanItem);

            //附件
            var R_ExpenseReimbursement = inn.newItem("R_ExpenseReimbursementFile", "get");

            R_ExpenseReimbursement.setAttribute("where", "source_id='" + id + "'");
            R_ExpenseReimbursement.setAttribute("select", "related_id");
            expenseReimbursement.addRelationship(R_ExpenseReimbursement);
            var result = expenseReimbursement.apply();

            return(result);
        }
コード例 #11
0
        /// <summary>
        /// 当财务总监审核通过后,发送邮件
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="proposer"></param>
        /// <param name="recordNo"></param>
        public static void SendEmailToProposer(Innovator inn, string proposer, string recordNo)
        {
            //邮箱列表
            List <string> listEmail = new List <string>();
            List <string> names     = new List <string>();
            string        subject   = "";
            string        body      = "";

            //获取申请人邮箱
            Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, proposer);

            if (!applicantIdentity.isError())
            {
                UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names);
            }

            subject = "Your expense reimbursement application <" + recordNo + "> has been approved by financial analyst, Please hand in your application and receipts to finance department.";

            body  = "您单号为< " + recordNo + " >的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。<br/>";
            body += "Your expense reimbursement application < " + recordNo + " > has been approved by financial analyst, Please hand in your application and receipts to finance department.";

            listEmail = new List <string>();
            listEmail.Add("*****@*****.**");
            listEmail.Add("*****@*****.**");
            //listEmail.Add("*****@*****.**");

            //异步执行
            new Task(() =>
            {
                MailOperator.SendMail(listEmail, subject, body);
            }).Start();
        }
コード例 #12
0
        internal static Item CreateItem(string type, string action)
        {
            IServerConnection connection = Substitute.For <IServerConnection>();
            Innovator         innovator  = CreateInnovator(connection);

            return(innovator.newItem(type, action));
        }
コード例 #13
0
ファイル: WorkFlowDA.cs プロジェクト: jiangzhouhui/oademo
        /// <summary>
        /// 获取审核对象根据委托
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="activityAssignmentId"></param>
        public static ACTIVITY_ASSIGNMENT GetInnvatorByAgent(Innovator inn, UserInfo userInfo, string activityId, string activityAssignmentId, ref string delegateName)
        {
            ACTIVITY_ASSIGNMENT obj       = null;
            AgentAuthEntity     agentAuth = null;
            IDENTITY            dentity   = IdentityDA.GetIdentityByActivityAssignmentId(activityAssignmentId);

            if (userInfo.AgentAuth != null)
            {
                agentAuth = userInfo.AgentAuth.Where(x => x.agentRoles.Contains(dentity.ID)).FirstOrDefault();
                if (agentAuth != null)
                {
                    delegateName = agentAuth.delegateName;
                }
            }

            //当人员信息权限中没有当前Identity权限 并且  Identity在委托的的权限中存在时!则为委托审核
            if (!userInfo.Roles.Contains(dentity.ID) && agentAuth != null)
            {
                //获取当前人员的Id
                Item   identity   = IdentityDA.GetIdentityByKeyedName(inn, userInfo.UserName);
                string identityId = identity.getProperty("id");

                var ActivityAssignmentItem = ActivityAssignmentDA.GetActivityAssignmentById(inn, activityAssignmentId);
                int voting_weight          = int.Parse(ActivityAssignmentItem.getItemByIndex(0).getProperty("voting_weight"));
                //修改当前审核权限为0
                ActivityAssignmentDA.UpdateActivityAssignmentVotingWeight(inn, activityAssignmentId, 0);
                //插入委托人员权限
                ActivityAssignmentDA.AddActivityAssignment(inn, activityId, identityId, voting_weight);
                //获取插入权限的ID
                obj = ActivityAssignmentDA.GetActivity_AssignmentByCondition(activityId, identityId);
            }
            return(obj);
        }
コード例 #14
0
        // Sets the fax property of a user
        public Item set_user_fax()
        {
            Innovator inn = this.getInnovator();

            string fax     = this.getProperty("fax", "");
            string user_id = this.getProperty("user_id", "");

            Item user = inn.newItem("User", "edit");

            user.setID(user_id);
            user = user.apply();

            if (user.isError())
            {
                return(this.getInnovator().newError(user.getErrorDetail()));
            }

            user.setProperty("fax", fax);
            Item res = user.apply();

            if (res.isError())
            {
                return(inn.newError(res.getErrorDetail()));
            }

            return(user);
        }
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring components ({0}, {1}, {2}, {3}) to work with component({4}):\n", ESAgentComponentId, ESIndexComponentId, ESZookeeperComponentId, ESFileProcessorComponentId, DatabaseComponentId);

            ESAgentComponent         esAgent           = instanceComponents.Single(c => c.Id == ESAgentComponentId) as ESAgentComponent;
            ESIndexComponent         esIndex           = instanceComponents.Single(c => c.Id == ESIndexComponentId) as ESIndexComponent;
            ESZooKeeperComponent     esZooKeeper       = instanceComponents.Single(c => c.Id == ESZookeeperComponentId) as ESZooKeeperComponent;
            ESFileProcessorComponent esFileProcessor   = instanceComponents.Single(c => c.Id == ESFileProcessorComponentId) as ESFileProcessorComponent;
            DatabaseComponent        databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;

            DropSolrIndex(esIndex);

            string serviceNameXPath = "/configuration/ServiceName";

            esFileProcessor.ServiceName = FileSystemFactory.GetFileSystem(esFileProcessor.ServerName).XmlHelper.XmlPeek(esFileProcessor.PathToConfig, serviceNameXPath);
            WindowsServiceHelper.StopService(esFileProcessor.ServerName, esFileProcessor.ServiceName);

            esAgent.ServiceName = FileSystemFactory.GetFileSystem(esAgent.ServerName).XmlHelper.XmlPeek(esAgent.PathToConfig, serviceNameXPath);
            WindowsServiceHelper.StopService(esAgent.ServerName, esAgent.ServiceName);

            esIndex.ServiceName = FileSystemFactory.GetFileSystem(esIndex.ServerName).XmlHelper.XmlPeek(esIndex.PathToConfig, serviceNameXPath);
            WindowsServiceHelper.StopService(esIndex.ServerName, esIndex.ServiceName);

            esZooKeeper.ServiceName = FileSystemFactory.GetFileSystem(esZooKeeper.ServerName).XmlHelper.XmlPeek(esZooKeeper.PathToConfig, serviceNameXPath);
            WindowsServiceHelper.StopService(esZooKeeper.ServerName, esZooKeeper.ServiceName);

            //Wait Until services are stopped for 30 seconds
            Thread.Sleep(30000);

            HttpServerConnection connection = IomFactory.CreateHttpServerConnection(databaseComponent.InnovatorUrl, databaseComponent.DatabaseName, databaseComponent.LoginOfRootInnovatorUser, databaseComponent.PasswordOfRootInnovatorUser.Value);

            try
            {
                connection.Login();

                Innovator innovator = new Innovator(connection);

                EditVariable(innovator, "ES_SolrUrl", esIndex.ESAIClusterUrl);
                EditVariable(innovator, "ES_AIClusterUrl", esIndex.ESAIClusterUrl);
                EditCryptoPwd(innovator, esAgent);
            }
            finally
            {
                connection.Logout();
            }

            UpdateESZooKeeperServiceConfig(esZooKeeper, databaseComponent);
            WindowsServiceHelper.StartService(esZooKeeper.ServerName, esZooKeeper.ServiceName);

            UpdateESIndexServiceConfig(esIndex, databaseComponent);
            WindowsServiceHelper.StartService(esIndex.ServerName, esIndex.ServiceName);

            UpdateESAgentServiceConfig(esAgent, databaseComponent);
            WindowsServiceHelper.StartService(esAgent.ServerName, esAgent.ServiceName);

            UpdateESFileProcessorServiceConfig(esFileProcessor, databaseComponent);
            WindowsServiceHelper.StartService(esFileProcessor.ServerName, esFileProcessor.ServiceName);

            ReloadSolrCollection(esIndex);
        }
コード例 #16
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string myTitle       = PRTitle.Text;
            string myDescription = PRDesc.Text;
            string mySteps2Rep   = PRStepsRepeat.Text;

            if (myTitle == "" || myDescription == "")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "MyAlert", "<script>alert('Please fill in required fields of PR Title and PR Description!!!')</script>");
            }
            else
            {
                string url                = url_text.Text;
                string db                 = db_text.Text;
                string user               = user_text.Text;
                string password           = password_text.Text;
                HttpServerConnection conn = IomFactory.CreateHttpServerConnection(url, db, user, password);
                Item login_result         = conn.Login();
                if (login_result.isError())
                {
                    throw new Exception("Login failed:" + login_result.getErrorDetail());
                }
                Innovator inn  = IomFactory.CreateInnovator(conn);
                Item      myPR = inn.newItem("PR", "add");
                myPR.setProperty("title", myTitle);
                myPR.setProperty("description", myDescription);
                myPR.setProperty("events", mySteps2Rep);
                myPR.apply();

                conn.Logout();
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "MyAlert", "<script>alert('Your PR was created successfully!!!')</script>");
            }
        }
コード例 #17
0
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", ConversionComponentId, DatabaseComponentId);

            ConversionComponent conversionComponent = instanceComponents.Single(c => c.Id == ConversionComponentId) as ConversionComponent;
            DatabaseComponent   databaseComponent   = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;

            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(databaseComponent);
            Innovator            innovator  = new Innovator(connection);

            Item conversionItem = innovator.newItem("ConversionServer", "merge");

            conversionItem.setAttribute("where", string.Format(CultureInfo.InvariantCulture, "[name]='{0}'", conversionComponent.Name));
            conversionItem.setProperty("name", conversionComponent.Name);
            conversionItem.setProperty("url", conversionComponent.ConversionServiceAsmxUrl);
            conversionItem.setProperty("impersonation_user_id", "EB2D5AA617FB41A28F081345B8B5FECB");
            conversionItem = conversionItem.apply();

            if (conversionItem.isError())
            {
                throw new ConnectException(
                          string.Format(CultureInfo.InvariantCulture, "Couldn't connect conversion component '{0}' with database '{1}'. {2}",
                                        ConversionComponentId,
                                        DatabaseComponentId,
                                        conversionItem.ToString()));
            }

            conversionComponent.TargetFileSystem.XmlHelper.XmlPoke(conversionComponent.PathToConfig, "/configuration/ConversionServer/InnovatorServer/@url", databaseComponent.InnovatorServerAspxUrl);
        }
コード例 #18
0
 public AuthenticationManagerProxy(IServerConnection serverConnection, Innovator innovator, InnovatorUser innovatorUser, IIOMWrapper iOMWrapperInstance)
 {
     this.ServerConnection   = serverConnection;
     this.InnovatorInstance  = innovator;
     this.InnovatorUser      = innovatorUser;
     this.IOMWrapperInstance = iOMWrapperInstance;
 }
コード例 #19
0
        public static void SetupEachTest()
        {
            // Before each test execution we reinitialize fake DAL and businessLogic
            // so tests won't conflict between themselves
            fakeDataAccessLayer = Substitute.For <TestedMethod.IDataAccessLayer>();
            businessLogic       = new TestedMethod.BusinessLogic(fakeDataAccessLayer);
            innovator           = ItemHelper.CreateInnovator();

            fakeDataAccessLayer.NewItem(Arg.Any <string>(), Arg.Any <string>())
            .Returns(@params => ItemHelper.CreateItem((string)@params[0], (string)@params[1]));

            fakeDataAccessLayer.NewResult(Arg.Any <string>())
            .Returns(@params => innovator.newResult((string)@params[0]));

            // We use applyProcessor List to store fake AML responces
            applyProcessor = InitializeApplyProcessor();
            fakeDataAccessLayer.ApplyItem(Arg.Any <Item>())
            .Returns(@params =>
            {
                Item paramItem = (Item)@params[0];
                foreach (Func <Item, Item> processor in applyProcessor)
                {
                    Item result = processor(paramItem);
                    if (result != null)
                    {
                        return(result);
                    }
                }
                return(null);
            });
        }
コード例 #20
0
        public void Setup()
        {
            this.innovatorUser     = new InnovatorUser();
            this.serverConnection  = Substitute.For <IServerConnection>();
            this.innovatorInstance = new Innovator(this.serverConnection);
            this.iOMWrapper        = Substitute.For <IIOMWrapper>();

            this.authManager   = new AuthenticationManagerProxy(serverConnection, innovatorInstance, innovatorUser, iOMWrapper);
            this.dialogFactory = Substitute.For <IDialogFactory>();
            this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            this.projectConfiguration        = Substitute.For <IProjectConfiguraiton>();
            this.templateLoader = new TemplateLoader(dialogFactory);
            this.packageManager = new PackageManager(authManager);

            ConnectionInfo testConnectionInfo = new ConnectionInfo()
            {
                LastConnection = true
            };

            this.projectConfiguration.Connections.Returns(new List <ConnectionInfo>()
            {
                testConnectionInfo
            });

            this.openFromArasViewModel = new OpenFromArasViewModel(authManager,
                                                                   dialogFactory,
                                                                   projectConfigurationManager,
                                                                   projectConfiguration,
                                                                   templateLoader,
                                                                   packageManager,
                                                                   "tesPathToProjectConfigFile",
                                                                   "testProjectName",
                                                                   "testProjectFullName",
                                                                   "testProjectLanguage");
        }
コード例 #21
0
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", VaultComponentId, DatabaseComponentId);

            VaultComponent    vaultComponent    = instanceComponents.Single(c => c.Id == VaultComponentId) as VaultComponent;
            DatabaseComponent databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;

            HttpServerConnection connection = ServerConnectionFactory.GetServerConnection(databaseComponent);
            Innovator            innovator  = new Innovator(connection);

            Item vaultItem = innovator.newItem("Vault", "merge");

            vaultItem.setAttribute("where", string.Format(CultureInfo.InvariantCulture, "[name]='{0}'", vaultComponent.Name));
            vaultItem.setProperty("name", vaultComponent.Name);
            vaultItem.setProperty("vault_url_pattern", vaultComponent.VaultServerAspxUrl);
            vaultItem = vaultItem.apply();

            if (vaultItem.isError())
            {
                throw new ConnectException(
                          string.Format(CultureInfo.InvariantCulture, "Couldn't connect vault component '{0}' with database '{1}'. {2}",
                                        VaultComponentId,
                                        DatabaseComponentId,
                                        vaultItem.ToString()));
            }

            vaultComponent.TargetFileSystem.XmlHelper.XmlPoke(vaultComponent.PathToConfig, "/configuration/appSettings/add[@key = 'InnovatorServerUrl']/@value", databaseComponent.InnovatorServerAspxUrl);
        }
コード例 #22
0
        public static void setAliasName(Item user, CallContext CCO)
        {
            string    aliasId   = CCO.Identity.GetUserAliases(user.getID());
            Innovator inn       = user.getInnovator();
            Item      userAlias = inn.getItemById("Identity", aliasId);
            string    aml       = "<AML>";

            aml += "<Item type='ItemType' action='get'>";
            aml += "    <name>User</name>";
            aml += "	<Relationships>";
            aml += "		<Item type='Property' select='name,keyed_name_order' orderBy='keyed_name_order'>";
            aml += "            <keyed_name_order condition = 'is not null' />";
            aml += "		</Item>";
            aml += "	</Relationships>";
            aml += "</Item>";
            aml += "</AML>";

            Item        userType = inn.applyAML(aml);
            XmlNodeList ndsList  = userType.node.SelectNodes("Relationships/Item[@type='Property']/name");

            string tagName = "";

            for (int i = 0; i < ndsList.Count; i++)
            {
                string propName = ndsList[i].InnerText;
                tagName = tagName + " " + user.getProperty(propName);
            }
            tagName = tagName.Trim();
            if (tagName != "")
            {
                string sql = "UPDATE [innovator].[IDENTITY] set name='{0}' WHERE id='{1}'";
                sql = string.Format(sql, tagName, aliasId);
                Item temp = inn.applySQL(sql);
            }
        }
コード例 #23
0
        /// <summary>
        /// 删除费用类别
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item DeleteExpenseCategoryById(Innovator inn, string id)
        {
            string strAml = "<AML><Item type='b_ExpenseCategory' action='delete' id='" + id + "'></Item></AML>";
            Item   result = inn.applyAML(strAml);

            return(result);
        }
コード例 #24
0
        /// <summary>
        /// 获取费用类别根据名称
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Item GetExpenseCategoryByName(Innovator inn, string b_CostName)
        {
            string strSql     = "select * from innovator.b_ExpenseCategory where b_CostName=N'" + b_CostName + "'";
            var    returnItem = inn.applyMethod("bcs_RunQuery", "<sqlCommend>" + strSql + "</sqlCommend>");

            return(returnItem);
        }
コード例 #25
0
        string CreateFileItem(string URL, string database, string username, string password)
        {
            string filePath           = "C:\\temp\\TesTDocument1.doc";
            HttpServerConnection conn = IomFactory.CreateHttpServerConnection(URL, database, username, password);
            Item login_result         = conn.Login();

            if (login_result.isError())
            {
                throw new Exception("Login failed");
            }
            Innovator inn = IomFactory.CreateInnovator(conn);

            Item fileItem = inn.newItem("File", "add");

            fileItem.setProperty("filename", new System.IO.FileInfo(filePath).Name);
            fileItem.attachPhysicalFile(filePath);
            Item result = fileItem.apply();

            conn.Logout();
            if (result.isError())
            {
                return(result.getErrorString());
            }
            else
            {
                return("Success!");
            }
        }
コード例 #26
0
ファイル: ItemTypeDA.cs プロジェクト: jiangzhouhui/oademo
        /// <summary>
        ///获取拥有的菜单权限
        /// </summary>
        /// <param name="innovator"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item GetMenuAuthByIdentity(Innovator innovator, string id)
        {
            string str = "";
            //获取权限字符串
            var enumDescriptions = EnumDescription.GetFieldTexts <SystemMenuList>(true);

            if (enumDescriptions != null && enumDescriptions.Count > 0)
            {
                for (int i = 0; i < enumDescriptions.Count; i++)
                {
                    if (i == (enumDescriptions.Count - 1))
                    {
                        str = str + "'" + enumDescriptions[i].FieldName + "'";
                    }
                    else
                    {
                        str = str + "'" + enumDescriptions[i].FieldName + "',";
                    }
                }
            }
            string amlStr = "<AML><Item type='ITEMTYPE' action='get'><keyed_name condition ='in'>" + str + "</keyed_name><Relationships><Item type='TOC Access' action='get'><related_id condition='in'>" + id + "</related_id></Item></Relationships></Item></AML>";
            //获取是否有角色管理访问权限
            //string strSql = "select g.KEYED_NAME from innovator.ITEMTYPE g inner join  innovator.TOC_ACCESS t on g.ID = t.SOURCE_ID inner join innovator.[IDENTITY] y on t.RELATED_ID = y.ID where y.ID = '" + id + "'";
            Item result = innovator.applyAML(amlStr);

            return(result);
        }
コード例 #27
0
        public static Item GetActivityAssignmentById(Innovator inn, string id)
        {
            string strSql     = "select * from innovator.ACTIVITY_ASSIGNMENT where id='" + id + "'";
            var    returnItem = inn.applyMethod("bcs_RunQuery", "<sqlCommend>" + strSql + "</sqlCommend>");

            return(returnItem);
        }
コード例 #28
0
        public static Item GetActivityAssignment(Innovator inn, string source_id)
        {
            string strSql     = "select g.* from ACTIVITY_ASSIGNMENT g inner join [innovator].[IDENTITY] t on g.RELATED_ID=t.id  where g.SOURCE_ID='" + source_id + "' and t.name!='Administrators'";
            var    returnItem = inn.applyMethod("bcs_RunQuery", "<sqlCommend>" + strSql + "</sqlCommend>");

            return(returnItem);
        }
コード例 #29
0
 /// <summary>
 /// 根据Identity 获取Email
 /// </summary>
 /// <param name="identitys"></param>
 public static void GetNamesByIdentitys(Innovator inn, Item identitys, ref string names)
 {
     if (!identitys.isError() && identitys.getItemCount() > 0)
     {
         for (int i = 0; i < identitys.getItemCount(); i++)
         {
             Item   identityItem = identitys.getItemByIndex(i);
             string isAlias      = identityItem.getProperty("is_alias");
             string id           = identityItem.getProperty("id");
             if (isAlias == "1")
             {
                 //根据Id 获取邮箱账户
                 Item   userItem = UserDA.GetUserByIdentityId(inn, id);
                 string name     = userItem.getProperty("keyed_name");
                 if (!string.IsNullOrEmpty(name) && names.IndexOf(name) < 0 && name != "Innovator Admin")
                 {
                     names += name + "、";
                 }
             }
             else
             {
                 Item childIdentity = IdentityDA.GetChildIdentity(inn, id);
                 GetNamesByIdentitys(inn, childIdentity, ref names);
             }
         }
     }
 }
コード例 #30
0
 /// <summary>
 /// 根据Identity 获取Email
 /// </summary>
 /// <param name="identitys"></param>
 public static void GetEmailByIdentitys(Innovator inn, Item identitys, List <string> listEmail, List <string> names)
 {
     if (!identitys.isError() && identitys.getItemCount() > 0)
     {
         for (int i = 0; i < identitys.getItemCount(); i++)
         {
             Item   identityItem = identitys.getItemByIndex(i);
             string isAlias      = identityItem.getProperty("is_alias");
             string id           = identityItem.getProperty("id");
             if (isAlias == "1")
             {
                 //根据Id 获取邮箱账户
                 Item   userItem = UserDA.GetUserByIdentityId(inn, id);
                 string email    = userItem.getProperty("email");
                 string name     = userItem.getProperty("keyed_name");
                 if (!string.IsNullOrEmpty(name) && names.IndexOf(name) < 0 && name != "Innovator Admin")
                 {
                     names.Add(name);
                 }
                 if (!string.IsNullOrEmpty(email) && listEmail.IndexOf(email) < 0)
                 {
                     listEmail.Add(email);
                 }
             }
             else
             {
                 Item childIdentity = IdentityDA.GetChildIdentity(inn, id);
                 GetEmailByIdentitys(inn, childIdentity, listEmail, names);
             }
         }
     }
 }
コード例 #31
0
 public IomConnection(Innovator inn)
 {
     _inn = inn;
 }
コード例 #32
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            _conn = IomFactory.CreateHttpServerConnection(textBoxURL.Text, cmbDatabase.Text, textBoxLogin.Text, textBoxPassword.Text);
            Item result = _conn.Login();
            if (result.isError())
            {
                MessageBox.Show(string.Format("Login failed with error: {0}", result.getErrorString()), "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.m_inn = IomFactory.CreateInnovator(_conn);

            btnRunSearch.Enabled = true;
            loginBtn.Enabled = false;
        }