提交代码
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
using BLL;
|
||||
using System;
|
||||
|
||||
namespace FineUIPro.Web.TestRun.DriverGoods
|
||||
{
|
||||
public partial class GoodsModelEdit : PageBase
|
||||
{
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
string id = Request.Params["GoodsModelId"];
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
Model.DriverGoods_GoodsModel goodsModel = BLL.GoodsModelService.GetGoodsModelById(id);
|
||||
if (goodsModel != null)
|
||||
{
|
||||
this.hdId.Text = id;
|
||||
if (goodsModel.Code != null)
|
||||
{
|
||||
this.txtCode.Text = goodsModel.Code.ToString();
|
||||
}
|
||||
this.txtPurpose.Text = goodsModel.Purpose;
|
||||
this.txtDescription.Text = goodsModel.Description;
|
||||
this.txtQuantity.Text = goodsModel.Quantity;
|
||||
this.txtAttachment.Text = goodsModel.Attachment;
|
||||
this.txtRemark.Text = goodsModel.Remark;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 附件上传
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
||||
{
|
||||
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverGoods_GoodsModel));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverGoods/GoodsModel&menuId={1}", this.hdId.Text, BLL.Const.GoodsModelMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string id = Request.Params["GoodsModelId"];
|
||||
Model.DriverGoods_GoodsModel newgoodsModel = new Model.DriverGoods_GoodsModel();
|
||||
newgoodsModel.Code = Funs.GetNewInt(this.txtCode.Text.Trim());
|
||||
newgoodsModel.Purpose = this.txtPurpose.Text.Trim();
|
||||
newgoodsModel.Description = this.txtDescription.Text.Trim();
|
||||
newgoodsModel.Quantity = this.txtQuantity.Text.Trim();
|
||||
newgoodsModel.Attachment = this.txtAttachment.Text.Trim();
|
||||
newgoodsModel.Remark = this.txtRemark.Text.Trim();
|
||||
newgoodsModel.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
newgoodsModel.GoodsModelId = id;
|
||||
BLL.GoodsModelService.UpdateGoodsModel(newgoodsModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdId.Text))
|
||||
{
|
||||
newgoodsModel.GoodsModelId = this.hdId.Text.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
newgoodsModel.GoodsModelId = SQLHelper.GetNewID(typeof(Model.DriverGoods_GoodsModel));
|
||||
this.hdId.Text = newgoodsModel.GoodsModelId;
|
||||
}
|
||||
BLL.GoodsModelService.AddGoodsModel(newgoodsModel);
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user