Ejemplo n.º 1
0
        public static string GetSecureNoticeNew(EventHandlerEnvironment env) //程序划图片表格
        {
            var rpd = new ReportPrintData();

            Writelog(env.Vault.Name + env.Input + "GetSecureNotice : 查询条件");
            try
            {
                var input = JsonConvert.DeserializeObject <ReportInput>(env.Input);

                #region search issuenotice

                var conditions = new SearchConditions();
                {
                    var condition = new SearchCondition
                    {
                        ConditionType = MFConditionType.MFConditionTypeEqual,
                        Expression    =
                        {
                            DataStatusValueType = MFStatusType.MFStatusTypeObjectTypeID
                        }
                    };
                    condition.TypedValue.SetValueToLookup(new Lookup {
                        Item = OtSecureAdjustNotice.ID
                    });
                    //    Writelog("OtSecureAdjustNotice=" + OtSecureAdjustNotice.ID);
                    conditions.Add(-1, condition);
                }
                {
                    var sc = new SearchCondition
                    {
                        ConditionType = MFConditionType.MFConditionTypeNotEqual,
                        Expression    = { DataStatusValueType = MFStatusType.MFStatusTypeDeleted }
                    };
                    sc.TypedValue.SetValue(MFDataType.MFDatatypeBoolean, true);
                    conditions.Add(-1, sc);
                }
                {
                    var condition = new SearchCondition
                    {
                        ConditionType = MFConditionType.MFConditionTypeGreaterThanOrEqual,
                        Expression    = { DataPropertyValuePropertyDef = PropCheckDate.ID }
                    };
                    //   Writelog("PropCheckDate=" + PropCheckDate.ID);
                    condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.StartDate);
                    conditions.Add(-1, condition);
                }
                {
                    var condition = new SearchCondition
                    {
                        ConditionType = MFConditionType.MFConditionTypeLessThanOrEqual,
                        Expression    = { DataPropertyValuePropertyDef = PropCheckDate.ID }
                    };
                    condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.EndDate);
                    conditions.Add(-1, condition);
                }
                if (input.Principal != 0)
                {
                    var condition = new SearchCondition();
                    //  Writelog("PropPrincipal=" + PropPrincipal.ID);
                    condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                    condition.Expression.DataPropertyValuePropertyDef = PropPrincipal.ID;
                    condition.TypedValue.SetValueToLookup(new Lookup {
                        Item = input.Principal
                    });
                    conditions.Add(-1, condition);
                }
                if (input.Receiver != 0)
                {
                    var condition = new SearchCondition();
                    //    Writelog("PropSecureReceiver=" + PropSecureReceiver.ID);
                    condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                    condition.Expression.DataPropertyValuePropertyDef = PropSecureReceiver.ID;
                    condition.TypedValue.SetValueToLookup(new Lookup {
                        Item = input.Receiver
                    });
                    conditions.Add(-1, condition);
                }
                ObjectVersions allwork = env.Vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(conditions,
                                                                                                         MFSearchFlags.MFSearchFlagNone, false, 0, 0).GetAsObjectVersions();

                #endregion search issuenotice

                //  Writelog("allwork=" + allwork.Count);

                string templatefile = GetTemplateFile(env);

                try
                {
                    object oMissing = Missing.Value;
                    object objWhat  = WdGoToItem.wdGoToPage;
                    object objWhich = WdGoToDirection.wdGoToLast;
                    var    app      = new Application();
                    object unknow   = Type.Missing;
                    //  var msocoding = MsoEncoding.msoEncodingSimplifiedChineseGB18030;
                    Document doc = app.Documents.Open(templatefile,
                                                      ref unknow, false, ref unknow, ref unknow, ref unknow,
                                                      //        ref unknow, ref unknow, ref unknow, ref unknow, msocoding,
                                                      ref unknow, ref unknow, ref unknow, ref unknow, ref unknow,
                                                      ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);

                    int    issueindex = 0;//问题唯一序号,跨页接续
                    int    tableindex = 1;
                    string temppath   = Path.GetTempPath();
                    doc.Content.Copy();

                    Writelog(String.Format("vault:{0},conditions{1},results:{2}", env.Vault.Name, env.Input,
                                           allwork.Count));
                    int  rowpos  = 1;//问题填写位置,每页刷新
                    bool newpage = false;
                    foreach (ObjectVersion objectVersion in allwork)
                    {
                        // Writelog("debug info aaaa");
                        if (newpage)
                        {
                            newpage = false;
                            //   Writelog("debug info bbbb");
                            object    nothing = Missing.Value;
                            Paragraph para    = doc.Content.Paragraphs.Add(ref nothing);
                            object    pBreak  = (int)WdBreakType.wdSectionBreakNextPage;
                            para.Range.InsertBreak(ref pBreak);
                            //   Writelog("debug info bbbb1111");

                            app.Selection.GoTo(ref objWhat, ref objWhich, ref unknow, ref unknow);
                            //    Writelog("debug info dddd");

                            app.Selection.Paste();
                            //   Writelog("debug info ffff");
                            tableindex++;
                            rowpos = 1;
                        }

                        PropertyValues onepvs = env.Vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);
                        issueindex++;

                        string issuename = env.Vault.Name;
                        //  Writelog("debug info 6666");
                        doc.Tables[tableindex].Cell(4, 2).Range.Text = issuename;


                        //   Writelog("debug info 7777");
                        int rowindex = 6 + rowpos;

                        string secureissuename = onepvs.SearchForProperty(PropIssueCategory).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 1).Range.Text =
                            issueindex.ToString(CultureInfo.InvariantCulture);

                        doc.Tables[tableindex].Cell(rowindex, 2).Range.Text = secureissuename;
                        doc.Tables[tableindex].Cell(rowindex, 3).Range.Text =
                            onepvs.SearchForProperty(PropSecureIssues.ID).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 4).Range.Text =
                            onepvs.SearchForProperty(PropAdjustMeasure.ID).GetValueAsLocalizedText();

                        doc.Tables[tableindex].Cell(rowindex, 5).Range.Text =
                            onepvs.SearchForProperty(PropPrincipal.ID)
                            .GetValueAsLocalizedText();


                        doc.Tables[tableindex].Cell(rowindex, 6).Range.Text =
                            onepvs.SearchForProperty(PropSecureReceiver.ID)
                            .GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 7).Range.Text =
                            onepvs.SearchForProperty(PropAdjustMan.ID)
                            .GetValueAsLocalizedText();


                        doc.Tables[tableindex].Cell(rowindex, 8).Range.Text =
                            onepvs.SearchForProperty(PropFuChaRen.ID)
                            .GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 9).Range.Text =
                            onepvs.SearchForProperty(PropCountercheckDescription.ID)
                            .GetValueAsLocalizedText();
                        //       Writelog(string.Format("表 {0}, 行 {1},序号 {2}, 行号 {3}",tableindex,rowindex,issueindex,rowpos));
                        if (rowpos++ >= 10)
                        {
                            newpage = true;
                        }
                    }

                    int index = 0;
                    foreach (ObjectVersion objectVersion in allwork)
                    {
                        PropertyValues onepvs = env.Vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);

                        object    nothing = Missing.Value;
                        Paragraph para    = doc.Content.Paragraphs.Add(ref nothing);
                        object    pBreak  = (int)WdBreakType.wdSectionBreakNextPage;
                        para.Range.InsertBreak(ref pBreak);

                        app.Selection.GoTo(ref objWhat, ref objWhich, ref unknow, ref unknow);

                        app.Selection.PageSetup.Orientation = WdOrientation.wdOrientPortrait;
                        Range range = app.Selection.Range;
                        Table table = app.Selection.Tables.Add(range, 7, 1, ref oMissing, ref oMissing);

                        table.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleDouble;
                        table.Borders.InsideLineStyle  = WdLineStyle.wdLineStyleSingle;
                        table.Cell(1, 1).Split(1, 2);
                        for (int i = 2; i <= 3; i++)
                        {
                            table.Cell(i, 1).Split(1, 4);
                        }

                        //Writelog("debug info 888111");
                        //app.Selection.TypeText("序号:" + page);
                        //Writelog("debug info 999000 v1");
                        table.Cell(1, 1).Range.Text = "序号:";
                        table.Cell(1, 2).Range.Text = (++index).ToString(CultureInfo.InvariantCulture);
                        //table.Cell(1, 3).Range.Text = "存在问题:";
                        //table.Cell(1, 4).Range.Text =
                        //    onepvs.SearchForProperty(PropSecureIssues.ID).GetValueAsLocalizedText();
                        //Writelog("debug info 1111 v1-" + tableindex);
                        //table.Cell(rowindex, 1).Range.Text = "检查负责人:";
                        table.Cell(2, 1).Range.Text = "检查日期:";
                        //table.Cell(2, 2).Range.Text =
                        //    onepvs.SearchForProperty(PropPrincipal.ID)
                        //        .GetValueAsLocalizedText();
                        table.Cell(2, 2).Range.Text =
                            onepvs.SearchForProperty(PropCheckDate.ID)
                            .GetValueAsLocalizedText();
                        //Writelog("debug info 222 v1-" + tableindex);
                        //table.Cell(rowindex, 1).Range.Text = "接收人  :";
                        //table.Cell(rowindex++, 3).Range.Text = "整改人:";
                        //table.Cell(3, 2).Range.Text =
                        //    onepvs.SearchForProperty(PropSecureReceiver.ID)
                        //        .GetValueAsLocalizedText();
                        //table.Cell(3, 4).Range.Text =
                        //    onepvs.SearchForProperty(PropAdjustMan.ID)
                        //        .GetValueAsLocalizedText();
                        //   Writelog("debug info 333 v1-" + tableindex);
                        table.Cell(2, 3).Range.Text = "整改期限  :";
                        table.Cell(3, 3).Range.Text = "整改次数:";
                        table.Cell(2, 4).Range.Text =
                            onepvs.SearchForProperty(PropZhengGaiQiXin.ID)
                            .GetValueAsLocalizedText();
                        table.Cell(3, 4).Range.Text =
                            onepvs.SearchForProperty(PropRectificationCount.ID)
                            .GetValueAsLocalizedText();
                        //Writelog("debug info 444 v1-" + tableindex);
                        //table.Cell(rowindex, 1).Range.Text = "复查人  :";
                        table.Cell(3, 1).Range.Text = "复查日期:";
                        //table.Cell(5, 2).Range.Text =
                        //    onepvs.SearchForProperty(PropFuChaRen.ID)
                        //        .GetValueAsLocalizedText();
                        table.Cell(3, 2).Range.Text =
                            onepvs.SearchForProperty(PropReviewDate.ID)
                            .GetValueAsLocalizedText();
                        //    Writelog("debug info 555 v1-" + tableindex);
                        // int rowindex = 2;
                        table.Cell(4, 1).Range.Text = "整改前照片:";
                        table.Cell(6, 1).Range.Text = "复查照片:";
                        ObjectFiles files  = env.Vault.ObjectFileOperations.GetFiles(objectVersion.ObjVer);
                        int         picrow = 5;
                        //  Writelog("before 000000000000");
                        foreach (ObjectFile objectFile in files)
                        {
                            string apicture = temppath + objectFile.GetNameForFileSystem();
                            env.Vault.ObjectFileOperations.DownloadFile(objectFile.ID,
                                                                        objectFile.Version, apicture);
                            object      linkToFile       = false;
                            object      saveWithDocument = true;
                            object      anchor           = table.Cell(picrow, 1).Range;
                            InlineShape insh             = doc.InlineShapes.AddPicture(apicture, ref linkToFile,
                                                                                       ref saveWithDocument,
                                                                                       ref anchor);
                            insh.Height = 259;
                            insh.Width  = 416;
                            picrow     += 2;
                            if (picrow > 7)
                            {
                                break;
                            }
                        }
                    }
                    doc.Close();
                    app.Quit();
                }
                catch (Exception ex)
                {
                    Writelog(ex.Message);
                }

                var pvs = new PropertyValues();
                var pv  = new PropertyValue {
                    PropertyDef = 0
                };
                pv.Value.SetValue(MFDataType.MFDatatypeText, "securenoticereport");
                pvs.Add(-1, pv);
                pv.PropertyDef = 100;
                pv.Value.SetValueToLookup(new Lookup {
                    Item = ClassSecureReport
                });
                pvs.Add(-1, pv);
                var file = new SourceObjectFile {
                    Title = "report", SourceFilePath = templatefile, Extension = "docx"
                };

                try
                {
                    ObjectVersionAndProperties t = env.Vault.ObjectOperations.CreateNewSFDObject(0, pvs, file, true);
                    ObjectFiles f = env.Vault.ObjectFileOperations.GetFiles(t.ObjVer);

                    rpd.Objid       = t.ObjVer.ID;
                    rpd.Objtype     = t.ObjVer.Type;
                    rpd.Objversion  = t.ObjVer.Version;
                    rpd.Fileid      = f[1].FileVer.ID;
                    rpd.Fileversion = f[1].FileVer.Version;
                }
                catch (Exception ex)
                {
                    Writelog("getsecurenotice - create object :" + ex.Message);
                }
            }
            catch (Exception ex)
            {
                Writelog(env.Input + "GetSecureNotice error:" + ex.Message);
            }
            var ret = JsonConvert.SerializeObject(rpd, Formatting.None);
            Writelog("GetSecureNotice ok return:" + ret);
            return(ret);
        }
