using System; using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Description; using ESCG = GSYWApi.GeneralMethod; using ESCM = GSYWApi.Model; using HZQR.Common; namespace GSYWApi.Controllers { /// /// 相关接口 /// public class PERSONSELLController : BaseController { #region 获取列表 /// /// 获取列表 /// /// 查询条件对象 /// [Route("Analysis/GetPERSONSELLList")] [AcceptVerbs("POST")] [ResponseType(typeof(Models.JsonMsg>))] public IHttpActionResult GetPERSONSELLList(ESCM.SearchModel searchModel) { string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】,查询页码【" + searchModel.PageIndex + "】," + "每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】"; try { int TotalCount = 0; //获取列表 List PERSONSELLList = ESCG.PERSONSELLHelper.GetPERSONSELLList( transaction, ref TotalCount, searchModel); //转化json形式 Models.JsonList jsonList = Models.JsonList.Success( PERSONSELLList, TotalCount, searchModel.PageIndex, searchModel.PageSize); return Ok(Models.JsonMsg>.Success(jsonList, 100, "查询成功")); } catch (Exception ex) { //事务回滚 transaction.Rollback(); LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter, DateTime.Now.ToString("yyyyMMdd") + "_GetPERSONSELLList"); return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message)); } } #endregion #region 获取明细 /// /// 获取明细 /// /// 内码 /// [Route("Analysis/GetPERSONSELLDetail")] [AcceptVerbs("GET")] [ResponseType(typeof(Models.JsonMsg))] public IHttpActionResult GetPERSONSELLDetail(int PERSONSELLId) { string Parameter = "入参信息:内码【" + PERSONSELLId + "】"; try { //获取明细 ESCM.PERSONSELLModel personsellModel = ESCG.PERSONSELLHelper.GetPERSONSELLDetail(transaction, PERSONSELLId); return Ok(Models.JsonMsg.Success(personsellModel, 100, "查询成功")); } catch (Exception ex) { //事务回滚 transaction.Rollback(); LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter, DateTime.Now.ToString("yyyyMMdd") + "_GetPERSONSELLDetail"); return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message)); } } #endregion #region 同步 /// /// 同步 /// /// /// [Route("Analysis/SynchroPERSONSELL")] [AcceptVerbs("POST")] [ResponseType(typeof(Models.JsonMsg))] public IHttpActionResult SynchroPERSONSELL(ESCM.PERSONSELLModel personsellModel) { try { //新增 bool SynchroFlag = ESCG.PERSONSELLHelper.SynchroPERSONSELL(transaction, personsellModel); if (SynchroFlag) { return Ok(Method.Common.ReturnJson(100, "同步成功")); } else { return Ok(Method.Common.ReturnJson(200, "更新失败,数据不存在!")); } } catch (Exception ex) { //事务回滚 transaction.Rollback(); LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message, DateTime.Now.ToString("yyyyMMdd") + "_SynchroPERSONSELL"); return Ok(Method.Common.ReturnJson(999, "同步失败" + ex.Message)); } } #endregion #region 删除 /// /// 删除 /// /// 内码 /// [Route("Analysis/DeletePERSONSELL")] [AcceptVerbs("GET", "POST")] [ResponseType(typeof(Models.JsonMsg))] public IHttpActionResult DeletePERSONSELL(int PERSONSELLId) { string Parameter = "入参信息:内码【" + PERSONSELLId + "】"; try { //删除 bool DeleteFlag = ESCG.PERSONSELLHelper.DeletePERSONSELL(transaction, PERSONSELLId); if (DeleteFlag) { return Ok(Method.Common.ReturnJson(100, "删除成功")); } else { return Ok(Method.Common.ReturnJson(200, "删除失败,数据不存在!")); } } catch (Exception ex) { //事务回滚 transaction.Rollback(); LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter, DateTime.Now.ToString("yyyyMMdd") + "_DeletePERSONSELL"); return Ok(Method.Common.ReturnJson(999, "删除失败" + ex.Message)); } } #endregion } }