本文整理汇总了C#中Company类的典型用法代码示例。如果您正苦于以下问题:C# Company类的具体用法?C# Company怎么用?C# Company使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Company类属于命名空间,在下文中一共展示了Company类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExplicitFlushInsideSecondTransactionProblem
public void ExplicitFlushInsideSecondTransactionProblem()
{
var comp1 = new Company("comp1");
var comp2 = new Company("comp2");
using(new SessionScope())
{
comp1.Create();
comp2.Create();
}
using(new SessionScope(FlushAction.Never))
{
using(var tx = new TransactionScope(ondispose: OnDispose.Rollback))
{
var comp2a = Company.Find(comp2.Id);
comp2a.Name = "changed";
tx.VoteCommit();
}
using(var scope = new TransactionScope(ondispose: OnDispose.Rollback))
{
var changedCompanies = AR.FindAllByProperty<Company>("Name", "changed");
Assert.AreEqual(1, changedCompanies.Count());
var e2a = changedCompanies.First();
e2a.Delete();
scope.Flush();
Assert.AreEqual(0, AR.FindAllByProperty<Company>("Name", "changed").Count());
}
}
}
开发者ID:shosca,项目名称:ActiveRecord,代码行数:32,代码来源:TransactionScopeTestCase.cs
示例2: CompInput
public CompInput(string name, Company company, float price, string partInterface, int powerRequirement, float defectiveChance, int mouseDPI, int pollingRate, bool isMechanical)
: base(name, company, price, partInterface, powerRequirement, defectiveChance)
{
this.mouseDPI = mouseDPI;
this.pollingRate = pollingRate;
this.isMechanical = isMechanical;
}
开发者ID:rhyok,项目名称:hue-r,代码行数:7,代码来源:Parts.cs
示例3: WillAbortDeleteIfUserDoesNotHavePermissions
public void WillAbortDeleteIfUserDoesNotHavePermissions()
{
var company = new Company
{
Name = "Hibernating Rhinos"
};
using (var s = store.OpenSession())
{
s.Store(new AuthorizationUser
{
Id = UserId,
Name = "Ayende Rahien",
});
s.Store(company);
s.SetAuthorizationFor(company, new DocumentAuthorization());// deny everyone
s.SaveChanges();
}
using (var s = store.OpenSession())
{
s.SecureFor(UserId, "/Company/Rename");
Assert.Throws<InvalidOperationException>(() => s.DatabaseCommands.Delete(company.Id, null));
}
}
开发者ID:algida,项目名称:ravendb,代码行数:28,代码来源:Deleting.cs
示例4: WillAbortWriteIfUserDoesNotHavePermissions
public void WillAbortWriteIfUserDoesNotHavePermissions()
{
var company = new Company
{
Name = "Hibernating Rhinos"
};
using (var s = store.OpenSession(DatabaseName))
{
s.Store(new client::Raven.Bundles.Authorization.Model.AuthorizationUser
{
Id = UserId,
Name = "Ayende Rahien",
});
s.Store(company);
client::Raven.Client.Authorization.AuthorizationClientExtensions.SetAuthorizationFor(s, company, new client::Raven.Bundles.Authorization.Model.DocumentAuthorization());// deny everyone
s.SaveChanges();
}
using (var s = store.OpenSession(DatabaseName))
{
client::Raven.Client.Authorization.AuthorizationClientExtensions.SecureFor(s, UserId, "Company/Rename");
company.Name = "Stampeding Rhinos";
s.Store(company);
var e = Assert.Throws<ErrorResponseException>(() => s.SaveChanges());
Assert.Contains("OperationVetoedException", e.Message);
Assert.Contains("PUT vetoed on document companies/1", e.Message);
Assert.Contains("Raven.Bundles.Authorization.Triggers.AuthorizationPutTrigger", e.Message);
Assert.Contains("Could not find any permissions for operation: Company/Rename on companies/1 for user Authorization/Users/Ayende", e.Message);
}
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:35,代码来源:Writing.cs
示例5: Create
public Company Create(Company company)
{
if (company == null)
throw new ArgumentNullException(nameof(company));
if (string.IsNullOrEmpty(company.CompanyName))
throw new ValidationException("Company name cannot be empty.");
if(company.CompanyName.Length > 200)
throw new ValidationException("Company name cannot exceed 200 characters.");
var existing = Get(company.CompanyName);
if (existing != null)
throw new ValidationException("Company with same name already exists.");
var result = new Company
{
CompanyName = company.CompanyName
};
_context.Companies.Add(result);
_context.SaveChanges();
return result;
}
开发者ID:jwoodman510,项目名称:password-locker,代码行数:27,代码来源:ICompanyDal.cs
示例6: saveCompany
public static void saveCompany(Company company)
{
try
{
using (db = new TIB_Model())
{
if (company.Id != 0)
{
db.Company.Attach(company);
db.Entry(company).State = EntityState.Modified;
}
else
{
db.Company.Add(company);
}
db.SaveChanges();
}
}
catch (Exception ex)
{
throw ex;
}
}
开发者ID:Exomnius,项目名称:TogetherIsBetter,代码行数:25,代码来源:Companies.cs
示例7: CannotReadDocumentWithoutPermissionToIt
public void CannotReadDocumentWithoutPermissionToIt()
{
var company = new Company
{
Name = "Hibernating Rhinos"
};
using (var s = store.OpenSession(DatabaseName))
{
s.Store(new client::Raven.Bundles.Authorization.Model.AuthorizationUser
{
Id = UserId,
Name = "Ayende Rahien",
});
s.Store(company);
client::Raven.Client.Authorization.AuthorizationClientExtensions.SetAuthorizationFor(s, company, new client::Raven.Bundles.Authorization.Model.DocumentAuthorization());// deny everyone
s.SaveChanges();
}
using (var s = store.OpenSession(DatabaseName))
{
client::Raven.Client.Authorization.AuthorizationClientExtensions.SecureFor(s, UserId, "Company/Bid");
var readVetoException = Assert.Throws<ReadVetoException>(() => s.Load<Company>(company.Id));
Assert.Equal(@"Document could not be read because of a read veto.
The read was vetoed by: Raven.Bundles.Authorization.Triggers.AuthorizationReadTrigger
Veto reason: Could not find any permissions for operation: Company/Bid on companies/1 for user Authorization/Users/Ayende.
No one may perform operation Company/Bid on companies/1
", readVetoException.Message);
}
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:34,代码来源:Reading.cs
示例8: DirtyCheckingTest
public void DirtyCheckingTest()
{
CompanyIdentification companyIdentification1 =
new CompanyIdentification
{
Identification = "1"
};
CompanyIdentification companyIdentification2 =
new CompanyIdentification
{
Identification = "2"
};
Company company =
new Company
{
Name = "Peopleware NV",
Identifications = new[] { companyIdentification1, companyIdentification2 }
};
Repository.Save(company);
Session.Evict(company);
/* Set Number to null (but Number is defined as int) */
/*
using (ISession session = NhConfigurator.SessionFactory.OpenSession())
{
using (ITransaction trans = session.BeginTransaction())
{
session.CreateQuery(@"update CompanyIdentification set Number = null").ExecuteUpdate();
trans.Commit();
}
}
*/
new DirtyChecking(NhConfigurator.Configuration, NhConfigurator.SessionFactory, Assert.Fail, Assert.Inconclusive).Test();
}
开发者ID:jandppw,项目名称:ppwcode-recovered-from-google-code,代码行数:34,代码来源:DirtyCheckingExampleTest.cs
示例9: cmpRegister
protected void cmpRegister(object sender, EventArgs e)
{
Company cmp = new Company();
bool signed = false;
if (validator.checkCompanyEmail(registerEmail))
{
registerEmail.Attributes["placeholder"] = "This mail address is in use.";
return;
}
validateRegister();
if (confirmRegister)
{
cmp.CompanyName = registerCompanyName.Text;
cmp.Email = registerEmail.Text;
cmp.Password = registerPassword.Text;
cmp.Address = registerAddress.Text;
cmp.Phone = registerPhone.Text;
cmp.CityID = int.Parse(registerCity.SelectedValue);
signed = cmp.SignUp();
}
if (signed)
{
Session["Company"] = cmp;
Response.Redirect("Home.aspx");
}
}
开发者ID:TotoCafe,项目名称:TotoCafe,代码行数:28,代码来源:Index.aspx.cs
示例10: GetDataForm
protected Company GetDataForm()
{
Company company = new Company();
if (!string.IsNullOrEmpty(txtName.Text))
{
company.Company_Name = txtName.Text;
}
else
{
return null;
}
company.Company_Phone = txtPhoneNumber.Text;
company.Company_Email = txtEmail.Text;
company.Company_Address = txtAddress.Text;
company.Company_Description = txtDescription.Text;
string filePath = "";
System.Drawing.Image image;
if (fuLogo.HasFile)
{
image = System.Drawing.Image.FromStream(fuLogo.PostedFile.InputStream);
}
else
{
filePath = WebHelper.Instance.GetWebsitePath() + "App_Themes/images/other/no_image.png";
image = System.Drawing.Image.FromFile(filePath);
}
String data = WebHelper.Instance.ImageToBase64(image, System.Drawing.Imaging.ImageFormat.Png);
company.Company_Logo = data;
return company;
}
开发者ID:omaralagbary,项目名称:eproject-excell-on-consulting-services,代码行数:30,代码来源:CreateCompany.aspx.cs
示例11: saveUpdateCompany
public void saveUpdateCompany(Company company)
{
CompanyFrm cFrm = new CompanyFrm(company);
bool result = (bool)cFrm.ShowDialog();
cFrm.Close();
if (result)
{
try
{
Generic<Company> gen = new Generic<Company>();
if (company.Id == 0)
gen.Add(company);
else
gen.Update(company, company.Id);
gen.Dispose();
MessageBox.Show("The company was saved successfully", "Company saved", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
Console.Write(ex.ToString());
MessageBox.Show("There was a problem saving this company to the database. Please try again later or contact a sysadmin.", "Database Error", MessageBoxButton.OK, MessageBoxImage.Information);
}
// reload companies and refresh ListBox
loadCompanies();
}
}
开发者ID:Exomnius,项目名称:TogetherIsBetter,代码行数:29,代码来源:ManagementFrm.xaml.cs
示例12: Init
private void Init()
{
if (settings==null)
{
throw new ArgumentNullException("Please provide valid SAP Settings");
}
if(_company==null)
{
_company = new Company
{
language = BoSuppLangs.ln_English,
Server = settings.ServerName,
DbServerType =BoDataServerTypes.dst_MSSQL2008,//(BoDataServerTypes)Enum.Parse(typeof(BoDataServerTypes), settings.Servertype),
UseTrusted = false,
DbPassword = settings.DbPassword,
DbUserName = settings.Dbusrname,
UserName = settings.UserName,
Password = settings.Password,
CompanyDB = settings.CompanyName,
// LicenseServer = "10.0.0.2:3000"
};
ConnectToCompany();
return;
}
ConnectToCompany();
}
开发者ID:asanyaga,项目名称:BuildTest,代码行数:29,代码来源:IPullMasterdataService.cs
示例13: Will_limit_replication_history_size_on_items_marked_with_not_for_replication
public void Will_limit_replication_history_size_on_items_marked_with_not_for_replication()
{
var store1 = CreateStore();
using (var session = store1.OpenSession())
{
var entity = new Company {Name = "Hibernating Rhinos"};
session.Store(entity);
session.Advanced.GetMetadataFor(entity)["Raven-Not-For-Replication"] = "true";
session.SaveChanges();
}
for (int i = 0; i < 100; i++)
{
using (var session = store1.OpenSession())
{
var company = session.Load<Company>(1);
company.Name = i%2 == 0 ? "a" : "b";
session.SaveChanges();
}
}
using (var session = store1.OpenSession())
{
var company = session.Load<Company>(1);
var ravenJArray = session.Advanced.GetMetadataFor(company).Value<RavenJArray>(Constants.RavenReplicationHistory);
Assert.Equal(50, ravenJArray.Length);
}
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:30,代码来源:SimpleReplication.cs
示例14: SumUpSalaries
static double SumUpSalaries(Company c)
{
return
(from e in c.Query.Descendants<EmployeeType>()
select e.Salary
).Sum();
}
开发者ID:dipdapdop,项目名称:linqtoxsd,代码行数:7,代码来源:WageBill.cs
示例15: Get
/// <summary>
/// Get a security token
/// </summary>
/// <param name="company"></param>
/// <param name="scope"></param>
/// <param name="invalidateCache">if set to true, requests a new token even if a valid one is already in the cache</param>
/// <returns></returns>
public Token Get(Company company = null, string scope = "panoptix.read", bool invalidateCache = false)
{
var now = DateTime.UtcNow;
Token token;
// so that instances created by different applications (as indicated by id passed at construction) don't clobber each other
var cacheKey = String.Format("{0}:{1}:{2}", clientId, company == null ? string.Empty: company.Id, scope);
// check to see if we already have a token that will be valid for at least the next five minutes
if (!invalidateCache && Cache.ContainsKey(cacheKey) && Cache[cacheKey].ExpirationTime > now.AddMinutes(5))
{
token = Cache[cacheKey];
}
else
{
var contentList = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("grant_type", "client_credentials")
};
if (company != null && company.Id != null)
{
contentList.Add(new KeyValuePair<string, string>("jci_company_id", company.Id));
contentList.Add(new KeyValuePair<string, string>("scope", scope));
}
token = FetchToken(company, cacheKey, Cache, contentList);
}
return token;
}
开发者ID:kylestittleburg,项目名称:SummerSun,代码行数:37,代码来源:ClientCredentialsTokenClient.cs
示例16: Connector1C
public Connector1C(Company c, bool enableDebug = false)
{
string logFileName = DateTime.Now.ToString().Replace(":", "-");
importLogFile = new StreamWriter(logFileName + ".txt");
this.DEBUG = enableDebug;
this.company = c;
}
开发者ID:bashlykevich,项目名称:CashflowImporter2,代码行数:7,代码来源:Connector1C.cs
示例17: Created_Audit_Fields_Should_be_Set_After_Save_With_Children
public void Created_Audit_Fields_Should_be_Set_After_Save_With_Children()
{
CompanyIdentification companyIdentification1 =
new CompanyIdentification
{
Identification = "1"
};
CompanyIdentification companyIdentification2 =
new CompanyIdentification
{
Identification = "2"
};
Company company =
new Company
{
Name = "Peopleware NV",
Identifications = new[] { companyIdentification1, companyIdentification2 }
};
Company savedCompany = Repository.Save(company);
Assert.AreSame(company, savedCompany);
Assert.AreEqual(UserName, company.CreatedBy);
Assert.AreEqual(m_Now, company.CreatedAt);
Assert.AreEqual(2, company.Identifications.Count);
foreach (CompanyIdentification companyIdentification in company.Identifications)
{
Assert.AreEqual(UserName, companyIdentification.CreatedBy);
Assert.AreEqual(m_Now, companyIdentification.CreatedAt);
}
}
开发者ID:jandppw,项目名称:ppwcode-recovered-from-google-code,代码行数:32,代码来源:AuditWithHiLoIdentityGeneratorTests.cs
示例18: buttonOK_Click
private void buttonOK_Click(object sender, EventArgs e)
{
UseWaitCursor = true;
Application.DoEvents();
try
{
if (reviewOptionApprove == null)
reviewOptionApprove = new ReviewOptionApprove();
GetEntity(reviewOptionApprove);
Company company = new Company
{
CompanyName = Party.Text,
CompanyAddress = PartyAddress.Text,
JuridicalPerson = LegalRepre.Text,
Mobile = Tel.Text
};
InvokeUtil.SystemService.UpdateCompanyByName(company);
InvokeUtil.SystemService.EntityUpdate(reviewOptionApprove);
CloseWindow();
}
catch (Exception ex)
{
CommonInvoke.ErrorMessageBox(ex);
}
UseWaitCursor = false;
}
开发者ID:Oman,项目名称:Maleos,代码行数:31,代码来源:frmReviewOptionApprove.cs
示例19: ShouldNotBeNullTest
public void ShouldNotBeNullTest() {
Company company = null;
Assert.Throws<ArgumentNullException>(() => company.ShouldNotBeNull("company"));
Company company2 = new Company();
company2.ShouldNotBeNull("company2");
}
开发者ID:debop,项目名称:NFramework,代码行数:7,代码来源:GuardFixture.cs
示例20: Main
private static void Main()
{
Customer customerOne = new Individual("Radka Piratka");
Customer customerTwo = new Company("Miumiunali Brothers");
Account[] accounts =
{
new Deposit(customerOne, 7000, 5.5m, 18),
new Deposit(customerOne, 980, 5.9m, 12),
new Loan(customerOne, 20000, 7.2m, 2),
new Loan(customerOne, 2000, 8.5m, 9),
new Mortgage(customerOne, 14000, 5.4m, 5),
new Mortgage(customerOne, 5000, 4.8m, 10),
new Deposit(customerTwo, 10000, 6.0m, 12),
new Mortgage(customerTwo, 14000, 6.6m, 18),
new Loan(customerTwo, 15000, 8.9m, 2),
new Loan(customerTwo, 7000, 7.5m, 12),
};
foreach (Account account in accounts)
{
Console.WriteLine(account);
}
Deposit radkaDeposit = new Deposit(customerOne, 980, 5.9m, 12);
Deposit miumiuDeposit = new Deposit(customerTwo, 10000, 6.0m, 12);
Console.WriteLine();
Console.WriteLine("Current balance: {0}", radkaDeposit.WithdrawMoney(150));
Console.WriteLine("Current balance: {0}", radkaDeposit.DepositMoney(1500));
Console.WriteLine("Current balance: {0}", miumiuDeposit.WithdrawMoney(5642));
Console.WriteLine("Current balance: {0}", miumiuDeposit.DepositMoney(1247));
}
开发者ID:RuParusheva,项目名称:TelerikAcademy,代码行数:33,代码来源:Test.cs
注:本文中的Company类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论