Ejemplo n.º 2
0
        public string ObjectToSystem(int objType, MfClass mfClass, List <MfClassPropDef> selProps, List <string> propValues)
        {
            var err     = String.Empty;
            var log     = TraceLog.GetLogger <MfVault>(MethodBase.GetCurrentMethod().Name);
            var classId = mfClass.Id;

            try
            {
                var scs = new SearchConditions();
                for (var i = 0; i < selProps.Count; i++)
                {
                    var p  = selProps[i];
                    var vv = propValues[i];
                    try
                    {
                        var sc = GetCondition(p, vv, log);
                        scs.Add(-1, sc);
                    }
                    catch (Exception ex)
                    {
                        err = "创建对象失败:" + ex.Message; //files.GetFullpath(f.Filepath) + " # " +
                        log.TraceEvent(TraceEventType.Error, 0, err);
                        return(err);
                    }
                }
                var classSC = new SearchCondition {
                    ConditionType = MFConditionType.MFConditionTypeEqual
                };
                classSC.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                classSC.TypedValue.SetValue(MFDataType.MFDatatypeLookup, classId);
                scs.Add(-1, classSC);

                var res = _vault.ObjectSearchOperations.SearchForObjectsByConditions(scs,
                                                                                     MFSearchFlags.MFSearchFlagNone, false).GetAsObjectVersions();
                if (res.Count > 0)
                {
                    err = "对象已存在:" + res[1].Title;
                    log.TraceEvent(TraceEventType.Warning, 0, err);
                    return(err);
                }
                else
                {
                    try
                    {
                        var pvs = new PropertyValues();
                        for (var i = 0; i < selProps.Count; i++)
                        {
                            var p   = selProps[i];
                            var vv  = propValues[i];
                            var val = GetValue(p.PropDef, vv, log);
                            var pv  = new PropertyValue {
                                PropertyDef = p.Def
                            };
                            if (val == null)
                            {
                                pv.Value.SetValueToNULL((MFDataType)p.DataType);
                            }
                            else
                            {
                                pv.Value.SetValue((MFDataType)p.DataType, val);
                            }
                            pvs.Add(-1, pv);
                        }
                        var cPV = new PropertyValue {
                            PropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass
                        };
                        cPV.Value.SetValue(MFDataType.MFDatatypeLookup, classId);
                        pvs.Add(-1, cPV);
                        var obj =
                            _vault.ObjectOperations.CreateNewObject(objType, pvs);
                        _vault.ObjectOperations.CheckIn(obj.ObjVer);
                        log.TraceInformation("创建对象:" + obj.VersionData.Title);
                        return(err);
                    }
                    catch (Exception ex)
                    {
                        err = "创建对象失败:" + ex.Message; //files.GetFullpath(f.Filepath) + " # " +
                        log.TraceEvent(TraceEventType.Error, 0, err);
                        return(err);
                    }
                }
            }
            catch (Exception ex)
            {
                err = "属性值有误:" + ex.Message;
                log.TraceEvent(TraceEventType.Error, 0, err);
                return(err);
            }
            finally
            {
                log.Close();
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e, Vault currVault, MFilesClientApplication mFilesApp)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "XML Files (*.xml) | *.xml";

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                //open XML file
                XElement inputFile = XElement.Load(openFile.FileName);
                IEnumerable <XElement> inputxml = from el in inputFile.Element("Payables").Elements() select el;


                //loop through items
                int count = 0;
                foreach (XElement payable in inputxml)
                {
                    //Check that a check has been cut in Yardi.
                    if (payable.Element("Details").Element("Detail").Elements("CheckNumber").Any())
                    {
                        string checkNumber = payable.Element("Details").Element("Detail").Element("CheckNumber").Value;
                        //MessageBox.Show(checkNumber);

                        //Find Invoice in mFiles
                        //pull invoices using search conditions
                        var searchConditions = new SearchConditions();

                        //is it not deleted
                        var isNotDeleted = new SearchCondition();
                        isNotDeleted.Expression.DataStatusValueType         = MFStatusType.MFStatusTypeDeleted;
                        isNotDeleted.Expression.DataStatusValueDataFunction = MFDataFunction.MFDataFunctionNoOp;
                        isNotDeleted.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                        isNotDeleted.TypedValue.SetValue(MFDataType.MFDatatypeBoolean, true);
                        searchConditions.Add(-1, isNotDeleted);

                        //is it part of the Invoice workflow
                        var isInvoice = new SearchCondition();
                        isInvoice.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefWorkflow;
                        isInvoice.ConditionType = MFConditionType.MFConditionTypeEqual;
                        isInvoice.TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.invoiceWorkflow);
                        searchConditions.Add(-1, isInvoice);

                        //is it in the payment processing state
                        var isAccounting = new SearchCondition();
                        isAccounting.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefState;
                        isAccounting.ConditionType = MFConditionType.MFConditionTypeEqual;
                        isAccounting.TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.stateProcessing);
                        searchConditions.Add(-1, isAccounting);

                        //is it the correct payable
                        var isPayable = new SearchCondition();
                        isPayable.Expression.DataPropertyValuePropertyDef = Properties.Settings.Default.propInvoiceNumber;
                        isPayable.ConditionType = MFConditionType.MFConditionTypeEqual;
                        isPayable.TypedValue.SetValue(MFDataType.MFDatatypeText, payable.Element("InvoiceNumber").Value);
                        searchConditions.Add(-1, isPayable);

                        //Perform search
                        var invoices = currVault.ObjectSearchOperations.SearchForObjectsByConditions(searchConditions, MFSearchFlags.MFSearchFlagNone, false);

                        foreach (ObjectVersion invoice in invoices)
                        {
                            var propValues        = new PropertyValues();
                            var currPropertyValue = new PropertyValue();
                            propValues = currVault.ObjectPropertyOperations.GetProperties(invoice.ObjVer);

                            //currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propCheckNumber);
                            count++;
                            propValues.SearchForProperty(Properties.Settings.Default.propCheckNumber).TypedValue.SetValue(MFDataType.MFDatatypeText, checkNumber);
                            //change workflow state
                            propValues.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefState).TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.stateComplete);
                            currVault.ObjectPropertyOperations.SetAllProperties(invoice.ObjVer, true, propValues);
                        }
                    }
                }
                MessageBox.Show(count.ToString() + " Invoices update in mFiles!");
            }
        }
