126 lines
6.1 KiB
C#
126 lines
6.1 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.SES
|
|
{
|
|
public partial class CTSalesContractsEdit :PageBase
|
|
{
|
|
#region 加载
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
string view = Request.Params["view"];
|
|
if (view == "1")
|
|
{
|
|
this.btnSave.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
GetButtonPower();//按钮权限
|
|
}
|
|
|
|
BLL.DepartService.InitDropDownList(this.drpDeptOfRevenue, true);
|
|
BLL.DepartService.InitDropDownList(this.drpConfirmedBy, true);
|
|
|
|
string ctSalesContractsId = Request.Params["ctSalesContractsId"];
|
|
if (!string.IsNullOrEmpty(ctSalesContractsId))
|
|
{
|
|
Model.EMC_CTSalesContracts ctSalesContracts = BLL.CTSalesContractsService.GetCTSalesContractsById(ctSalesContractsId);
|
|
if (ctSalesContracts != null)
|
|
{
|
|
this.txtContractNumber.Text = ctSalesContracts.ContractNumber;
|
|
this.txtContractTitle.Text = ctSalesContracts.ContractTitle;
|
|
this.txtCustomer.Text = ctSalesContracts.Customer;
|
|
this.txtCustomerNum.Text = ctSalesContracts.CustomerNum;
|
|
this.txtPriceType.Text = ctSalesContracts.PriceType;
|
|
this.txtServiceType.Text = ctSalesContracts.ServiceType;
|
|
this.txtContractPrice.Text = ctSalesContracts.ContractPrice != null ? ctSalesContracts.ContractPrice.ToString() : "";
|
|
this.txtVAT.Text = ctSalesContracts.VAT;
|
|
this.txtContracrTermStart.Text = ctSalesContracts.ContractTermStart != null ? string.Format("{0:yyyy-MM-dd}", ctSalesContracts.ContractTermStart) : "";
|
|
this.txtContracrTermEnd.Text = ctSalesContracts.ContractTermEnd != null ? string.Format("{0:yyyy-MM-dd}", ctSalesContracts.ContractTermEnd) : "";
|
|
this.txtStatus.Text = ctSalesContracts.Status;
|
|
if (!string.IsNullOrEmpty(ctSalesContracts.DeptOfRevenue))
|
|
{
|
|
this.drpDeptOfRevenue.SelectedValue = ctSalesContracts.DeptOfRevenue;
|
|
}
|
|
if (!string.IsNullOrEmpty(ctSalesContracts.ConfirmedBy))
|
|
{
|
|
this.drpConfirmedBy.SelectedValue = ctSalesContracts.ConfirmedBy;
|
|
}
|
|
this.txtRemark.Text = ctSalesContracts.Remark;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string ctSalesContractsId = Request.Params["ctSalesContractsId"];
|
|
Model.EMC_CTSalesContracts ctSalesContracts = new Model.EMC_CTSalesContracts();
|
|
ctSalesContracts.ContractNumber = this.txtContractNumber.Text.Trim();
|
|
ctSalesContracts.ContractTitle = this.txtContractTitle.Text.Trim();
|
|
ctSalesContracts.Customer = this.txtCustomer.Text.Trim();
|
|
ctSalesContracts.CustomerNum = this.txtCustomerNum.Text.Trim();
|
|
ctSalesContracts.PriceType = this.txtPriceType.Text.Trim();
|
|
ctSalesContracts.ServiceType = this.txtServiceType.Text.Trim();
|
|
ctSalesContracts.ContractPrice = Funs.GetNewDecimalOrZero(this.txtContractPrice.Text.Trim());
|
|
ctSalesContracts.VAT = this.txtVAT.Text.Trim();
|
|
ctSalesContracts.ContractTermStart = Funs.GetNewDateTime(this.txtContracrTermStart.Text.Trim());
|
|
ctSalesContracts.ContractTermEnd = Funs.GetNewDateTime(this.txtContracrTermEnd.Text.Trim());
|
|
ctSalesContracts.Status = this.txtStatus.Text.Trim();
|
|
if (this.drpDeptOfRevenue.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpDeptOfRevenue.SelectedValue))
|
|
{
|
|
ctSalesContracts.DeptOfRevenue = this.drpDeptOfRevenue.SelectedValue;
|
|
}
|
|
if (this.drpConfirmedBy.SelectedValue!=BLL.Const._Null&&!string.IsNullOrEmpty(this.drpConfirmedBy.SelectedValue))
|
|
{
|
|
ctSalesContracts.ConfirmedBy = this.drpConfirmedBy.SelectedValue;
|
|
}
|
|
ctSalesContracts.Remark = this.txtRemark.Text.Trim();
|
|
if (!string.IsNullOrEmpty(ctSalesContractsId))
|
|
{
|
|
ctSalesContracts.CTSalesContractsId = ctSalesContractsId;
|
|
BLL.CTSalesContractsService.UpdateCTSalesContracts(ctSalesContracts);
|
|
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Modify CT Sales Contracts!");
|
|
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ctSalesContracts.CTSalesContractsId = SQLHelper.GetNewID(typeof(Model.EMC_CTSalesContracts));
|
|
BLL.CTSalesContractsService.AddCTSalesContracts(ctSalesContracts);
|
|
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Add CT Sales Contracts!");
|
|
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
|
}
|
|
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
|
|
#region 权限设置
|
|
/// <summary>
|
|
/// 菜单按钮权限
|
|
/// </summary>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.CTSalesContractsMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |