306 lines
12 KiB
C#
306 lines
12 KiB
C#
using BLL;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using FineUIPro.Web.PHTGL.ContractCompile;
|
|
|
|
namespace FineUIPro.Web.PHTGL.Filing
|
|
{
|
|
public partial class ContractStandingBookEdit : PageBase
|
|
{
|
|
#region 定义属性
|
|
// public Dictionary<string, string> myDictionary = new Dictionary<string, string>();
|
|
|
|
public Dictionary<string, string> myDictionary
|
|
{
|
|
get
|
|
{
|
|
return (Dictionary<string, string>)ViewState["myDictionary"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["myDictionary"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 合同基本信息主键
|
|
/// </summary>
|
|
public string ContractId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ContractId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ContractId"] = value;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public bool IsCreate
|
|
{
|
|
get
|
|
{
|
|
return (bool)ViewState["IsCreate"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["IsCreate"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
ContractId = Request.Params["ContractId"];
|
|
IsCreate = true;
|
|
if (!string.IsNullOrEmpty(Request.Params["ContractId"]))
|
|
{
|
|
IsCreate = false;
|
|
}
|
|
this.GetButtonPower();
|
|
|
|
BindingTab1();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region 基本信息
|
|
|
|
void BindingTab1()
|
|
{
|
|
|
|
string contractId = Request.Params["ContractId"];
|
|
if (!string.IsNullOrEmpty(contractId))
|
|
{
|
|
Model.PHTGL_ContractStandingBook contract = BLL.ContractStandingBookService.GetContractById(contractId);
|
|
if (contract != null)
|
|
{
|
|
|
|
txtEPCCode.Text = contract.EPCCode;
|
|
txtContractAttribute.Text = contract.ContractAttribute;
|
|
this.txtContractName.Text = contract.ContractName;
|
|
this.txtContractNum.Text = contract.ContractNum;
|
|
this.txtProjectName.Text = contract.ProjectName;
|
|
this.txtProjectCode.Text = contract.ProjectCode;
|
|
this.txtParties.Text = contract.Parties;
|
|
this.txtBuildUnit.Text = contract.BuildUnit;
|
|
this.txtCurrency.Text= contract.Currency;
|
|
txtOpeningBank_TT.Text = contract.OpeningBank_TT;
|
|
txtOpeningBank_Electrophore.Text = contract.OpeningBank_Electrophore;
|
|
txtBankAccount_TT.Text = contract.BankAccount_TT;
|
|
txtBankAccount_Electrophore.Text = contract.BankAccount_Electrophore;
|
|
txtLineNumber_Electrophore.Text = contract.LineNumber_Electrophore;
|
|
txtRetentionmoney.Text = contract.Retentionmoney;
|
|
txtContactUnitOfPartyA.Text = contract.ContactUnitOfPartyA;
|
|
txtContactPersonOfPartyA.Text = contract.ContactPersonOfPartyA;
|
|
txtContactPersonOfPartyB.Text = contract.ContactPersonOfPartyB;
|
|
txtContactPersonPhoneOfPartyB.Text = contract.ContactPersonPhoneOfPartyB;
|
|
txtContactPersonEmailOfPartyB.Text = contract.ContactPersonEmailOfPartyB;
|
|
txtContractAmountExcludingTax.Text = contract.ContractAmountExcludingTax;
|
|
txtPriceMethod.Text = contract.PriceMethod;
|
|
txtSignedOnDate.Text = contract.SignedOnDate;
|
|
txtContractStartDate.Text = contract.ContractStartDate;
|
|
txtContractEndDate.Text = contract.ContractEndDate;
|
|
txtPricingBasis.Text = contract.PricingBasis;
|
|
txtStatus.Text = contract.Status;
|
|
txtSubcontractingMethod.Text = contract.SubcontractingMethod;
|
|
txtIsItACentralizedPurchaseSupplier.Text = contract.IsItACentralizedPurchaseSupplier;
|
|
this.txtAgent.Text = contract.Agent;
|
|
this.txtContractType.Text = contract.ContractType;
|
|
this.txtConfirmWay.Text= contract.ConfirmWay;
|
|
this.txtDepart.Text=BLL.DepartService.getDepartNameById(contract.DepartId);
|
|
this.txtContractAmount.Text = contract.ContractAmount;
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
this.txtAgent.Text = this.CurrUser.PersonName;
|
|
this.txtDepart.Text = BLL.DepartService.getDepartNameById(this.CurrUser.DepartId);
|
|
}
|
|
}
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(ContractId))
|
|
{
|
|
ContractId = Guid.NewGuid().ToString();
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ContractStandingBook&menuId={1}", this.ContractId, BLL.Const.ContractStandingBookMenuId)));
|
|
}
|
|
protected void btnAttachUrl_1_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(ContractId))
|
|
{
|
|
ContractId = Guid.NewGuid().ToString();
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ContractStandingBook&menuId={1}", this.ContractId+"-1", BLL.Const.ContractStandingBookMenuId)));
|
|
}
|
|
#endregion
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Save(Const.BtnSave);
|
|
|
|
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
void Save(string Type)
|
|
{
|
|
Model.PHTGL_ContractStandingBook contract = new Model.PHTGL_ContractStandingBook();
|
|
contract.UnitId = this.CurrUser.UnitId;
|
|
contract.EPCCode = this.txtEPCCode.Text;
|
|
contract.ContractAttribute = this.txtContractAttribute.Text;
|
|
contract.ContractName = this.txtContractName.Text;
|
|
contract.ContractNum = this.txtContractNum.Text;
|
|
contract.ProjectName = this.txtProjectName.Text;
|
|
contract.ProjectCode = this.txtProjectCode.Text;
|
|
contract.Parties = this.txtParties.Text;
|
|
contract.BuildUnit = this.txtBuildUnit.Text;
|
|
contract.Currency = this.txtCurrency.Text;
|
|
contract.OpeningBank_TT = this.txtOpeningBank_TT.Text;
|
|
contract.OpeningBank_Electrophore = this.txtOpeningBank_Electrophore.Text;
|
|
contract.BankAccount_TT = this.txtBankAccount_TT.Text;
|
|
contract.BankAccount_Electrophore = this.txtBankAccount_Electrophore.Text;
|
|
contract.LineNumber_Electrophore = this.txtLineNumber_Electrophore.Text;
|
|
contract.Retentionmoney = this.txtRetentionmoney.Text;
|
|
contract.ContactUnitOfPartyA = this.txtContactUnitOfPartyA.Text;
|
|
contract.ContactPersonOfPartyA = this.txtContactPersonOfPartyA.Text;
|
|
contract.ContactPersonOfPartyB = this.txtContactPersonOfPartyB.Text;
|
|
contract.ContactPersonPhoneOfPartyB = this.txtContactPersonPhoneOfPartyB.Text;
|
|
contract.ContactPersonEmailOfPartyB = this.txtContactPersonEmailOfPartyB.Text;
|
|
contract.ContractAmountExcludingTax = this.txtContractAmountExcludingTax.Text;
|
|
contract.PriceMethod = this.txtPriceMethod.Text;
|
|
contract.SignedOnDate = this.txtSignedOnDate.Text;
|
|
contract.ContractStartDate = this.txtContractStartDate.Text;
|
|
contract.ContractEndDate = this.txtContractEndDate.Text;
|
|
contract.PricingBasis = this.txtPricingBasis.Text;
|
|
contract.Status = this.txtStatus.Text;
|
|
contract.SubcontractingMethod = this.txtSubcontractingMethod.Text;
|
|
contract.IsItACentralizedPurchaseSupplier = this.txtIsItACentralizedPurchaseSupplier.Text;
|
|
contract.Agent = this.txtAgent.Text;
|
|
contract.ContractType = this.txtContractType.Text;
|
|
contract.ConfirmWay = this.txtConfirmWay.Text;
|
|
contract.DepartId = this.CurrUser.DepartId;
|
|
|
|
contract.ContractAmount = this.txtContractAmount.Text;
|
|
if (Type==Const.BtnSubmit)
|
|
{
|
|
contract.States = 1;
|
|
|
|
}
|
|
else if (Type == Const.BtnSave)
|
|
{
|
|
contract.States = 0;
|
|
|
|
}
|
|
contract.CreateDate = DateTime.Now.ToString();
|
|
|
|
contract.CreatUser = this.CurrUser.PersonId;
|
|
|
|
if (!string.IsNullOrEmpty(ContractId))
|
|
{
|
|
var con = ContractStandingBookService.GetContractById(ContractId);
|
|
if (con != null)
|
|
{
|
|
contract.ContractId = ContractId;
|
|
contract.ApproveState = con.ApproveState;
|
|
contract.CreatUser = this.CurrUser.PersonId;
|
|
contract.CreateDate = DateTime.Now.ToString();
|
|
BLL.ContractStandingBookService.UpdateContract(contract);
|
|
ShowNotify("修改成功!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
contract.ContractId = ContractId;
|
|
contract.ApproveState = Const.ContractCreating;
|
|
contract.CreatUser = this.CurrUser.PersonId;
|
|
ContractId = contract.ContractId;
|
|
contract.CreateDate = DateTime.Now.ToString();
|
|
BLL.ContractStandingBookService.AddContract(contract);
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
contract.ContractId = SQLHelper.GetNewID(typeof(Model.PHTGL_ContractStandingBook));
|
|
contract.ApproveState = Const.ContractCreating;
|
|
contract.CreatUser = this.CurrUser.PersonId;
|
|
contract.CreateDate = DateTime.Now.ToString();
|
|
ContractId = contract.ContractId;
|
|
BLL.ContractStandingBookService.AddContract(contract);
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
if (!BLL.AttachFileService.Getfile(ContractId , BLL.Const.ContractStandingBookMenuId))
|
|
{
|
|
ShowNotify("未上传合同签字盖章扫描版文件,无法提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (!BLL.AttachFileService.Getfile(this.ContractId + "-1", BLL.Const.ContractStandingBookMenuId))
|
|
{
|
|
ShowNotify("未上传合同评审及审批表,无法提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
Save(Const.BtnSubmit);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (!string.IsNullOrEmpty(ContractId))
|
|
{
|
|
var q = BLL.ContractStandingBookService.GetContractById(ContractId);
|
|
if (q != null && q.States == 1)
|
|
{
|
|
btnSave.Hidden = true;
|
|
btnSubmit.Hidden = true;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
// ShowNotify("窗体被关闭了。参数:" + (String.IsNullOrEmpty(e.CloseArgument) ? "无" : e.CloseArgument));
|
|
}
|
|
|
|
|
|
}
|
|
} |