Ejemplo n.º 4
0
        //Export Button
        private void button1_Click(object sender, EventArgs e, Vault currVault, MFilesClientApplication mFilesApp)
        {
            //MessageBox.Show(currVault.Name);

            SaveFileDialog saveFile = new SaveFileDialog();

            saveFile.Filter = "XML Files (*.xml)|*.xml";


            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                //pull invoices using search conditions
                var searchConditions = new SearchConditions();

                //is it not deleted
                var isNotDeleted = new SearchCondition();
                isNotDeleted.Expression.DataStatusValueType         = MFStatusType.MFStatusTypeDeleted;
                isNotDeleted.Expression.DataStatusValueDataFunction = MFDataFunction.MFDataFunctionNoOp;
                isNotDeleted.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                isNotDeleted.TypedValue.SetValue(MFDataType.MFDatatypeBoolean, true);
                searchConditions.Add(-1, isNotDeleted);

                //is it part of the Invoice workflow
                var isInvoice = new SearchCondition();
                isInvoice.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefWorkflow;
                isInvoice.ConditionType = MFConditionType.MFConditionTypeEqual;
                isInvoice.TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.invoiceWorkflow);
                searchConditions.Add(-1, isInvoice);

                //is it in the accounting state
                var isAccounting = new SearchCondition();
                isAccounting.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefState;
                isAccounting.ConditionType = MFConditionType.MFConditionTypeEqual;
                isAccounting.TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.stateAccounting);
                searchConditions.Add(-1, isAccounting);

                //Perform search
                var invoices = currVault.ObjectSearchOperations.SearchForObjectsByConditions(searchConditions, MFSearchFlags.MFSearchFlagNone, false);


                //start output file
                XElement output   = new XElement("YsiTran");
                XElement payables = new XElement("Payables");

                //get post month
                var postMonthForm = new PostMonth();
                postMonthForm.ShowDialog();

                //loop through invoices collecting at import workflow state, build XML file from the inside out.
                int count = 0;
                foreach (ObjectVersion invoice in invoices)
                {
                    XElement payable     = new XElement("Payable");
                    double   totalAmount = 0;
                    count++;

                    var propValues        = new PropertyValues();
                    var currPropertyValue = new PropertyValue();
                    var objLedger         = new ObjectVersion();
                    propValues = currVault.ObjectPropertyOperations.GetProperties(invoice.ObjVer);

                    XElement details = new XElement("Details");

                    //Get Ledger Entry reference
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propLedgerEntry);

                    if (currPropertyValue.TypedValue.DataType == MFDataType.MFDatatypeMultiSelectLookup)
                    {
                        var lookups = new Lookups();

                        lookups = currPropertyValue.TypedValue.GetValueAsLookups();

                        int i = 0;
                        foreach (Lookup lookup in lookups)
                        {
                            XElement detail = new XElement("Detail");

                            var propDef = new PropertyDef();
                            propDef = currVault.PropertyDefOperations.GetPropertyDef(currPropertyValue.PropertyDef);
                            var valListObjType = new ObjType();
                            valListObjType = currVault.ValueListOperations.GetValueList(propDef.ValueList);

                            if (valListObjType.RealObjectType)
                            {
                                i++;
                                //Get Ledgery Entry Object
                                var objDetail = new ObjVer();
                                objDetail.SetIDs(valListObjType.ID, lookup.Item, lookup.Version);
                                var detailValues = new PropertyValues();
                                var detailValue  = new PropertyValue();
                                detailValues = currVault.ObjectPropertyOperations.GetProperties(objDetail);
                                //MessageBox.Show(i.ToString());
                                //Get Account
                                detailValue = detailValues.SearchForProperty(Properties.Settings.Default.propAccount);
                                if (detailValue.TypedValue.DataType == MFDataType.MFDatatypeMultiSelectLookup)
                                {
                                    Lookup lookupAccount = new Lookup();
                                    lookupAccount = detailValue.TypedValue.GetValueAsLookup();

                                    propDef        = currVault.PropertyDefOperations.GetPropertyDef(detailValue.PropertyDef);
                                    valListObjType = currVault.ValueListOperations.GetValueList(propDef.ValueList);

                                    if (valListObjType.RealObjectType)
                                    {
                                        //Get Account Number
                                        var objAccount = new ObjVer();
                                        objAccount.SetIDs(valListObjType.ID, lookupAccount.Item, lookupAccount.Version);
                                        var accountValues = new PropertyValues();
                                        var accountValue  = new PropertyValue();
                                        accountValues = currVault.ObjectPropertyOperations.GetProperties(objAccount);
                                        accountValue  = accountValues.SearchForProperty(Properties.Settings.Default.propGLCode);
                                        XElement account = new XElement("AccountId");
                                        account.SetValue(accountValue.GetValueAsLocalizedText());
                                        detail.Add(account);
                                    }
                                }

                                //get Description-Notes
                                detailValue = detailValues.SearchForProperty(Properties.Settings.Default.propDescription);
                                XElement notes = new XElement("Notes");
                                notes.SetValue(detailValue.GetValueAsLocalizedText());
                                detail.Add(notes);

                                //get Amount
                                detailValue = detailValues.SearchForProperty(Properties.Settings.Default.propGLAmount);
                                XElement amount = new XElement("Amount");
                                amount.SetValue(detailValue.GetValueAsLocalizedText());
                                detail.Add(amount);
                                totalAmount += Convert.ToDouble(detailValue.GetValueAsLocalizedText());
                            }

                            XElement propertyID = new XElement("PropertyId");
                            detail.Add(propertyID);
                            details.Add(detail);
                        }
                    }

                    //Get Property ID
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propProperty);
                    if (currPropertyValue.TypedValue.DataType == MFDataType.MFDatatypeMultiSelectLookup)
                    {
                        //Getlookup of property to find object
                        var lookup = new Lookup();
                        lookup = currPropertyValue.TypedValue.GetValueAsLookup();
                        var propDef = new PropertyDef();
                        propDef = currVault.PropertyDefOperations.GetPropertyDef(currPropertyValue.PropertyDef);
                        var valListObjType = new ObjType();
                        valListObjType = currVault.ValueListOperations.GetValueList(propDef.ValueList);

                        if (valListObjType.RealObjectType)
                        {
                            //Get property ID
                            var objProperty = new ObjVer();
                            objProperty.SetIDs(valListObjType.ID, lookup.Item, lookup.Version);
                            var propertyValues = new PropertyValues();
                            var propertyValue  = new PropertyValue();
                            propertyValues = currVault.ObjectPropertyOperations.GetProperties(objProperty);
                            propertyValue  = propertyValues.SearchForProperty(Properties.Settings.Default.propPropertyID);



                            IEnumerable <XElement> ieDetails = from el in details.Elements() select el;


                            //loop through items

                            foreach (XElement detail in ieDetails)
                            {
                                //Check that a check has been cut in Yardi.
                                if (detail.Elements("PropertyId").Any())
                                {
                                    detail.Element("PropertyId").SetValue(propertyValue.GetValueAsLocalizedText());
                                }
                            }
                        }
                    }

                    //Get Vendor ID
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propVendor);
                    if (currPropertyValue.TypedValue.DataType == MFDataType.MFDatatypeMultiSelectLookup)
                    {
                        //Getlookup of vendor to find object
                        var lookup = new Lookup();
                        lookup = currPropertyValue.TypedValue.GetValueAsLookup();
                        var propDef = new PropertyDef();
                        propDef = currVault.PropertyDefOperations.GetPropertyDef(currPropertyValue.PropertyDef);
                        var valListObjType = new ObjType();
                        valListObjType = currVault.ValueListOperations.GetValueList(propDef.ValueList);

                        if (valListObjType.RealObjectType)
                        {
                            //Get Vendor ID
                            var objProperty = new ObjVer();
                            objProperty.SetIDs(valListObjType.ID, lookup.Item, lookup.Version);
                            var vendorValues = new PropertyValues();
                            var vendorValue  = new PropertyValue();
                            vendorValues = currVault.ObjectPropertyOperations.GetProperties(objProperty);
                            vendorValue  = vendorValues.SearchForProperty(Properties.Settings.Default.propYardiCode);
                            XElement propertyID = new XElement("PersonId");
                            propertyID.SetValue(vendorValue.GetValueAsLocalizedText());
                            payable.Add(propertyID);
                        }
                    }

                    // Add details to payable
                    payable.Add(details);

                    //Add Post Month
                    XElement postMonth = new XElement("PostMonth");
                    postMonth.SetValue(postMonthForm.StrPostMonth);
                    payable.Add(postMonth);

                    //Get link to object
                    XElement link    = new XElement("Notes");
                    string   strLink = "m-files://show/" + Properties.Settings.Default.vaultGUID + "/" + invoice.ObjVer.Type.ToString() + "-" + invoice.ObjVer.ID.ToString();
                    link.SetValue(strLink);
                    payable.Add(link);

                    //get Invoice Number
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propInvoiceNumber);
                    XElement invoiceNumber = new XElement("InvoiceNumber");
                    invoiceNumber.SetValue(currPropertyValue.GetValueAsLocalizedText());
                    payable.Add(invoiceNumber);

                    //get Invoice date
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propInvoiceDate);
                    XElement invoiceDate = new XElement("InvoiceDate");
                    invoiceDate.SetValue(currPropertyValue.GetValueAsLocalizedText());
                    payable.Add(invoiceDate);

                    //get Due Date
                    currPropertyValue = propValues.SearchForProperty(Properties.Settings.Default.propDueDate);
                    XElement dueDate = new XElement("DueDate");
                    dueDate.SetValue(currPropertyValue.GetValueAsLocalizedText());
                    payable.Add(dueDate);

                    //Set Expense Type
                    XElement expenseType = new XElement("ExpenseType");
                    expenseType.SetValue("Contract");
                    payable.Add(expenseType);


                    //Set Total
                    XElement total = new XElement("TotalAmount");
                    total.SetValue(totalAmount.ToString());


                    payables.Add(payable);

                    //change workflow state
                    propValues.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefState).TypedValue.SetValue(MFDataType.MFDatatypeLookup, Properties.Settings.Default.stateProcessing);
                    currVault.ObjectPropertyOperations.SetAllProperties(invoice.ObjVer, true, propValues);
                }



                output.Add(payables);
                output.Save(saveFile.FileName);
                MessageBox.Show(count.ToString() + " Files Exported!");
            }
        }
        public static T search <T>(Vault vault, int objTypeId, int objOrExtObjId, bool includeDeleted)
            where T : IObjVerEx, new()
        {
            SearchConditions searchConditions = new SearchConditions();
            SearchCondition  searchCondition  = new SearchCondition();

            // Object type id condition
            searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeLookup, objTypeId);
            searchConditions.Add(1, searchCondition);

            // External objects condition
            searchCondition = new SearchCondition();
            searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeExtID);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeText, objOrExtObjId);
            searchConditions.Add(2, searchCondition);

            // Include deleted objects condition
            searchCondition = new SearchCondition();
            searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeDeleted);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeBoolean, includeDeleted);
            searchConditions.Add(3, searchCondition);

            // Search for external objects
            ObjectSearchResults objSearchResults =
                vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(
                    searchConditions, MFSearchFlags.MFSearchFlagNone, false);

            ObjectVersionAndProperties objVerAndProps = null;

            if (objSearchResults != null && objSearchResults.Count > 0)
            {
                IEnumerator   searchResultObjVerEnum = objSearchResults.GetAsObjectVersions().GetEnumerator();
                ObjectVersion objectVersion          = null;
                searchResultObjVerEnum.MoveNext();
                objectVersion  = (ObjectVersion)searchResultObjVerEnum.Current;
                objVerAndProps = vault.ObjectOperations.GetLatestObjectVersionAndProperties(objectVersion.ObjVer.ObjID, false);
                return(new T()
                {
                    objVerEx = new ObjVerEx(vault, objVerAndProps)
                });
            }
            else
            {
                // Non-external objects condition
                searchCondition = new SearchCondition();
                searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectID);
                searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
                searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeInteger, objOrExtObjId);
                searchConditions.Add(2, searchCondition);

                // Search for non-external objects
                objSearchResults =
                    vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(
                        searchConditions, MFSearchFlags.MFSearchFlagNone, false);

                if (objSearchResults != null && objSearchResults.Count > 0)
                {
                    IEnumerator   searchResultObjVerEnum = objSearchResults.GetAsObjectVersions().GetEnumerator();
                    ObjectVersion objectVersion          = null;
                    searchResultObjVerEnum.MoveNext();
                    objectVersion  = (ObjectVersion)searchResultObjVerEnum.Current;
                    objVerAndProps = vault.ObjectOperations.GetLatestObjectVersionAndProperties(objectVersion.ObjVer.ObjID, false);
                    return(new T()
                    {
                        objVerEx = new ObjVerEx(vault, objVerAndProps)
                    });
                }
                else
                {
                    return(default(T));
                }
            }
        }
