本文整理汇总了C#中Company.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Company.Update方法的具体用法?C# Company.Update怎么用?C# Company.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnDelete_Click
protected void btnDelete_Click(object sender, EventArgs e)
{
try
{
Company comp = new Company();
comp.CompanyId = int.Parse(txtCompanyID.Text);
comp.isDeleted = true;
comp.CompanyName = txtName.Text;
comp.ModifiedAccount = this.User.Identity.Name;
comp.Update();
Search();
panelEdit.Visible = false;
panelMain.Visible = true;
}
catch (Exception ex)
{
RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
logger.Error("Erorr btnDelete_click", ex);
}
}
示例2: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
if (btnDelete.Enabled == false)
{
List<Company> listComp = new List<Company>();
listComp = Company.GetAll().Where(l => l.CompanyName.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList();
if (listComp.Count > 0)
{
RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblCompanyName.Text)) + "\");");
return;
}
Company comp = new Company();
comp.CompanyId = Convert.ToInt32(txtCompanyID.Text);
comp.CompanyName = txtName.Text;
if(txtAddress1.Text != "")
comp.Address1 = txtAddress1.Text;
if (txtAddress2.Text != "")
comp.Address2 = txtAddress2.Text;
if (txtTEL.Text != "")
comp.TEL = txtTEL.Text;
if (txtFAX.Text != "")
comp.FAX = txtFAX.Text;
comp.isDeleted = false;
comp.CreateAccount = comp.ModifiedAccount = this.User.Identity.Name;
comp.Insert();
}
else
{
Company comp = new Company();
comp.CompanyId = int.Parse(txtCompanyID.Text);
comp = comp.GetByPrimaryKey();
if (comp.CompanyName.Trim() != txtName.Text.Trim())
{
List<Company> listComp = new List<Company>();
listComp = Company.GetAll().Where(l => l.CompanyName.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList();
if (listComp.Count > 0)
{
RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblCompanyName.Text)) + "\");");
return;
}
}
comp.ModifiedAccount = this.User.Identity.Name;
comp.CompanyId = int.Parse(txtCompanyID.Text);
comp.CompanyName = txtName.Text;
if (txtAddress1.Text != "")
comp.Address1 = txtAddress1.Text;
if (txtAddress2.Text != "")
comp.Address2 = txtAddress2.Text;
if (txtTEL.Text != "")
comp.TEL = txtTEL.Text;
if (txtFAX.Text != "")
comp.FAX = txtFAX.Text;
comp.Update();
}
panelEdit.Visible = false;
panelMain.Visible = true;
Search();
}
catch (Exception ex)
{
RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");");
logger.Error("Erorr btnSave_click", ex);
}
}
示例3: Index
public ActionResult Index(CompanyCreateCommand command)
{
return ExecuteInExplicitTransaction(
action: () =>
{
var company = new Company();
company.Update(command);
RavenSession.Store(company);
RavenSession.SaveChanges();
_tenants.SetCompanyId(Request.Url, company.Id);
CheckSynchronization(company.Id);
HackLevels(company.Id);
HackDivisions(company.Id, command);
},
onsuccess: () => RedirectToAction("Index"));
}