コード例 #1
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(this.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(this.GetType(), "MyAlert", "<script>alert('Your PR was created successfully!!!')</script>");
            }
        }
コード例 #2
0
        public Item FindAllByItem(Innovator inn)
        {
            Item itmSearch = inn.newItem("Work Order", "get");

            itmSearch = itmSearch.apply();
            return(itmSearch);
        }
コード例 #3
0
        /// <summary>
        /// 删除交通费
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        public static void DelTrafficExpenseItem(Innovator inn, string id)
        {
            //询价信息
            var R_TrafficExpense = inn.newItem("R_TrafficExpense", "get");

            R_TrafficExpense.setAttribute("where", "source_id='" + id + "'");
            R_TrafficExpense.setAttribute("select", "related_id");
            var    oldItems   = R_TrafficExpense.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_TrafficExpense' action='purge' idlist='" + requestIds + "'></Item><Item type='b_TrafficExpense' action='purge'  idlist='" + whereItem + "'></Item></AML>";
                var    result = inn.applyAML(amlStr);
            }
        }
コード例 #4
0
        public JsonResult NewWork(CalendarPatial calendar)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();

            if (Session["innovator"] != null)
            {
                Innovator inn = (Innovator)Session["innovator"];

                Item work_note;
                if (string.IsNullOrWhiteSpace(calendar.id))
                {
                    work_note = inn.newItem("work_note", "add");
                }
                else
                {
                    work_note = inn.newItem("work_note", "edit");
                    work_note.setAttribute("where", "id='" + calendar.id + "'");
                }


                work_note.setProperty("title", calendar.title);
                work_note.setProperty("content", calendar.description);
                work_note.setProperty("startdate", calendar.start + "T00:00:00");
                if (calendar.end == "")
                {
                    calendar.end = calendar.start;
                }
                work_note.setProperty("enddate", calendar.end + "T00:00:00");
                string beforeAml = work_note.dom.OuterXml;
                work_note = work_note.apply();
                if (work_note.isError())
                {
                    result.Add("error", work_note.getErrorString());
                    result.Add("error_aml", beforeAml);
                }
                else
                {
                    result.Add("result", work_note.dom.OuterXml);
                }
            }
            return(Json(result));
        }
コード例 #5
0
        public static void sgmAddIdentityToRoleUseDept(Item user, string role, CallContext CCO)
        {
            string    identityId = CCO.Identity.GetIdentityIdByUserId(user.getID());
            Innovator inn        = user.getInnovator();
            Item      Identity   = inn.getItemById("Identity", identityId);
            string    aml        = "<AML>";

            aml += "<Item type='List' action='get'>";
            aml += "    <name>{0}</name>";
            aml += "	<Relationships>";
            aml += "		<Item type='Value' select='lable,value'>";
            aml += "		</Item>";
            aml += "	</Relationships>";
            aml += "</Item>";
            aml += "</AML>";
            aml  = string.Format(aml, role);
            Item list = inn.applyAML(aml);

            XmlNodeList ndsList = list.node.SelectNodes("Relationships/Item[@type='Value']/value");

            List <string> deptList = new List <string>();

            for (int i = 0; i < ndsList.Count; i++)
            {
                string dept = ndsList[i].InnerText;
                deptList.Add(dept);
            }
            string user_dept = user.getProperty("department");
            int    index     = deptList.FindIndex(s => s == user_dept);


            Item Role = inn.getItemById("Identity", CCO.Identity.GetIdentityIdByName(role));


            if (index >= 0)
            {
                if (!isMember(Role, Identity, inn))
                {
                    Item member = inn.newItem("Member", "add");
                    member.setProperty("source_id", Role.getID());
                    member.setProperty("related_id", identityId);
                    member = member.apply();
                }
            }
            else
            {
                if (isMember(Role, Identity, inn))
                {
                    string sql = "DELETE FROM Member WHERE source_id ='{0}' and related_id='{1}'";
                    sql = string.Format(sql, Role.getID(), identityId);
                    Item temp = inn.applySQL(sql);
                }
            }
        }