Ejemplo n.º 6
0
        public MFProjectParty GetParty(MFilesVault vault, string partyName, MetadataAliases aliases, int?currentUserId = null)
        {
            var mfVault    = MFServerUtility.GetVault(vault);
            var partyObj   = aliases.Objects["ObjParticipant"];
            var partyClass = partyObj.ClassDict["ClassParticipant"];
            var typeId     = MfAlias.GetObjType(mfVault, partyObj.Alias);
            var classId    = MfAlias.GetObjectClass(mfVault, partyClass.Alias);

            var scs = new SearchConditions();

            MFSearchConditionUtils.AddBaseConditions(scs, typeId, classId);

            var namePropId = MfAlias.GetPropDef(mfVault, partyClass.PropDict["PropParticipantName"]);
            var nameSC     = MFSearchConditionUtils.Property(MFConditionType.MFConditionTypeEqual, namePropId,
                                                             MFDataType.MFDatatypeText, partyName);

            scs.Add(-1, nameSC);

            var res = mfVault.ObjectSearchOperations.SearchForObjectsByConditions(scs, MFSearchFlags.MFSearchFlagNone,
                                                                                  false);

            if (res.Count != 1)
            {
                return(null);
            }

            var party = new MFProjectParty {
                Name = partyName
            };
            var obj = res[1];

            party.InternalId = obj.ObjVer.ID;
            var managerPropId = MfAlias.GetPropDef(mfVault, partyClass.PropDict["PropProjPM"]);
            var managerTV     = mfVault.ObjectPropertyOperations.GetProperty(obj.ObjVer, managerPropId).Value;

            if (!managerTV.IsNULL() && !managerTV.IsUninitialized())
            {
                party.ManagerCount = 1;
                var contactId = managerTV.GetLookupID();
                var userId    = GetContactAccount(mfVault, aliases, contactId);
                if (currentUserId != null && userId == currentUserId.Value)
                {
                    party.IsCurrentManager = true;
                }
            }
            var vmPropId = MfAlias.GetPropDef(mfVault, partyClass.PropDict["PropProjVicePMs"]);
            var vmTV     = mfVault.ObjectPropertyOperations.GetProperty(obj.ObjVer, vmPropId).Value;

            if (!vmTV.IsNULL() && !vmTV.IsUninitialized())
            {
                var lkps = vmTV.GetValueAsLookups();
                party.ViceManagerCount = lkps.Count;
                if (currentUserId != null && !party.IsCurrentManager)
                {
                    for (var i = 1; i <= lkps.Count; i++)
                    {
                        var contactId = lkps[i].Item;
                        var userId    = GetContactAccount(mfVault, aliases, contactId);
                        if (userId == currentUserId.Value)
                        {
                            party.IsCurrentViceManager = true;
                            break;
                        }
                    }
                }
            }
            var mmPropId = MfAlias.GetPropDef(mfVault, partyClass.PropDict["PropMembers"]);
            var mmTV     = mfVault.ObjectPropertyOperations.GetProperty(obj.ObjVer, mmPropId).Value;

            if (!mmTV.IsNULL() && !mmTV.IsUninitialized())
            {
                var lkps = mmTV.GetValueAsLookups();
                party.MemberCount = lkps.Count;
                if (currentUserId != null && !party.IsCurrentViceManager && !party.IsCurrentManager)
                {
                    for (var i = 1; i <= lkps.Count; i++)
                    {
                        var contactId = lkps[i].Item;
                        var userId    = GetContactAccount(mfVault, aliases, contactId);
                        if (userId == currentUserId.Value)
                        {
                            party.IsCurrentMember = true;
                            break;
                        }
                    }
                }
            }

            return(party);
        }
        public static List <T> search_property_definition <T, T2>(this IObjVerEx obj, int propertyDefinitionID, T2 value, int propertyDefinition2ID, IObjVerEx value2, int propertyDefinition3ID, IObjVerEx value3, bool includeDeleted = false)
            where T : IObjVerEx, new()
        {
            SearchCondition  searchCondition;
            SearchConditions searchConditions = new SearchConditions();

            Type   t = typeof(T);
            object o = Activator.CreateInstance <T>();

            FieldInfo[] fields = t.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
            int         oid    = -1;

            foreach (FieldInfo f in fields)
            {
                if (f.Name == "TypeID")
                {
                    oid = Convert.ToInt32(f.GetValue(o));
                }
            }

            searchCondition = new SearchCondition();
            searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeLookup, oid);
            searchConditions.Add(-1, searchCondition);

            searchCondition = new SearchCondition();
            searchCondition.Expression.SetPropertyValueExpression(propertyDefinitionID, MFParentChildBehavior.MFParentChildBehaviorNone);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeText, value);
            searchConditions.Add(-1, searchCondition);

            searchCondition = new SearchCondition();
            searchCondition.Expression.SetPropertyValueExpression(propertyDefinition2ID, MFParentChildBehavior.MFParentChildBehaviorNone);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeLookup, value2.objVerEx.ToLookup());
            searchConditions.Add(-1, searchCondition);

            searchCondition = new SearchCondition();
            searchCondition.Expression.SetPropertyValueExpression(propertyDefinition3ID, MFParentChildBehavior.MFParentChildBehaviorNone);
            searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
            searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeLookup, value3.objVerEx.ToLookup());
            searchConditions.Add(-1, searchCondition);

            if (!includeDeleted)
            {
                searchCondition = new SearchCondition();
                searchCondition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeDeleted);
                searchCondition.ConditionType = MFConditionType.MFConditionTypeEqual;
                searchCondition.TypedValue.SetValue(MFDataType.MFDatatypeBoolean, false);
                searchConditions.Add(-1, searchCondition);
            }

            ObjectSearchResults objectSearchResults =
                obj.objVerEx.Vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(searchConditions, MFSearchFlags.MFSearchFlagNone, false);

            List <T> searchedOT = new List <T>();

            if (objectSearchResults != null && objectSearchResults.Count > 0)
            {
                IEnumerator   searchResultObjVerEnum = objectSearchResults.GetAsObjectVersions().GetEnumerator();
                ObjectVersion objectVersion          = null;
                while (searchResultObjVerEnum.MoveNext())
                {
                    objectVersion = (ObjectVersion)searchResultObjVerEnum.Current;
                    ObjectVersionAndProperties objVerAndProps =
                        obj.objVerEx.Vault.ObjectOperations.GetLatestObjectVersionAndProperties(objectVersion.ObjVer.ObjID, true);
                    T item = new T()
                    {
                        objVerEx = new ObjVerEx(obj.objVerEx.Vault, objVerAndProps)
                    };
                    searchedOT.Add(item);
                }
            }
            return(searchedOT);
        }
