天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.9 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMAPP.Common.Web.Controllers;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.Data;
using QMAPP.ServicesAgent;
using QMAPP.MD.Entity;
using QMAPP.Entity;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
using QMAPP.MD.Web.Models;
using QMAPP.MD.Web;
namespace QMAPP.MD.Web.Controllers
{
/// <summary>
/// 模块名称:公司
/// 作 者:郭兆福
/// 编写日期:2017年05月05日
/// </summary>
public class CorpController : QController
{
/// <summary>
/// 编辑载入
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult Edit()
{
CorpModel model = new CorpModel();
Corp Entity = new Corp();
ServiceAgent wcfAgent = this.GetServiceAgent();
DataResult<Corp> result = new DataResult<Corp>();
try
{
result = wcfAgent.InvokeServiceFunction<DataResult<Corp>>("CorpBLL_Get", Entity);
if (result.IsSuccess == false)
{
SetMessage(result.Msg);
return View("CorpEdit", model);
}
model = CopyToModel<CorpModel, Corp>(result.Result);
return View("CorpEdit", model);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 保存
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
[ValidateInput(false)]
public ActionResult Save(CorpModel saveModel)
{
Corp Entity = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
DataResult<int> result = new DataResult<int>();
try
{
Entity = CopyToModel<Corp, CorpModel>(saveModel);
if (string.IsNullOrEmpty(Entity.PID) == true)
{
//新增
result = wcfAgent.InvokeServiceFunction<DataResult<int>>("CorpBLL_Insert", Entity);
}
else
{
//修改
result = wcfAgent.InvokeServiceFunction<DataResult<int>>("CorpBLL_Update", Entity);
}
if (result.IsSuccess)
{
SetMessage(AppResource.SaveMessge);
}
else
{
SetMessage("公司信息保存失败!【" + result.Msg + "】");
}
return View("CorpEdit", saveModel);
}
catch (Exception ex)
{
throw ex;
}
}
}
}