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 { /// /// 模块名称:公司 /// 作 者:郭兆福 /// 编写日期:2017年05月05日 /// public class CorpController : QController { /// /// 编辑载入 /// /// 处理结果 [HandleException] public ActionResult Edit() { CorpModel model = new CorpModel(); Corp Entity = new Corp(); ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult result = new DataResult(); try { result = wcfAgent.InvokeServiceFunction>("CorpBLL_Get", Entity); if (result.IsSuccess == false) { SetMessage(result.Msg); return View("CorpEdit", model); } model = CopyToModel(result.Result); return View("CorpEdit", model); } catch (Exception ex) { throw ex; } } /// /// 保存 /// /// /// 处理结果 [HttpPost] [HandleException] [ValidateInput(false)] public ActionResult Save(CorpModel saveModel) { Corp Entity = null; ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult result = new DataResult(); try { Entity = CopyToModel(saveModel); if (string.IsNullOrEmpty(Entity.PID) == true) { //新增 result = wcfAgent.InvokeServiceFunction>("CorpBLL_Insert", Entity); } else { //修改 result = wcfAgent.InvokeServiceFunction>("CorpBLL_Update", Entity); } if (result.IsSuccess) { SetMessage(AppResource.SaveMessge); } else { SetMessage("公司信息保存失败!【" + result.Msg + "】"); } return View("CorpEdit", saveModel); } catch (Exception ex) { throw ex; } } } }