本文整理汇总了C#中System.Decimal.GetValueOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Decimal.GetValueOrDefault方法的具体用法?C# Decimal.GetValueOrDefault怎么用?C# Decimal.GetValueOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Decimal
的用法示例。
在下文中一共展示了Decimal.GetValueOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFormContract
public void AddFormContract(int? RejectedFormID, int UserID, int? ProxyUserID, int? ProxyPositionID, int OrganizationUnitID, int PositionID, SystemEnums.FormType FormTypeID,
SystemEnums.FormStatus StatusID, string ContractName, int ContractTypeID, Decimal? ContractAmount, int? PageNumber, string FirstCompany, string SecondCompany, string ThirdCompany, DateTime? BeginDate, DateTime? EndDate, string PaymentType, string MainContent, string ChangePart, string AttachedFileName, string RealAttachedFileName, string FlowTemplate)
{
SqlTransaction transaction = null;
try {
transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
TableAdapterHelper.SetTransaction(this.TAFormContract, transaction);
FormDS.FormRow formRow = this.FormDataSet.Form.NewFormRow();
if (RejectedFormID != null) {
formRow.RejectedFormID = RejectedFormID.GetValueOrDefault();
}
formRow.UserID = UserID;
UtilityBLL utility = new UtilityBLL();
if (StatusID == SystemEnums.FormStatus.Awaiting) {
string formTypeString = utility.GetFormTypeString((int)FormTypeID);
formRow.FormNo = utility.GetFormNo(formTypeString);
} else {
formRow.SetFormNoNull();
}
if (ProxyUserID != null) {
formRow.ProxyUserID = ProxyUserID.GetValueOrDefault();
}
if (ProxyPositionID != null) {
formRow.ProxyPositionID = ProxyPositionID.GetValueOrDefault();
}
formRow.OrganizationUnitID = OrganizationUnitID;
formRow.PositionID = PositionID;
formRow.FormTypeID = (int)FormTypeID;
formRow.StatusID = (int)StatusID;
formRow.SubmitDate = DateTime.Now;
formRow.LastModified = DateTime.Now;
formRow.InTurnUserIds = "P";//待改动
formRow.InTurnPositionIds = "P";//待改动
formRow.PageType = (int)SystemEnums.PageType.ContractApply;
this.FormDataSet.Form.AddFormRow(formRow);
this.TAForm.Update(formRow);
//处理申请表的内容
FormDS.FormContractRow formContractRow = this.FormDataSet.FormContract.NewFormContractRow();
formContractRow.ContractName = ContractName;
formContractRow.FormContractID = formRow.FormID;
formContractRow.ContractTypeID = ContractTypeID;
formContractRow.ContractAmount = ContractAmount.GetValueOrDefault();
formContractRow.PageNumber = PageNumber.GetValueOrDefault();
formContractRow.FirstCompany = FirstCompany;
formContractRow.SecondCompany = SecondCompany;
formContractRow.ThirdCompany = ThirdCompany;
formContractRow.BeginDate = BeginDate.GetValueOrDefault();
formContractRow.EndDate = EndDate.GetValueOrDefault();
formContractRow.PaymentType = PaymentType;
formContractRow.MainContent = MainContent;
formContractRow.ChangePart = ChangePart;
formContractRow.AttachedFileName = AttachedFileName;
formContractRow.RealAttachedFileName = RealAttachedFileName;
if (StatusID == SystemEnums.FormStatus.Awaiting)
{
formContractRow.ContractNo = GetContractNo(ContractTypeID);
}
this.FormDataSet.FormContract.AddFormContractRow(formContractRow);
this.TAFormContract.Update(formContractRow);
// 正式提交或草稿
Dictionary<string, object> dic = new Dictionary<string, object>();
dic["Apply_Amount"] = ContractAmount;//合同金额
dic["ContractType"] = new MasterDataBLL().GetContractTypeById(ContractTypeID).ContractTypeName;
APHelper AP = new APHelper();
new APFlowBLL().ApplyForm(AP, TAForm, RejectedFormID, formRow, OrganizationUnitID, FlowTemplate, StatusID, dic);
//this.TAFormContract.Update(formContractRow);
transaction.Commit();
} catch (Exception ex) {
transaction.Rollback();
throw new ApplicationException("Save Fail!" + ex.ToString());
} finally {
transaction.Dispose();
}
}