Ejemplo n.º 8
0
        private string GetSecureNotice(EventHandlerEnvironment env)
        {
            ReportInput input = new ReportInput();

            Writelog(env.Input + "GetSecureNotice :");
            try
            {
                input = JsonConvert.DeserializeObject <ReportInput>(env.Input);
            }
            catch (Exception ex)
            {
                Writelog(env.Input + "GetSecureNotice error:" + ex.Message);
                return(JsonConvert.SerializeObject("-1", Formatting.None));
            }
            #region search issuenotice
            var conditions = new SearchConditions();
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = ClassSecureNotice.ID
                });
                conditions.Add(-1, condition);
            }
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeGreaterThanOrEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropCheckDate.ID;
                condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.startDate);
                conditions.Add(-1, condition);
            }
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeLessThanOrEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropCheckDate.ID;
                condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.endDate);
                conditions.Add(-1, condition);
            }
            if (input.principal != 0)
            {
                var condition = new SearchCondition();

                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropPrincipal.ID;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = input.principal
                });
                conditions.Add(-1, condition);
            }
            if (input.receiver != 0)
            {
                var condition = new SearchCondition();

                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropSecureReceiver.ID;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = input.receiver
                });
                conditions.Add(-1, condition);
            }
            var allwork = env.Vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(conditions,
                                                                                          MFSearchFlags.MFSearchFlagNone, false, 0, 0).GetAsObjectVersions();
            #endregion search issuenotice

            var templatefile = GetTemplateFile(env);
            if (string.IsNullOrEmpty(templatefile))
            {
                return(JsonConvert.SerializeObject("-2", Formatting.None));
            }
            try
            {
                var app    = new Microsoft.Office.Interop.Word.Application();
                var unknow = Type.Missing;
                //  var msocoding = MsoEncoding.msoEncodingSimplifiedChineseGB18030;
                var doc = app.Documents.Open(templatefile,
                                             ref unknow, false, ref unknow, ref unknow, ref unknow,
                                             //        ref unknow, ref unknow, ref unknow, ref unknow, msocoding,
                                             ref unknow, ref unknow, ref unknow, ref unknow, ref unknow,
                                             ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
                //var num = 0;
                //foreach (Table table in doc.Tables)
                //{
                //    Writelog(string.Format("table[{0}],Columns[{1}],,Rows[{2}]", num, table.Columns.Count, table.Rows.Count));
                //    for (int i = 0; i < table.Columns.Count; i++)
                //    {
                //        for (int j = 0; j < table.Rows.Count; j++)
                //        {
                //            try
                //            {
                //                var text = table.Cell(j, i).Range.Text;

                //                Writelog(string.Format("table[{0}],Columns[{1}],Rows[{2}],text[{3}]", num, i, j, text));
                //            }
                //            catch (Exception ex)
                //            {
                //                Writelog(string.Format("table[{0}],Columns[{1}],Rows[{2}],message[{3}]", num, i, j, ex.Message));
                //            }
                //        }
                //    }
                //    num++;
                //}
                //Writelog("num=" + num);


                var page       = 0;
                var tableindex = 0;
                var temppath   = System.IO.Path.GetTempPath();
                doc.Tables[1].Range.Copy();
                var issuename       = string.Empty;
                var secureissuename = string.Empty;

                foreach (ObjectVersion objectVersion in allwork)
                {
                    if (page > 0)
                    {
                        doc.Content.InsertParagraphAfter();
                        doc.Content.InsertAfter(" ");
                        object WdLine   = Microsoft.Office.Interop.Word.WdUnits.wdLine; //换一行;
                        var    movedown = app.Selection.MoveDown(ref WdLine, 21);       //移动焦点
                        Writelog(string.Format(" before paste table num=[{0}],count=[{1}],down==[{2}]", doc.Tables.Count.ToString(), movedown));
                        app.Selection.Paste();
                    }

                    var onepvs = env.Vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);
                    page++;
                    tableindex++;
                    issuename = onepvs.SearchForProperty(0).GetValueAsLocalizedText();

                    doc.Tables[tableindex].Cell(4, 2).Range.Text = issuename;
                    doc.Tables[tableindex].Cell(4, 4).Range.Text = DateTime.Now.ToShortDateString();
                    doc.Tables[tableindex].Cell(4, 6).Range.Text = page.ToString();
                    doc.Tables[tableindex].Cell(0, 1).Range.Text = "整改期限:" + onepvs.SearchForProperty(PropZhengGaiQiXin.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 2).Range.Text = "接收人:" + onepvs.SearchForProperty(PropSecureReceiver.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 3).Range.Text = "检查负责人:" + onepvs.SearchForProperty(PropPrincipal.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 4).Range.Text = "复查人:" + onepvs.SearchForProperty(PropFuChaRen.ID).GetValueAsLocalizedText();

                    var serial = 1;
                    var lus    = onepvs.SearchForProperty(PropSecureIssues.ID).Value.GetValueAsLookups();
                    foreach (Lookup lookup in lus)
                    {
                        var rowindex = 6 + serial;
                        var objid    = new ObjID();
                        objid.SetIDs(OtSecureIssue.ID, lookup.Item);
                        var issuepvs = env.Vault.ObjectOperations.GetLatestObjectVersionAndProperties(objid, true).Properties;
                        secureissuename = issuepvs.SearchForProperty(0).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 1).Range.Text = serial.ToString();
                        doc.Tables[tableindex].Cell(rowindex, 2).Range.Text = secureissuename;
                        doc.Tables[tableindex].Cell(rowindex, 3).Range.Text = issuepvs.SearchForProperty(PropAdjustMeasure.ID).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 4).Range.Text = issuepvs.SearchForProperty(PropAdjustMan.ID).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 5).Range.Text = issuepvs.SearchForProperty(PropSecureAdjustDate.ID).GetValueAsLocalizedText();

                        var beforepictures = issuepvs.SearchForProperty(PropBeforePictures.ID).Value.GetValueAsLookups();
                        foreach (Lookup beforepicture in beforepictures)
                        {
                            var objver =
                                env.Vault.ObjectOperations.GetLatestObjVer(
                                    new ObjID {
                                ID = beforepicture.Item, Type = beforepicture.ObjectType
                            }, true);
                            var files = env.Vault.ObjectFileOperations.GetFiles(objver);
                            foreach (ObjectFile objectFile in files)
                            {
                                var apicture = temppath + objectFile.GetNameForFileSystem();
                                env.Vault.ObjectFileOperations.DownloadFile(objectFile.ID,
                                                                            objectFile.Version, apicture);
                                object unite   = Microsoft.Office.Interop.Word.WdUnits.wdStory;
                                object nothing = System.Reflection.Missing.Value;
                                //    doc.Content.InsertParagraphAfter();
                                doc.Content.InsertAfter(string.Format("{3}安全隐患整改名称:{0},{3}安全问题名称:{1},{3}整改前照片名称:{2}{3}", issuename, secureissuename, beforepicture.DisplayValue, Environment.NewLine));
                                app.Selection.EndKey(ref unite, ref nothing);//将光标移至文末

                                object LinkToFile       = false;
                                object SaveWithDocument = true;
                                object Anchor           = app.Selection.Range;

                                doc.InlineShapes.AddPicture(apicture, ref LinkToFile, ref SaveWithDocument, ref Anchor);
                            }
                        }

                        var afterpictures = issuepvs.SearchForProperty(PropAfterPictures.ID).Value.GetValueAsLookups();
                        foreach (Lookup after in afterpictures)
                        {
                            var objver =
                                env.Vault.ObjectOperations.GetLatestObjVer(
                                    new ObjID {
                                ID = after.Item, Type = after.ObjectType
                            }, true);
                            var files = env.Vault.ObjectFileOperations.GetFiles(objver);
                            foreach (ObjectFile objectFile in files)
                            {
                                var apicture = temppath + objectFile.GetNameForFileSystem();
                                env.Vault.ObjectFileOperations.DownloadFile(objectFile.ID,
                                                                            objectFile.Version, apicture);
                                object unite   = Microsoft.Office.Interop.Word.WdUnits.wdStory;
                                object nothing = System.Reflection.Missing.Value;
                                //      doc.Content.InsertParagraphAfter();
                                doc.Content.InsertAfter(string.Format("{3}安全隐患整改名称:{0},{3}安全问题名称:{1},{3}复查现场照片名称:{2}{3}", issuename, secureissuename, after.DisplayValue, Environment.NewLine));
                                app.Selection.EndKey(ref unite, ref nothing);//将光标移至文末

                                object LinkToFile       = false;
                                object SaveWithDocument = true;
                                object Anchor           = app.Selection.Range;

                                doc.InlineShapes.AddPicture(apicture, ref LinkToFile, ref SaveWithDocument, ref Anchor);
                            }
                        }

                        serial++;
                        if (serial > 12)
                        {
                            doc.Content.InsertParagraphAfter();
                            doc.Content.InsertAfter(" ");
                            object WdLine   = Microsoft.Office.Interop.Word.WdUnits.wdLine; //换一行;
                            var    movedown = app.Selection.MoveDown(ref WdLine, 21);       //移动焦点
                            Writelog(string.Format(" before paste table num=[{0}],count=[{1}],down==[{2}]", doc.Tables.Count.ToString(), movedown));
                            app.Selection.Paste();
                            page++;
                            tableindex++;
                            doc.Tables[tableindex].Cell(4, 2).Range.Text = "project name";
                            doc.Tables[tableindex].Cell(4, 4).Range.Text = DateTime.Now.ToShortDateString();
                            doc.Tables[tableindex].Cell(4, 6).Range.Text = page.ToString();
                            doc.Tables[tableindex].Cell(0, 1).Range.Text = "整改期限:" + onepvs.SearchForProperty(PropZhengGaiQiXin.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 2).Range.Text = "接收人:" + onepvs.SearchForProperty(PropSecureReceiver.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 3).Range.Text = "检查负责人:" + onepvs.SearchForProperty(PropPrincipal.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 4).Range.Text = "复查人:" + onepvs.SearchForProperty(PropFuChaRen.ID).GetValueAsLocalizedText();
                        }
                    }
                }

                doc.Close();
                app.Quit();
            }
            catch (Exception ex)
            {
                Writelog(ex.Message);
            }


            var pvs = new PropertyValues();
            var pv  = new PropertyValue();
            pv.PropertyDef = 0;
            pv.Value.SetValue(MFDataType.MFDatatypeText, "securenoticereport");
            pvs.Add(-1, pv);
            pv.PropertyDef = 100;
            pv.Value.SetValueToLookup(new Lookup {
                Item = ClassSecureReport
            });
            pvs.Add(-1, pv);
            var file = new SourceObjectFile();
            file.Title          = "report";
            file.SourceFilePath = templatefile;
            file.Extension      = "docx";

            var t   = env.Vault.ObjectOperations.CreateNewSFDObject(0, pvs, file, true);
            var f   = env.Vault.ObjectFileOperations.GetFiles(t.ObjVer);
            var rpd = new ReportPrintData();
            rpd.objid       = t.ObjVer.ID;
            rpd.objtype     = t.ObjVer.Type;
            rpd.objversion  = t.ObjVer.Version;
            rpd.fileid      = f[1].FileVer.ID;
            rpd.fileversion = f[1].FileVer.Version;

            return(JsonConvert.SerializeObject(rpd, Formatting.None));
        }