コード例 #6
0
        public void TestCurrentUserIsNotSmurf()
        {
            var method   = new CheckIdentityMembershipMethod();
            var bodyItem = Innovator.newItem("Method", "CheckIdentityMembership");

            bodyItem.setProperty("identity_name", "Smurfs");

            var result = method.Apply(bodyItem);

            Assert.IsFalse(result.isError());
            Assert.AreEqual("false", result.getResult());
        }
コード例 #7
0
        private static Item CallMethod(Item item)
        {
            var bodyItem = Innovator.newItem("Method", "GetExternalUrl");

            bodyItem.setProperty("type", item.getType());
            bodyItem.setProperty("id", item.getID());
            bodyItem.setProperty("baseurl", "http://myarasserver.local");

            var method = new GetExternalUrlMethod();
            var result = method.Apply(bodyItem);

            return(result);
        }
        private static void EditPropertyForItem(Innovator innovator, string itemTypeName, string whereClause, string propertyName, string propertyValue)
        {
            Item item = innovator.newItem(itemTypeName, "edit");

            item.setAttribute("where", whereClause);
            item.setProperty(propertyName, propertyValue);
            item = item.apply();

            if (item.isError())
            {
                throw new CommonException(item.ToString());
            }
        }
コード例 #9
0
        private void ReGetLabelLanguage()
        {
            foreach (string fullpath in files)
            {
                XDocument _xDoc = XDocument.Load(fullpath);
                Item      itm   = CoInnovator.newItem();
                itm.loadAML(_xDoc.ToString());

                SearchProperties(_xDoc);
                SearchField(_xDoc);
                SearchItemtype(_xDoc);
                SearchRelationshipType(_xDoc);
                SearchWorkflowMapActivity(_xDoc);
                SearchWorkflowMap(_xDoc);
                SearchWorkflowMapPath(_xDoc);
                SearchLifeCycleMap(_xDoc);
                SearchLifeCycleState(_xDoc);
                string prettyXML = PrintXML(_xDoc.FirstNode.ToString());
                File.WriteAllText(fullpath, prettyXML);
                //_xDoc.Save(fullpath);
            }
        }
コード例 #10
0
        /// <summary>
        /// 根据ID获取差旅报销单
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item GetTripReimbursementObjById(Innovator inn, string id)
        {
            var expenseTripReimbursement = inn.newItem("b_TripReimbursementForm", "get");

            expenseTripReimbursement.setAttribute("id", id);

            //住宿费
            var R_HotelExpense = inn.newItem("R_HotelExpense", "get");

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

            //交通费
            var R_TrafficExpense = inn.newItem("R_TrafficExpense", "get");

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

            //餐费及固定补贴
            var R_Mealsandfixedsubsidies = inn.newItem("R_Mealsandfixedsubsidies", "get");

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

            //其他
            var R_Others = inn.newItem("R_Others", "get");

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

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

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


            //附件
            var R_TripReimbursement = inn.newItem("R_TripReimbursementFile", "get");

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

            var result = expenseTripReimbursement.apply();

            return(result);
        }
コード例 #11
0
        /// <summary>
        /// 根据Id获取单据编号
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetRecordNoById(Innovator inn, string id)
        {
            var item = inn.newItem("b_ExpenseReimbursement", "get");

            item.setAttribute("id", id);
            item.setAttribute("select", "b_recordno");
            var result = item.apply();

            if (!result.isError())
            {
                return(result.getProperty("b_recordno"));
            }
            return("");
        }
コード例 #12
0
        public void TestCurrentUserIsAdministrator()
        {
            // A developer should be an administrator to be able to develop

            var method   = new CheckIdentityMembershipMethod();
            var bodyItem = Innovator.newItem("Method", "CheckIdentityMembership");

            bodyItem.setProperty("identity_name", "Administrators");

            var result = method.Apply(bodyItem);

            Assert.IsFalse(result.isError());
            Assert.AreEqual("true", result.getResult());
        }
