本文整理汇总了C#中Supplier.CopyPropertiesFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Supplier.CopyPropertiesFrom方法的具体用法?C# Supplier.CopyPropertiesFrom怎么用?C# Supplier.CopyPropertiesFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier.CopyPropertiesFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
var supplier = new Supplier();
//
// Clone the original supplier for the linq track changes
//
if (_originalsupplier != null)
supplier.CopyPropertiesFrom(_originalsupplier);
supplier.CompanyId = Company.MatrixId.Value;
//
//fill fields of account
//
supplier.BankId = String.IsNullOrEmpty(cboBank.SelectedValue)
? (int?)null
: Convert.ToInt32(cboBank.SelectedValue);
supplier.AccountNumber = String.IsNullOrEmpty(txtAccountNumber.Text)
? null
: txtAccountNumber.Text;
supplier.Agency = String.IsNullOrEmpty(txtAgency.Text)
? null
: txtAgency.Text;
supplier.AccountCreatedDate = null;
if (ucAccountCreatedDate.DateTime.HasValue)
supplier.AccountCreatedDate = ucAccountCreatedDate.DateTime;
//
//fill ranking value
//
supplier.Ranking = rtnRanking.CurrentRating;
if (Profile1.ProfileEntity != null)
{
supplier.ProfileId = Profile1.ProfileEntity.ProfileId;
if (supplier.ProfileId == 0)
supplier.Profile = Profile1.ProfileEntity;
}
else
{
supplier.LegalEntityProfileId = Profile1.CompanyProfileEntity.LegalEntityProfileId;
if (supplier.LegalEntityProfileId == 0)
supplier.LegalEntityProfile = Profile1.CompanyProfileEntity;
}
//
// Verify if a category is selected and associate to supplier
//
if (!String.IsNullOrEmpty(cboSupplierCategory.SelectedValue))
supplier.SupplierCategoryId = Convert.ToInt32(cboSupplierCategory.SelectedValue);
//
// Verify if exists this supplier and mode not equals update
//
if (ExistsSupplier() && Page.ViewState["SupplierId"] == null)
Server.Transfer("Suppliers.aspx");
if (Page.ViewState["SupplierId"] == null && Page.ViewState["ProfileExists"] == null)
{
supplier.CreatedByUser = User.Identity.UserName;
_manager.Insert(supplier);
}
else
{
supplier.ModifiedByUser = User.Identity.UserName;
_manager.Update(_originalsupplier, supplier);
}
if (String.IsNullOrEmpty(Request["w"]))
Page.ClientScript.RegisterStartupScript(GetType(), "", "top.location = Supplier.aspx?SupplierId=" + supplier.SupplierId, true);
else
Page.ClientScript.RegisterStartupScript(
GetType(),
"CloseModal",
"top.$.LightBoxObject.close();" +
"top.content.location.href+='?';",
true);
}