Ejemplo n.º 9
0
        private bool CheckTaskInOneVault(MFilesAPI.Vault vault, long currentuserid)
        {
            try
            {
                var loginName = _userService.GetUserById(currentuserid).GetAccountName();
                var mfuserid  = MfUserUtils.GetUserAccount(vault, loginName);
                //var ClassTaskApprove =
                //    vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                //        "ClassTaskApprove");
                var ClassNotification =
                    vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                                                            MfilesAliasConfig.ClassNotification);
                var pos = vault.Name.LastIndexOf('-');
                if (pos < 1)
                {
                    pos = vault.Name.Length;
                }
                //  var tasktitle = vault.Name.Substring(0, pos) + "-";
                if (mfuserid != null)
                {
                    //{
                    //    var scs = new SearchConditions();
                    //    {
                    //        var sc = new SearchCondition();
                    //        sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    //        sc.Expression.DataPropertyValuePropertyDef =
                    //            (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                    //        sc.TypedValue.SetValueToLookup(new Lookup
                    //        {
                    //            Item = (int) MFBuiltInObjectClass.MFBuiltInObjectClassGenericAssignment
                    //        });
                    //        scs.Add(-1, sc);
                    //    }
                    //    {
                    //        var sc = new SearchCondition();
                    //        sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    //        sc.Expression.DataPropertyValuePropertyDef =
                    //            (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                    //        sc.TypedValue.SetValueToLookup(new Lookup {Item = (int) mfuserid});
                    //        scs.Add(-1, sc);
                    //    }
                    //    var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                    //        MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
                    //    if (ovs > 0) return true;
                    //}
                    {
                        var scs = new SearchConditions();
                        {
                            var sc = new SearchCondition();
                            sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                            sc.Expression.DataPropertyValuePropertyDef =
                                (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                            sc.TypedValue.SetValueToLookup(new Lookup {
                                Item = ClassNotification
                            });
                            scs.Add(-1, sc);
                        }
                        {
                            var sc = new SearchCondition();
                            sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                            sc.Expression.DataPropertyValuePropertyDef =
                                (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                            sc.TypedValue.SetValueToLookup(new Lookup {
                                Item = (int)mfuserid
                            });
                            scs.Add(-1, sc);
                        }
                        var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                                                                                              MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
                        if (ovs > 0)
                        {
                            return(true);
                        }
                    }
//                    {
////工作流任务

//                        var scs = new SearchConditions();
//                        {
//                            var sc = new SearchCondition();
//                            sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
//                            sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);

//                            sc.TypedValue.SetValueToLookup(new Lookup
//                            {
//                                Item = (int) MFBuiltInObjectType.MFBuiltInObjectTypeAssignment
//                            });
//                            scs.Add(-1, sc);
//                        }
//                        {
//                            var sc = new SearchCondition();
//                            sc.ConditionType = MFConditionType.MFConditionTypeEqual;
//                            sc.Expression.DataPropertyValuePropertyDef =
//                                (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
//                            sc.TypedValue.SetValueToLookup(new Lookup {Item = (int) mfuserid});
//                            scs.Add(-1, sc);
//                        }
//                        var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
//                            MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
//                        if (ovs > 0) return true;
//                    }
                }
            }
            catch (Exception ex)
            {
                Log.Info(string.Format("CheckTaskInOneVault {0},{1} error:{2}", vault.Name, currentuserid, ex.Message));
            }
            return(false);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Executes a segmented search using the API directly.
        /// </summary>
        static void UseApiDirectly()
        {
            // Connect to the server (localhost, tcp, current Windows user).
            var application = new MFilesServerApplication();

            application.ConnectAdministrative();

            // Get a connection to the vault.
            var vault = application.LogInToVault(Program.sampleVaultGuid.ToString("B"));

            // Load the object types from the vault.
            Console.WriteLine("Loading object types...");
            var objectTypes = vault
                              .ObjectTypeOperations
                              .GetObjectTypes()
                              .Cast <ObjType>()
                              .ToList();

            Console.WriteLine($"Iterating over {objectTypes.Count} object types...");

            // Iterate over the object types to count the objects.
            foreach (var objectType in objectTypes)
            {
                // Create the basic search conditions collection.
                var searchConditions = new SearchConditions();

                // Add a condition for the object type we're interested in.
                {
                    // Create the search condition (for object type id).
                    SearchCondition condition = new SearchCondition
                    {
                        ConditionType = MFConditionType.MFConditionTypeEqual
                    };
                    condition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID, null);
                    condition.TypedValue.SetValue(MFDataType.MFDatatypeLookup, objectType.ID);

                    // Add the condition at the index provided.
                    searchConditions.Add(-1, condition);
                }

                // Create variables for the segment information.
                const int itemsPerSegment       = 1000; // Maximum number of items in each segment.
                var       segment               = 0;    // Start; this will increment as we go.
                var       moreItems             = true; // Whether there are more items to load.
                var       countIncludingDeleted = 0;    // The count of matching items.

                // Whilst there are items in the results, we need to loop.
                while (moreItems)
                {
                    // Execute a search within the object id segment.
                    {
                        // Clone the search conditions (so we can add current-segment condition).
                        var internalSearchConditions = searchConditions.Clone();

                        // Add search condition:
                        //   Id within the range: (segment - itemsPerSegment) to ((segment + 1) * itemsPerSegment)
                        {
                            // Create the search condition.
                            SearchCondition condition = new SearchCondition
                            {
                                ConditionType = MFConditionType.MFConditionTypeEqual
                            };
                            condition.Expression.SetObjectIDSegmentExpression(itemsPerSegment);
                            condition.TypedValue.SetValue(MFDataType.MFDatatypeInteger, segment);

                            // Add the condition at the index provided.
                            internalSearchConditions.Add(-1, condition);
                        }

                        // Execute the search and increment the count.
                        countIncludingDeleted += vault.ObjectSearchOperations
                                                 .SearchForObjectsByConditionsEx(internalSearchConditions, MFSearchFlags.MFSearchFlagDisableRelevancyRanking,
                                                                                 SortResults: false, MaxResultCount: 0,
                                                                                 SearchTimeoutInSeconds: 0).Count;

                        // Move to the next segment.
                        segment++;
                    }

                    // Are there any more items?
                    {
                        // Clone the search conditions (so we can add object id condition).
                        var internalSearchConditions = searchConditions.Clone();

                        // Add search condition:
                        //   Id at least (segment * itemsPerSegment)
                        {
                            // Create the search condition.
                            SearchCondition condition = new SearchCondition
                            {
                                ConditionType = MFConditionType.MFConditionTypeGreaterThanOrEqual
                            };
                            condition.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectID, null);
                            condition.TypedValue.SetValue(MFDataType.MFDatatypeInteger, segment * itemsPerSegment);

                            // Add the condition at the index provided.
                            internalSearchConditions.Add(-1, condition);
                        }

                        // If we get one item then there's more results.
                        moreItems = 1 == vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(
                            internalSearchConditions,                      // Our search conditions.
                            MFSearchFlags.MFSearchFlagDisableRelevancyRanking,
                            SortResults: false,                            // Don't bother attempting to sort them.
                            MaxResultCount: 1,                             // We only need to know if there is at least one, nothing more.
                            SearchTimeoutInSeconds: 0).Count;
                    }
                }

                // Output the stats.
                Console.WriteLine($"\t{objectType.NamePlural}:");
                Console.WriteLine($"\t\tTotal: {countIncludingDeleted} (included deleted)");
            }

            Console.WriteLine($"Complete.");

            // Disconnect.
            vault.LogOutSilent();
            application.Disconnect();
        }