コード例 #13
0
        /// <summary>
        /// 根据Id获取单据编号
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetRecordNoById(Innovator inn, string id)
        {
            var item = inn.newItem("b_BusinessTravel", "get");

            item.setAttribute("id", id);
            item.setAttribute("select", "b_documentno");
            var result = item.apply();

            if (!result.isError())
            {
                return(result.getProperty("b_documentno"));
            }
            return("");
        }
コード例 #14
0
        public void Init()
        {
            serverConnection = Substitute.For <IServerConnection>();
            Innovator innovatorIns = new Innovator(serverConnection);

            this.authManager   = new AuthenticationManagerProxy(this.serverConnection, innovatorIns, new InnovatorUser(), Substitute.For <IIOMWrapper>());
            this.dialogFactory = Substitute.For <IDialogFactory>();
            this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            this.projectConfiguration        = Substitute.For <IProjectConfiguraiton>();
            this.messageManager    = Substitute.For <MessageManager>();
            this.packageManager    = new PackageManager(this.authManager, this.messageManager);
            this.templateLoader    = new TemplateLoader();
            this.codeProvider      = Substitute.For <ICodeProvider>();
            this.projectManager    = Substitute.For <IProjectManager>();
            this.arasDataProvider  = Substitute.For <IArasDataProvider>();
            this.iOWrapper         = Substitute.For <IIOWrapper>();
            this.methodInformation = new MethodInfo()
            {
                MethodName = string.Empty,
                Package    = new PackageInfo(string.Empty)
            };

            this.projectConfiguration.LastSavedSearch.Returns(new Dictionary <string, List <PropertyInfo> >());

            XmlDocument methodItemTypeDoc = new XmlDocument();

            methodItemTypeDoc.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml"));

            Item methodItemType = innovatorIns.newItem();

            methodItemType.loadAML(methodItemTypeDoc.OuterXml);
            MethodItemTypeInfo methodItemTypeInfo = new MethodItemTypeInfo(methodItemType, messageManager);

            this.arasDataProvider.GetMethodItemTypeInfo().Returns(methodItemTypeInfo);

            string pathToFileForSave = Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodAml\ReturnNullMethodAml.xml");

            this.saveToPackageViewModel = new SaveToPackageViewModel(authManager,
                                                                     dialogFactory,
                                                                     projectConfiguration,
                                                                     templateLoader,
                                                                     packageManager,
                                                                     codeProvider,
                                                                     projectManager,
                                                                     arasDataProvider,
                                                                     iOWrapper,
                                                                     messageManager,
                                                                     methodInformation,
                                                                     pathToFileForSave);
        }
コード例 #15
0
        public void CheckThatMethodReturnsOriginalErrorFromServer()
        {
            const string loginName = "sample_user";

            TestedMethod.BusinessLogic businessLogic = new TestedMethod.BusinessLogic(fakeDataAccessLayer);

            fakeDataAccessLayer.ApplyItem(Arg.Is <Item>(item => item.getType() == "User" && item.getProperty("login_name") == loginName))
            .Returns(@params =>
            {
                Item errorItem = innovator.newItem();
                errorItem.loadAML(faultString);
                return(errorItem);
            });

            Item contextItem = innovator.newItem();

            contextItem.setType("User");
            contextItem.setProperty("login_name", loginName);

            Item result = businessLogic.Run(contextItem);

            Assert.IsTrue(result.isError());
            Assert.AreEqual(errorMessage, result.getErrorString());
        }
