本文整理汇总了C#中Record.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Record.Save方法的具体用法?C# Record.Save怎么用?C# Record.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record.Save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRecord
private static void AddRecord(Record record, CoubTarget target, string tempFile)
{
record.AddNew();
record.Classifications.Add(new Adam.Core.Classifications.ClassificationPath("/Cubus/Coub"));
record.Fields.GetField<TextField>("Name").SetValue(target.Name);
record.Fields.GetField<TextField>("Author").SetValue(target.Author);
record.Fields.GetField<TextField>("Description").SetValue(target.Description);
record.Files.AddFile(tempFile);
record.Save();
}
示例2: ChangeClassification
private void ChangeClassification(Application app, Record record, string classificationPath, string ancestorName="MonkeysCast")
{
if (string.IsNullOrEmpty(classificationPath))
return;
var classification = new Classification(app);
string searchExpression = string.Format("Ancestor.Name = '{0}' AND Name='{1}'", ancestorName, classificationPath.Trim());
if (classification.TryLoad(new SearchExpression(searchExpression)) == TryLoadResult.Success)
{
record.Classifications.RemoveAll();
record.Classifications.Add(classification.Id);
record.Save();
}
}
示例3: Migrate
private static void Migrate()
{
string connectionString = "Data Source=yfdev.cloudapp.net;Initial Catalog=SCC_ECM;Persist Security Info=True;User ID=EPL;Password=Password1!";
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
using (SqlCommand command = new SqlCommand("SELECT top 25 * FROM View_1", con))
using (SqlDataReader reader = command.ExecuteReader())
{
using (Database db = new Database())
{
db.Id = "03";
db.Connect();
while (reader.Read())
{
RecordType rt = new RecordType(db, 16);
Record rCont = GetFolderUri(reader.GetString(6), reader.GetString(7), db);
if (rCont != null)
{
Record r = new Record(rt);
r.Container = rCont;
r.LongNumber = reader.GetInt32(0).ToString();
r.Title = reader.GetString(1);
r.DateCreated = (TrimDateTime)reader.GetDateTime(2);
string loc = "D:\\" + reader.GetString(3);
if (File.Exists(loc))
{
InputDocument id = new InputDocument(loc);
r.SetDocument(id, false, false, "Migrated from ECM t1");
}
r.Save();
Console.WriteLine("Record Created: " + r.Number);
}
else
{
Console.WriteLine("Could not find folder");
}
}
}
}
}
}
示例4: ProcessEvent
public override void ProcessEvent(Database db, TrimEvent evt)
{
if(evt.ObjectType == BaseObjectTypes.Record)
{
if (evt.EventType == Events.ObjectAdded)
{
try
{
Record rec = new Record(db, evt.ObjectUri);
if (rec.IsElectronic)
{
var docdetails = rec.ESource;
//string Location = "C:\\Program Files\\hello.txt";
string FileName = docdetails.Substring(docdetails.LastIndexOf('\\') +
1);
//
int fileExtPos = FileName.LastIndexOf(".");
if (fileExtPos >= 0)
FileName = FileName.Substring(0, fileExtPos);
var rectitle = rec.Title;
if (rectitle != FileName)
{
rec.Title = FileName;
}
rec.SetNotes("Notes added: DocDetails: " + FileName + " RecTitle: " + rectitle, NotesUpdateType.PrependWithNewLine);
rec.Save();
db.LogExternalEvent("Successful template title change.", BaseObjectTypes.Record, evt.ObjectUri, true);
}
}
catch (Exception exp)
{
db.LogExternalEvent("Template title change error - "+exp.Message.ToString(), BaseObjectTypes.Record, evt.ObjectUri, true);
}
}
}
}
示例5: CreateNewRMRecord
//.........这里部分代码省略.........
case ".CFM": //NS
case ".XLTM": //NS
case ".SHX": //NS
case ".PPSX": //NS
case ".CSS": //NS
case ".XLTX": //NS
case ".JS": //NS"
case ".OTF": //NS
case ".VST": //NS
case ".WMV": //NS
case ".WMZ": //NS
case ".OFT": //NS
case ".MOV": //NS
case ".PPS": //NS
case ".MDB": //NS
case ".EPS": //NS
case ".XPS": //NS
case ".XLSB": //NS
case ".MID": //NS
case ".THMX": //NS
case ".TMP": //NS
case ".TTF": //NS
case ".MXD": //NS
case ".ICS": //NS
case ".DOCM": //NS
case ".BPMN": //NS
case ".AI": //NS
case ".AVI": //NS
case ".DXF": //NS
case ".INI": //NS
case ".LOG": //NS
case ".LST": //NS
case ".ODT": //NS
case ".PARTIAL": //NS
case ".POT": //NS
case ".POTX": //NS
case ".VSDX": //NS
case ".SKP": //NS
case ".SHS": //NS
case ".RPT": //NS
case ".XLA": //NS
rt = new RecordType(db, 2);
break;
//Images
case ".JPG":
case ".TIF":
case ".jpg":
case ".tif":
case ".PNG":
case ".png":
case ".JPEG":
case ".jpeg":
case ".GIF":
case ".gif":
case ".BMP":
case ".bmp":
case ".MPEG":
case ".TIFF":
rt = new RecordType(db, 14);
break;
//Mail
case ".EML":
case ".eml":
case ".msg":
case ".MSG":
rt = new RecordType(db, 3);
newtitle = SetEmailTitle(FileLoc);
break;
}
Record rcont = new Record(db, cont);
Record r = new Record(rt);
Location lo = new Location(db, 5503);
if (newtitle != null)
r.Title = newtitle;
r.SetDocument(FileLoc);
r.SetAssignee(lo);
r.SetOwnerLocation(lo);
r.Container = rcont;
r.Save();
uri = r.Uri;
Console.WriteLine("Migrated document from: " + FileLoc + " and saved as " + r.Number);
db.LogExternalEvent("Document migrated from: " + FileLoc, BaseObjectTypes.Record, uri, true);
}
else
{
Console.WriteLine("Document location does not exist: " + FileLoc);
db.LogExternalEvent("Document location does not exist: "+FileLoc, BaseObjectTypes.Record, Convert.ToInt64(cont), true);
}
}
catch (Exception exp)
{
Console.WriteLine("Error: " + exp.Message.ToString());
db.LogExternalEvent("Error migrating: " + FileLoc+" Error: "+exp.Message.ToString(), BaseObjectTypes.Record, Convert.ToInt64(cont), true);
}
return uri;
}
示例6: AddRecord
private void AddRecord(string path, Guid clId, Dictionary<string, string> descriptions)
{
var record = new Record(app);
record.AddNew();
record.Files.AddFile(path);
record.Classifications.Add(clId);
Language language = new Language(app);
foreach(var item in descriptions)
{
language.Load(item.Key);
Guid id = language.Id;
record.Fields.GetField<TextField>("AlexanderChechet_multi", id).SetValue(item.Value);
}
record.Save();
}
示例7: CreateNewRMSubFolder
private static long CreateNewRMSubFolder(long conturi, string str5, Database db)
{
long uri = 0;
Record rCont = new Record(db, conturi);
RecordType rtsub = new RecordType(db, 5);
Record rsub = new Record(rtsub);
rsub.Title = str5;
rsub.Container = rCont;
rsub.SetAssignee(rCont.Assignee);
rsub.Save();
uri = rsub.Uri;
return uri;
}
示例8: CreateNewRMfolder
private static long CreateNewRMfolder(string str4, long classification, Database db)
{
long uri = 0;
Classification objclas = new Classification(db, classification);
long clasUri = objclas.Uri;
RecordType rt = new RecordType(db, 1);
Record r = new Record(rt);
Classification c = new Classification(db, clasUri);
//Location lo = new Location(db, 5503);
//r.OwnerLocation = lo;
//r.SetAssignee(lo);
r.Classification = c;
r.Title = str4;
r.Save();
uri = r.Uri;
return uri;
}
示例9: findmessagid
private static object findmessagid(FileInfo f)
{
string msgid = null;
using(Database db = new Database())
{
RecordType rt = new RecordType(db, 3);
Record r = new Record(rt);
r.Container = new Record(db, 172739);
r.Title = f.Name;
r.SetDocument(f.FullName);
r.Save();
msgid = r.MessageId;
r.Delete();
}
return msgid;
}
示例10: BuildRMpersonalFolders
static void BuildRMpersonalFolders(Location loc)
{
TrimApplication.Initialize();
try
{
using (Database db = new Database())
{
db.Id = "03";
db.Connect();
RecordType rt = new RecordType(db, 7);
Record r = new Record(rt);
r.Client = loc;
r.Title = "Personal Workspace";
//r.Assignee = loc;
//r.HomeLocation = loc;
TrimAccessControlList ackk = r.AccessControlList;
ackk.SetPrivate((int)RecordAccess.ViewRecord, loc);
r.AccessControlList = ackk;
//Classification cl = new Classification(db, 501);
//r.Classification = cl;
//
//r.SecurityProfile.
r.Save();
//r.AddToFavorites();
}
}
catch(Exception exp) {
Loggitt(exp.Message.ToString(), "Error creating Personal workspace - "+loc.Uri.ToString());
}
}
示例11: ProcessProperty
static void ProcessProperty(string Name)
{
TrimApplication.Initialize();
using (Database db = new Database())
{
db.Id = "10";
//db.WorkgroupServerName = "https://SCDB98:9443";
db.Connect();
//Console.WriteLine("DB test: " + db.CurrentUser.Name);
//
JsonSerializer s = new JsonSerializer();
try
{
T1Property t1 = null;
using (StreamReader sr = new StreamReader(Name))
{
using (JsonTextReader reader = new JsonTextReader(sr))
{
//T1Integration t1 = new T1Integration();
t1 = (T1Property)s.Deserialize(reader, typeof(T1Property));
}
}
if (t1 != null)
{
FieldDefinition fdPropertyAddress = new FieldDefinition(db, 502);
if (t1.EddieUri == 0)
{
RecordType rt = new RecordType(db, 1);
Record rec = new Record(rt);
FieldDefinition fdPropertyNo = new FieldDefinition(db, 504);
rec.Title = "Property folder - " + t1.PropertyNumber.ToString();
rec.SetFieldValue(fdPropertyNo, new UserFieldValue(t1.PropertyNumber));
rec.SetFieldValue(fdPropertyAddress, new UserFieldValue(t1.PropertyAddress));
Classification c = new Classification(db, 2616);
rec.Classification = c;
Location loc = new Location(db, 43);
rec.SetAssignee(loc);
//rec.assig
rec.Save();
t1.EddieUri = rec.Uri;
t1.EddieRecordUrl = rec.WebURL;
Console.WriteLine("New property record created ok - number: " + rec.Number);
}
else
{
//RecordType rt = new RecordType(db, 2);
Record rec = new Record(db, t1.EddieUri);
//Record cont = new Record(db, t1.lEddieUri);
//rec.Container = cont;
//rec.Title = "Application - " + t1.ApplicationNo;
//if (t1.propertyLoc != null)
//{
// rec.SetDocument(t1.propertyLoc);
//}
rec.SetFieldValue(fdPropertyAddress, new UserFieldValue(t1.PropertyAddress));
rec.Save();
//t1.EddieUri = rec.Uri;
t1.EddieRecordUrl = rec.WebURL;
Console.WriteLine("Property record upgrades - number: " + rec.Number);
}
using (StreamWriter sw = new StreamWriter(pathout + "T1 property - "+t1.PropertyNumber.ToString()+".txt"))
{
using (JsonWriter writer = new JsonTextWriter(sw))
{
s.Serialize(writer, t1);
Console.WriteLine("Property file returned");
}
};
FileInfo f = new FileInfo(Name);
if (f.Exists)
f.Delete();
}
}
catch (Exception exp)
{
Console.WriteLine("Error: " + exp.Message.ToString());
throw;
}
}
}
示例12: ProcessApplication
static void ProcessApplication(string Name)
{
TrimApplication.Initialize();
using (Database db = new Database())
{
db.Id = "10";
db.Connect();
JsonSerializer s = new JsonSerializer();
try
{
T1Application t1 = null;
using (StreamReader sr = new StreamReader(Name))
{
using (JsonTextReader reader = new JsonTextReader(sr))
{
//T1Integration t1 = new T1Integration();
t1 = (T1Application)s.Deserialize(reader, typeof(T1Application));
}
}
if (t1 != null)
{
FieldDefinition fdPropertyAddress = new FieldDefinition(db, 502);
if (t1.EddieUri == 0)
{
RecordType rt = new RecordType(db, 2);
Record rec = new Record(rt);
if (t1.PropertyNumber != 0)
{
Record cont = new Record(db, t1.PropertyNumber);
rec.Container = cont;
}
//FieldDefinition fdPropertyNo = new FieldDefinition(db, 504);
rec.Title = "Application - " + t1.ApplicationNumber;
//rec.SetFieldValue(fdPropertyNo, new UserFieldValue(t1.PropertyNumber));
//rec.SetFieldValue(fdPropertyAddress, new UserFieldValue(t1.PropertyAddress));
//Classification c = new Classification(db, 2616);
//rec.Classification = c;
FileInfo f = new FileInfo(t1.documentLoc);
if (f.Exists)
{
rec.SetDocument(new InputDocument(t1.documentLoc), false, false, "");
}
rec.Save();
t1.EddieUri = rec.Uri;
t1.EddieRecordUrl = rec.WebURL;
Console.WriteLine("New application record created ok - number: " + rec.Number);
}
else
{
//RecordType rt = new RecordType(db, 2);
Record rec = new Record(db, t1.EddieUri);
//Record cont = new Record(db, t1.lEddieUri);
//rec.Container = cont;
//rec.Title = "Application - " + t1.ApplicationNo;
//if (t1.propertyLoc != null)
//{
// rec.SetDocument(t1.propertyLoc);
//}
//rec.SetFieldValue(fdPropertyAddress, new UserFieldValue(t1.PropertyAddress));
FileInfo f1 = new FileInfo(t1.documentLoc);
if (f1.Exists)
{
rec.SetDocument(new InputDocument(t1.documentLoc), true, false, "");
}
rec.Save();
//t1.EddieUri = rec.Uri;
t1.EddieRecordUrl = rec.WebURL;
Console.WriteLine("Application record upgrades - number: " + rec.Number);
}
using (StreamWriter sw = new StreamWriter(pathout + "T1 Application - " + t1.PropertyNumber.ToString() + ".txt"))
{
using (JsonWriter writer = new JsonTextWriter(sw))
{
s.Serialize(writer, t1);
Console.WriteLine("Application file returned");
}
};
FileInfo f2 = new FileInfo(Name);
if (f2.Exists)
f2.Delete();
}
}
catch (Exception exp)
{
Console.WriteLine("Error: " + exp.Message.ToString());
throw;
}
}
}