using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using PL.Base; using PL.UI.Controls; using FMS.ServiceList; using FMS.Entity; using FMS.UI; using System.Activities.Expressions; using System.Data.Common.CommandTrees; public partial class AppFms_ServiceMoudle_frmBdMoudleHeadEdit : BasePage { private string key { get { return this.hidKey.Value; } set { this.hidKey.Value = value; } } private string biztype { get { return this.hidBizType.Value; } set { this.hidBizType.Value = value; } } private string moudle { get { return this.hidMoudle.Value; } set { this.hidMoudle.Value = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.cboBizType.InitItems();//业务范畴 this.cboMoudleType.InitItems();//模板类型 this.key = PageHelper.Request("key"); this.cboBizType.SelectedValue = PageHelper.Request("biztype"); this.cboMoudleType.SelectedValue = PageHelper.Request("moudle"); this.biztype = PageHelper.Request("biztype"); this.moudle = PageHelper.Request("moudle"); this.gvData.Columns[2].HeaderText = (this.moudle == "M01" ? "应收服务" : "应付服务"); //this.cboServiceId.InitItems(); if (this.key.HasValue()) { LoadRecord(); } else { this.btnAdd.Enabled = false; } } } private void LoadRecord() { EciRequest request = new EciRequest(FMSService.BdMoudleHeadLoad); request.Key = this.key; EciResponse response = SOA.Execute(request); BD_MOUDLE_HEAD data = response.DataTable.ToEntity(); this.Bind(data); EciRequest requestBody = new EciRequest(FMSService.BdMoudleBodyLoad); request.Key = this.key; EciResponse responseBody = SOA.Execute(request); BD_MOUDLE_BODY dataBody = response.DataTable.ToEntity(); this.Bind(dataBody); } protected void btnSave_Click(object sender, EventArgs e) { EciRequest request = new EciRequest(FMSService.BdMoudleHeadSave); request.IsAdd = this.key.NullOrEmpty(); BD_MOUDLE_HEAD saveEntity = new BD_MOUDLE_HEAD(); request.Entity = saveEntity; saveEntity.Data = this.GetEntityFromUI().Data; saveEntity.GUID = this.key; EciResponse response = SOA.Execute(request); BD_MOUDLE_HEAD data = response.Entity.Upgrade(); if (request.IsAdd) { this.key = data.GUID; this.btnAdd.Enabled = true; //this.txtCreateDate.Text = DateTime.Now.ToFullString(); //this.txtCreateUser.Text = this.UserInfo.UserName; } //this.txtUpdateDate.Text = DateTime.Now.ToFullString(); //this.txtUpdateUser.Text = this.UserInfo.UserName; response.Message.Tip(); } protected void btnDelete2_Click(object sender, EventArgs e) { Button btn = sender as Button; string key = btn.CommandArgument; EciRequest request = new EciRequest(FMSService.BdMoudleBodyDelete); request.ListKey = new List() { key }; SOA.Execute(request); EAlert.Tip("删除执行成功"); //this.Search(); } /// /// /// /// /// protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //string SERVICE_ID = this.moudle=="M01"?e.Row.FromKey("SERVICE_ID").Text="应收服务":"应付服务"; ECombox cboServiceId = (ECombox)e.Row.FindControl("cboServiceId"); EChoose txtCustomName = (EChoose)e.Row.FindControl("txtCustomName"); ECombox cboReceiveStandardId = (ECombox)e.Row.FindControl("cboReceiveStandardId"); ETextBox txtReceivePrice = (ETextBox)e.Row.FindControl("txtReceivePrice"); EChoose txtReceiveCurrId = (EChoose)e.Row.FindControl("txtReceiveCurrId"); ETextBox txtReceiveMin = (ETextBox)e.Row.FindControl("txtReceiveMin"); ETextBox txtReceiveMax = (ETextBox)e.Row.FindControl("txtReceiveMax"); ECombox cboDecimalLength = (ECombox)e.Row.FindControl("cboDecimalLength"); ECombox cboReceiveMantissaTypeId = (ECombox)e.Row.FindControl("cboReceiveMantissaTypeId"); cboServiceId.Condition = "BIZ_FLAG=" + this.biztype; cboServiceId.InitItems(); cboReceiveStandardId.InitItems(); cboDecimalLength.InitItems(); cboReceiveMantissaTypeId.InitItems(); } } /// /// 新增 /// /// /// protected void btnAdd_Click(object sender, EventArgs e) { //默认结算方 DataTable dt = this.gvData.DataTable(true); for (int i = 0; i <1; i++) { DataRow dr = dt.NewRow(); //默认状态(草稿) dr["HEAD_GUID"] = this.key; dr["SERVICE_ID"] = this.biztype; dt.Rows.Add(dr); } this.gvData.EDataSource = dt; int rowNum = dt.Rows.Count; HtmlWindow.Onload("setFocus(" + rowNum + ")"); } }