コード例 #16
0
        private void syncCheckoutBtn_Click(object sender, EventArgs e)
        {
            int    numberOfThreads = (int)thCount.Value;
            string targetFolder    = textBoxDestination.Text;

            //Strat the timer
            sw.Start();

            textBoxResult.Clear();

            string files = GetFiles();

            Item configuration = m_inn.newItem();

            configuration.loadAML(files);

            // get checkout manager
            CheckoutManager checkoutManager2 = new CheckoutManager(configuration);

            // Lock all items in the configuration (!File, !Vault, !Located)
            // NOTE: In this particular example this call could be skipped as the configuration the way it's built does NOT have any items that have to be locked.
            Item lockResult = checkoutManager2.Lock();

            if (lockResult.isError())
            {
                MessageBox.Show(lockResult.getErrorString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            progressBar.Value = 0;

            // Download files synchronously
            System.Collections.Hashtable downloadResults = checkoutManager2.DownloadFiles(targetFolder, numberOfThreads);

            ProcessResult(downloadResults, configuration);
        }
コード例 #17
0
        public static string CheckSAPConnection()
        {
            Innovator innovator = IomFactory.CreateInnovator(connection);
            string    result;

            Item queryPart = innovator.newItem("GAG_SAPInterfaceSettings", "get");

            queryPart.setProperty("gag_active", "Yes");
            Item queryResult = queryPart.apply();

            if (queryResult.isEmpty())
            {
                result = "No SAP Connection Found. Contact Admin";
                return(result);
            }
            try
            {
                Item sapResult = queryResult.getItemByIndex(0);
                RfcConfigParameters parameters = new RfcConfigParameters
                {
                    [RfcConfigParameters.Name]                  = sapResult.getProperty("gag_name"),
                    [RfcConfigParameters.User]                  = ConfigurationManager.AppSettings.Get("userSAP"),
                    [RfcConfigParameters.Password]              = ConfigurationManager.AppSettings.Get("passwordSAP"),
                    [RfcConfigParameters.PeakConnectionsLimit]  = sapResult.getProperty("gag_peak_connection_limit"),
                    [RfcConfigParameters.ConnectionIdleTimeout] = sapResult.getProperty("gag_connection_idle_time_out"),
                    [RfcConfigParameters.Language]              = sapResult.getProperty("gag_language"),
                    [RfcConfigParameters.AppServerHost]         = sapResult.getProperty("gag_app_server_host"),
                    [RfcConfigParameters.SystemNumber]          = sapResult.getProperty("gag_system_number"),
                    [RfcConfigParameters.Client]                = sapResult.getProperty("gag_client")
                };
                destination = RfcDestinationManager.GetDestination(parameters);
                RfcSessionManager.BeginContext(destination);
                destination.Ping();

                result = "Connection Successful";
                return(result);
            }
            catch (RfcLogonException)
            {
                result = "SAP Log-In Failed";
                return(result);
            }
            catch (RfcCommunicationException)
            {
                result = "SAP Server Connection Error";
                return(result);
            }
        }
コード例 #18
0
        /// <inheritdoc />
        /// <summary>
        /// Check if user is an (possibly indirect) member of an identity group
        /// </summary>
        /// <param name="body">Method XML body item</param>
        /// <returns>'true' as string result if membership matches</returns>
        public override Item DoApply(Item body)
        {
            XmlPropertyAttribute.BindXml(body.node, this);

            var userId = Innovator.getUserID();

            var userAlias = Innovator.newItem("Alias", "get");

            userAlias.setAttribute("select", "related_id");
            userAlias.setProperty("source_id", userId);
            userAlias = Innovator.ApplyItem(userAlias);

            var identityId = userAlias.getProperty("related_id");

            return(Innovator.newResult(CheckIfMemberOfIdentity(identityId) ? "true" : "false"));
        }
コード例 #19
0
        // Creates a new document with the same name as the newly created Part
        public Item create_document_on_save()
        {
            Innovator inn = this.getInnovator();

            string docName  = this.getProperty("item_number", "");
            Item   document = inn.newItem("Document", "add");

            document.setProperty("item_number", docName);
            document = document.apply();

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

            return(this);
        }
コード例 #20
0
        private void btnCheckout_Click(object sender, EventArgs e)
        {
            Item fileItm = inn.newItem("File", "get");

            fileItm.setProperty("id", txtFileID.Text);
            fileItm = fileItm.apply();
            if (fileItm.isError())
            {
                MessageBox.Show(fileItm.getErrorString());
                return;
            }
            else
            {
                fileItm                   = fileItm.checkout(txtCheckoutPath.Text);
                file_fullname             = fileItm.getProperty("checkedout_path");
                txtCheckoutPathAfter.Text = file_fullname;
            }
        }
コード例 #21
0
        public static bool isMember(Item identity1, Item identity2, Innovator inn)
        {
            string id1    = identity1.getID();
            string id2    = identity2.getID();
            Item   member = inn.newItem("Member", "get");

            member.setProperty("source_id", id1);
            member.setProperty("related_id", id2);
            member = member.apply();
            if (member.getItemCount() > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #22
0
        /// <inheritdoc />
        /// <summary>
        /// Check if user is an (possibly indirect) member of an identity group
        /// </summary>
        /// <param name="body">Method XML body item</param>
        /// <returns>'true' as string result if membership matches</returns>
        public override Item DoApply(Item body)
        {
            XmlPropertyAttribute.BindXml(body.node, this);

            var userId = Innovator.getUserID();

            var userAlias = Innovator.newItem("Alias", "get");

            userAlias.setAttribute("select", "related_id");
            userAlias.setProperty("source_id", userId);
            userAlias = Innovator.ApplyItem(userAlias);

            var ids = new List <string> {
                userAlias.getProperty("related_id")
            };

            // not the fastest, but it works.
            // should be optimized by asking for batches of identities.
            // (see below for fast recursive SQL .. that Aras doesn't permit in ApplySQL.)
            while (ids.Any())
            {
                var id = ids.Last();
                ids.RemoveAt(ids.Count - 1);

                var identityItem = Innovator.newItem("Identity", "get");
                identityItem.setAttribute("select", "keyed_name");

                var memberRelation = identityItem.createRelationship("Member", "get");
                memberRelation.setAttribute("select", "keyed_name");
                memberRelation.setProperty("related_id", id);
                identityItem = Innovator.ApplyItem(identityItem);

                if (identityItem.Enumerate()
                    .Any(i => i.getProperty("keyed_name") == IdentityName))
                {
                    return(Innovator.newResult("true"));
                }

                ids.AddRange(identityItem.Enumerate().Select(i => i.getID()));
            }

            return(Innovator.newResult("false"));
        }
コード例 #23
0
        /// <summary>
        /// Check if an identity ID is a member of the identity with name `IdentityName`.
        ///
        /// Also takes into account the from and end dates for an identity membership.
        /// </summary>
        /// <param name="identityId">The identity ID to check if it is a member of identity with name `IdentityName`.</param>
        private bool CheckIfMemberOfIdentity(string identityId)
        {
            var identityIds = new List <Tuple <string, DateTime, DateTime> >
            {
                new Tuple <string, DateTime, DateTime>(identityId, DateTime.MinValue, DateTime.MaxValue)
            };

            while (identityIds.Any())
            {
                var identityIdTuple = identityIds.Last();
                identityIds.RemoveAt(identityIds.Count - 1);
                identityId = identityIdTuple.Item1;
                var fromDate = identityIdTuple.Item2;
                var endDate  = identityIdTuple.Item3;

                var identityItems = Innovator.newItem("Identity", "get");
                identityItems.setAttribute("select", "keyed_name");

                var memberRelation = identityItems.createRelationship("Member", "get");
                memberRelation.setAttribute("select", "id, from_date, end_date");
                memberRelation.setProperty("related_id", identityId);
                identityItems = Innovator.ApplyItem(identityItems);

                foreach (var identityItem in identityItems.Enumerate())
                {
                    var memberItem  = identityItem.getRelationships().getItemByIndex(0);
                    var newFromDate = MaxDateTime(fromDate, memberItem.getProperty("from_date")?.ToDateTime());
                    var newEndDate  = MinDateTime(endDate, memberItem.getProperty("end_date")?.ToDateTime());

                    if (identityItem.getProperty("keyed_name") == IdentityName && DateTime.Now >= newFromDate &&
                        DateTime.Now <= newEndDate)
                    {
                        return(true);
                    }

                    identityIds.Add(
                        new Tuple <string, DateTime, DateTime>(identityItem.getID(), newFromDate, newEndDate));
                }
            }

            return(false);
        }
コード例 #24
0
        public void Cleanup()
        {
            if (!TempItems.Any())
            {
                return;
            }

            Exception ex = null;

            Console.WriteLine($"Cleaning up {TempItems.Count} temp item(s) from Aras DB...\n");

            foreach (var item in TempItems)
            {
                try
                {
                    // create new item to reduce log spam
                    var delItem = Innovator.newItem(item.getType(), "delete");
                    delItem.setID(item.getID());
                    delItem.setProperty("keyed_name", item.getProperty("keyed_name"));
                    if (item.getProperty("affected_id", "") != "")
                    {
                        delItem.setProperty("affected_id", item.getProperty("affected_id"));
                        delItem.setPropertyAttribute("affected_id", "keyed_name",
                                                     item.getPropertyAttribute("affected_id", "keyed_name"));
                    }
                    Innovator.ApplyItem(delItem, false);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e.Message);
                    ex = e; // lazy, but one exception is better than none on multiple failures
                }
            }

            TempItems.Clear();

            if (ex != null)
            {
                throw ex;
            }
        }
コード例 #25
0
        /// <summary>
        /// Sends aml request to Innovator server.
        /// </summary>
        /// <param name="aml">Aml string.</param>
        /// <returns>Response Item object.</returns>
        private Item _SendRequest(string aml)
        {
            if (aml == null)
            {
                throw new ArgumentNullException("aml");
            }

            CheckAuthorization();

            Item requestItem = inn.newItem();

            requestItem.loadAML(aml);
            Item response = requestItem.apply();

            if (response.isError())
            {
                this.ThrowException(response);
            }

            return(response);
        }
コード例 #26
0
        /// <summary>
        /// 根据ID获取PR单
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item GetPrManageObjById(Innovator inn, string id)
        {
            //先获取数据
            var prManage = inn.newItem("B_PRMANAGE", "get");

            prManage.setAttribute("id", id);
            //获取需求信息
            var GetrequestInfo = inn.newItem("B_REQUESTINFO", "get");

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

            //获取询价信息
            var quotationItem = inn.newItem("B_QUOTATIONITEM", "get");

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

            //获取重复采购信息
            var repeatedpurchasing = inn.newItem("B_REPEATEDPURCHASING", "get");

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

            //获取选择的供应商
            var b_ChoiceSuppliers = inn.newItem("b_ChoiceSuppliers", "get");

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


            //获取附件信息
            var prManageFiles = inn.newItem("b_PrManageFiles", "get");

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

            var result = prManage.apply();

            return(result);
        }
コード例 #27
0
        /// <summary>
        /// 编辑出差单
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="itemRoot"></param>
        /// <param name="operation"></param>
        /// <param name="status"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Item EditTripReimbursement(Innovator inn, Item itemRoot, string operation, string status, string id, string b_BTRecordNo)
        {
            var result = inn.newItem();

            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
            {
                if (status == "Start" && !string.IsNullOrEmpty(id))
                {
                    //删除住宿费
                    DelHotelExpenseItem(inn, id);

                    //删除交通费
                    DelTrafficExpenseItem(inn, id);

                    //删除餐费及固定补贴
                    DelMealsandfixedsubsidiesItem(inn, id);

                    //删除其他
                    DelOthersItem(inn, id);

                    //删除借款明细
                    DelLoanItemItem(inn, id);
                }

                result = itemRoot.apply();
                if (!result.isError() && operation == "submit")
                {
                    if (string.IsNullOrEmpty(id))
                    {
                        id = result.getProperty("id");
                    }
                    BusinessTravelDA.UpdateBusinessTravelIsReimbursement(inn, "1", b_BTRecordNo);
                }
                //没有错误,提交事务
                ts.Complete();
            }
            return(result);
        }
コード例 #28
0
        public static void CheckThatInnovatorServerExceptionThrownWhenContextItemIsEmpty()
        {
            const string expectedExceptionMessage = "login_name is not defined";

            TestedMethod.BusinessLogic businessLogic = new TestedMethod.BusinessLogic(fakeDataAccessLayer);
            Innovator innovator = ItemHelper.CreateInnovator();

            Item contextItem = innovator.newItem();
            InnovatorServerException exception = Assert.Throws <InnovatorServerException>(() => businessLogic.Run(contextItem));

            Assert.AreEqual(expectedExceptionMessage, exception.Message);

            string amlOfContextItem =
                @"<AML>
					<Item type='User'>
						<login_name></login_name>
					</Item>
				</AML>"                ;

            contextItem.loadAML(amlOfContextItem);
            exception = Assert.Throws <InnovatorServerException>(() => businessLogic.Run(contextItem));
            Assert.AreEqual(expectedExceptionMessage, exception.Message);
        }
コード例 #29
0
        public ActionResult Create([Bind(Include = "START_DATE,FINISH_DATE,ITEM_NUMBER,COST")] WORK_ORDER wORK_ORDER)
        {
            Innovator inn = (Innovator)Session["innovator"];

            Item itm = inn.newItem("work order", "add");

            itm.setProperty("START_DATE".ToLower(), wORK_ORDER.START_DATE.ToString());
            itm.setProperty("FINISH_DATE".ToLower(), wORK_ORDER.FINISH_DATE.ToString());
            itm.setProperty("ITEM_NUMBER".ToLower(), wORK_ORDER.ITEM_NUMBER.ToString());
            itm.setProperty("COST".ToLower(), wORK_ORDER.COST.ToString());
            itm = itm.apply();
            if (itm.isError())
            {
                TempData["Message"] = itm.getErrorString();
            }
            else
            {
                TempData["Message"] = "新增成功";
            }
            return(RedirectToAction("Index"));


            return(View(wORK_ORDER));
        }
コード例 #30
0
        /// <summary>
        ///     Queries the Innovator instance for the data model defined by the command line options.
        /// </summary>
        /// <remarks>
        ///     This is the method that actually builds up the query items and sends request to the Aras instance.
        /// </remarks>
        /// <returns>An Item object containing all ItemTypes in the data model.</returns>
        private Item FetchAllItemTypes()
        {
            var allItemTypes = _myInnovator.newItem("ItemType", "get");

            allItemTypes.setAttribute("serverEvents", "0");
            allItemTypes.setAttribute("select", "is_relationship, name");

            var logicalItem = _useWiderSearch ? allItemTypes.newOR() : allItemTypes.newAND();

            if (_prefixWasGiven)
            {
                var topLevelOrItem = logicalItem.newOR();
                foreach (string prefix in _prefixList)
                {
                    var orItem = topLevelOrItem.newOR();
                    orItem.setProperty("name", $"{prefix.TrimStart()}*");
                    orItem.setPropertyCondition("name", "like");
                }
            }

            if (_doConsiderPackage)
            {
                var andItem = logicalItem.newAND();
                andItem.setProperty("name", CreatePackageItemTypeCollection());
                andItem.setPropertyCondition("name", "in");
            }

            var morphaeRel = _myInnovator.newItem("Morphae", "get");

            morphaeRel.setAttribute("select", "related_id(name)");
            allItemTypes.addRelationship(morphaeRel);
            var propertyRel = _myInnovator.newItem("Property", "get");

            propertyRel.setAttribute("select", "name, data_type, data_source");
            if (_excludeDefaultProps)
            {
                propertyRel.setPropertyCondition("name", "not in");
                propertyRel.setProperty("name", CreateDefPropsExclusionClause());
            }

            allItemTypes.addRelationship(propertyRel);
            return(allItemTypes.apply());
        }