/// <summary> /// 查询状态--表内有数据 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult GetAgentState(int id) //还差钱没扣,还要查询一下状态 { AgentListViewModel model = new AgentListViewModel(); AgentListDTO Agent = new AgentListDTO(); model.Agent = AgentServeice.GetAgentName(GetUserInfo().UserCode).AgentList; if (model.Agent.Length > 0) { model.AgentList = model.Agent.First(); if (model.AgentList.Flag == 0) { return(Json(new AjaxResult { Status = "1", Msg = "提交的申请未审批,请耐心等待" })); } else if (model.AgentList.Flag == 1) { return(Json(new AjaxResult { Status = "1", Msg = "当前已经是报单中心" })); } else if (model.AgentList.Flag == 2) { return(Json(new AjaxResult { Status = "1", Msg = "当前报单中心已被冻结" })); } } return(Json(new AjaxResult { Status = "1", Msg = "您还不是报单中心" })); }
public AgentListDTO ToAgent(AgentEntity Agent) { AgentListDTO AgentList = new AgentListDTO(); AgentList.AgentCode = Agent.AgentCode; AgentList.AgentType = Agent.AgentType; AgentList.CreateTime = Agent.CreateTime; AgentList.Flag = Agent.Flag; AgentList.UserID = Agent.UserID; return(AgentList); }
public AgentListDTO ToDTO(AgentEntity User) { AgentListDTO AgentList = new AgentListDTO(); AgentList.AgentCode = User.AgentCode; AgentList.Flag = User.Flag; AgentList.AgentType = User.AgentType; AgentList.OpenTime = User.OpenTime; AgentList.UserID = User.UserID; AgentList.ID = User.ID; AgentList.CreateTime = User.CreateTime; return(AgentList); }
/// <summary> /// 添加申请报单中心记录数据 /// </summary> /// <param name="UserPro"></param> /// <returns></returns> public long Add(AgentListDTO AgentList) { using (MyDbContext dbc = new MyDbContext()) { AgentEntity user = new AgentEntity(); user.AgentCode = AgentList.AgentCode; user.AgentType = AgentList.AgentType; user.CreateTime = AgentList.CreateTime; user.Flag = AgentList.Flag; user.UserID = AgentList.UserID; user.AppliTime = DateTime.Now; dbc.Agent.Add(user); dbc.SaveChanges(); return(user.ID); } }
/// <summary> /// 提交 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Agent_btn(int id) //提交 { //先查有没有数据 在查是否为待激活状态 ,激活状态,然后在插入申请 AgentListViewModel model = new AgentListViewModel(); AgentListDTO Agent = new AgentListDTO(); model.Agent = AgentServeice.GetAgentName(GetUserInfo().UserCode).AgentList; if (model.Agent.Length > 0) { model.AgentList = model.Agent.First(); if (model.AgentList.AgentType != 2) { return(Json(new AjaxResult { Status = "1", Msg = "提交的申请未审批,请耐心等待" })); } return(Json(new AjaxResult { Status = "1", Msg = "该报单中心已存在" })); } Agent.AgentCode = GetUserInfo().UserCode; Agent.Flag = 0;//等待审核 Agent.UserID = GetLoginID(); Agent.AgentType = 1; Agent.CreateTime = DateTime.Now; long i = AgentServeice.Add(Agent); if (i > 0) { return(Json(new AjaxResult { Status = "1", Msg = "申请成功" })); } return(Json(new AjaxResult { Status = "0", Msg = "申请失败" })); }