Ejemplo n.º 11
0
        private IEnumerable <MfTask> GetTaskApprove(Vault vault, int?mfuserid, string tasktitle)
        {
            var forworklist = new List <MfTask>();

            try
            {
                var ClassNotification =
                    vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                                                            MfilesAliasConfig.ClassNotification);
                //      var ClassTaskApprove =
                //vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                //    MfilesAliasConfig.ClassTaskApprove);
                var scs = new SearchConditions();
                {
                    var sc = new SearchCondition();
                    sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);

                    sc.TypedValue.SetValueToLookup(new Lookup
                    {
                        Item = (int)MFBuiltInObjectType.MFBuiltInObjectTypeAssignment
                    });
                    scs.Add(-1, sc);
                }
                {
                    var sc = new SearchCondition();
                    sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                    sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                    sc.TypedValue.SetValueToLookup(new Lookup {
                        Item = ClassNotification
                    });
                    scs.Add(-1, sc);
                }
                {
                    var sc = new SearchCondition();
                    sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                    sc.TypedValue.SetValueToLookup(new Lookup {
                        Item = (int)mfuserid
                    });
                    scs.Add(-1, sc);
                }
                var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                                                                                      MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions;
                //    Log.Info(string.Format("mfuserid:{0},tasks:{1},ClassTaskApprove:{2}", mfuserid, ovs.Count, ClassTaskApprove));

                foreach (ObjectVersion objectVersion in ovs)
                {
                    var pvs  = vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);
                    var link = vault.ObjectOperations.GetMFilesURLForObject(objectVersion.ObjVer.ObjID,
                                                                            objectVersion.ObjVer.Version, true);
                    var taskname = pvs.SearchForProperty(0).GetValueAsLocalizedText();

                    var relations = vault.ObjectOperations.GetRelationships(objectVersion.ObjVer,
                                                                            MFRelationshipsMode.MFRelationshipsModeAll);
                    var creator = string.Empty;
                    foreach (ObjectVersion relation in relations)
                    {
                        //   var objpvs = vault.ObjectPropertyOperations.GetProperties(relation.ObjVer);
                        //     var name = objpvs.SearchForProperty(0).GetValueAsLocalizedText();
                        //   creator = objpvs.SearchForProperty((int) MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy).GetValueAsLocalizedText();
                        creator = vault.ObjectPropertyOperations.GetProperty(relation.ObjVer, (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy).GetValueAsLocalizedText();
                        break;
                        //   Log.Info(string.Format("{4},relation: {0},{1},{2},{3},{5}", name, relation.ObjVer.Type, relation.ObjVer.ID, relation.ObjVer.Version, taskname, creator));
                    }
                    var taskOrNoticeOfVault = new MfTask
                    {
                        Url              = link,
                        Name             = taskname,
                        ClientName       = vault.Name,
                        LastModifiedTime = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefLastModified)
                                           .GetValueAsLocalizedText(),
                        Createby = creator,
                        Time     = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreated).GetValueAsLocalizedText()
                    };
                    forworklist.Add(taskOrNoticeOfVault);
                }
            }
            catch (Exception ex)
            {
                Log.Info(string.Format("GetTaskApprove {0},{1} error:{2}", vault.Name, mfuserid, ex.Message));
            }
            return(forworklist);
        }
