using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.HJGL.PreDesign { public partial class PackagingManageEdit : PageBase { public string PackagingManageId { get { return (string)ViewState["PackagingManageId"]; } set { ViewState["PackagingManageId"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PackagingManageId = Request.Params["PackagingManageId"]; //HJGL_PipelineComponentService.InitPipelineDownList(drpPipelineComponentCode, this.CurrUser.LoginProjectId, false); BindGrid(); //HJGL_PackagingmanageService.InitPipelineDownList(txtPackagingCode, this.CurrUser.LoginProjectId, false); btnClose.OnClientClick = ActiveWindow.GetHideReference(); if (!string.IsNullOrEmpty(PackagingManageId)) { var model = HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId); txtPackagingCode.Text = model.PackagingCode; dropPipelineComponentCode.Values = model.PipelineComponentId.Split(','); txtStackingPosition.Text = model.StackingPosition; txtContactName.Text = model.ContactName; txtContactPhone.Text = model.ContactPhone; if (model.State== HJGL_PackagingmanageService.state_0) { btnSave.Hidden = false; } } else {btnSave.Hidden = false; txtPackagingCode.Text = ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId)+"-"+ string.Format("{0:yyyyMMdd}", DateTime.Now)+"-"; } } } private void BindGrid() { Grid1.DataSource = HJGL_PipelineComponentService.GetAcceptedPipelineComponent(CurrUser.LoginProjectId, txtpipelineCode.Text.Trim(), txtpipelineComponentCode.Text.Trim(), txtflowingSection.Text.Trim()); Grid1 .DataBind(); } //protected void drpPipelineComponentCode_SelectedIndexChanged(object sender, EventArgs e) //{ // if (!string .IsNullOrEmpty(drpPipelineComponentCode.SelectedValue)) // { // var model_Component = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(drpPipelineComponentCode.SelectedValue); // var model_pipe=BLL.PipelineService.GetPipelineByPipelineId(model_Component.PipelineId); // txtPlanStartDate.Text= model_Component.PlanStartDate.ToString(); // } // else // { // txtPlanStartDate.Text =String.Empty; // } //} protected void btnSave_Click(object sender, EventArgs e) { if (dropPipelineComponentCode.Values.Length==0) { ShowNotify("请选择预制组件", MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(PackagingManageId)) { Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage() ; table.PackagingManageId = SQLHelper.GetNewID(); table.PackagingCode = txtPackagingCode.Text; table.ProjectId = this.CurrUser.LoginProjectId; table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values); table.StackingPosition = txtStackingPosition.Text; table.State = 0; table.ContactName = txtContactName.Text; table.ContactPhone = txtContactPhone.Text; BLL.HJGL_PackagingmanageService.AddHJGL_PackagingManage(table); } else { Model.HJGL_PackagingManage table = BLL.HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId); if (table != null) { table.PackagingCode = txtPackagingCode.Text; table.ProjectId = this.CurrUser.LoginProjectId; table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values); table.StackingPosition = txtStackingPosition.Text ; table.State = 0; table.ContactName = txtContactName.Text; table.ContactPhone =txtContactPhone.Text; } BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } protected void btnFind_Click1(object sender, EventArgs e) { BindGrid(); } } }