Ejemplo n.º 12
0
        private IEnumerable <MfTask> GetTaskWorkflow(Vault vault, int?mfuserid, string tasktitle)
        {
            var forworklist = new List <MfTask>();

            try
            {//工作流任务
                var scs = new SearchConditions();
                {
                    var sc = new SearchCondition();
                    sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                    sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);

                    sc.TypedValue.SetValueToLookup(new Lookup
                    {
                        Item = (int)MFBuiltInObjectType.MFBuiltInObjectTypeAssignment
                    });
                    scs.Add(-1, sc);
                }
                {
                    var sc = new SearchCondition();
                    sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                    sc.TypedValue.SetValueToLookup(new Lookup {
                        Item = (int)mfuserid
                    });
                    scs.Add(-1, sc);
                }
                var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                                                                                      MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions;
                Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, ovs.Count));
                foreach (ObjectVersion objectVersion in ovs)
                {
                    var pvs = vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);
                    //       Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "aaa"));
                    var link = vault.ObjectOperations.GetMFilesURLForObject(objectVersion.ObjVer.ObjID,
                                                                            objectVersion.ObjVer.Version, true);
                    //    Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "bbb"));
                    var Name = pvs.SearchForProperty(0).GetValueAsLocalizedText();
                    //    Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "ccc"));
                    var Assigner =
                        pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy)
                        .GetValueAsLocalizedText();
                    //     Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "ddd"));
                    var Content = string.Empty;
                    try
                    {
                        Content = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignmentDescription)
                                  .GetValueAsLocalizedText();
                    }
                    catch (Exception) { }
                    //     Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "eee"));
                    var Date =
                        pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreated)
                        .GetValueAsLocalizedText();
                    //      Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "fff"));
                    var tonn = new MfTask
                    {
                        Url              = link,
                        Name             = Name,
                        Createby         = Assigner,
                        ClientName       = vault.Name,
                        LastModifiedTime = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefLastModified)
                                           .GetValueAsLocalizedText(),
                        Desc = Content,
                        Time = Date
                    };
                    forworklist.Add(tonn);
                }
            }
            catch (Exception ex)
            {
                Log.Info("GetTaskWorkflow error:" + ex.Message);
            }
            return(forworklist);
        }
Ejemplo n.º 13
-1
        private ObjectSearchResults Find(SearchCondition searchCondition)
        {
            var vault = this.VaultService.Vault.Value;

              var searchConditions = new SearchConditions();
              searchConditions.Add(-1, searchCondition);

              var objectSearchResults = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(
            searchConditions,
            MFSearchFlags.MFSearchFlagLookInAllVersions | MFSearchFlags.MFSearchFlagDisableRelevancyRanking,
            false,
            MaxResultCount: 100000,
            SearchTimeoutInSeconds: Int32.MaxValue);

              return objectSearchResults;
        }