public ActionResult Confirm(ConfirmDM confirmDM) { if (!confirmDM.IsConfirmed && String.IsNullOrEmpty(confirmDM.Description)) { ModelState.AddModelError("", "Не указана причина отклонения"); } if (ModelState.IsValid) { ConfirmDTO confirm = _rentMapperDM.ToConfirmDTO.Map <ConfirmDM, ConfirmDTO>(confirmDM); confirm.User = new User() { Id = User.Identity.GetUserId() }; _managerService.ConfirmOrder(confirm); _logWriter.CreateLog("Подтвердил заказ" + confirm.Order.Id, User.Identity.GetUserId()); return(RedirectToAction("ShowConfirms", "Manager", null)); } var orderDTO = _managerService.GetOrder(confirmDM.Order.Id, true); confirmDM.Order = _rentMapperDM.ToOrderDM.Map <OrderDTO, OrderDM>(orderDTO); confirmDM.Order.Profile = _identityMapperDM.ToProfileDM.Map <ProfileDTO, ProfileDM>(orderDTO.Profile); return(View(confirmDM)); }
public ActionResult CreateProfile(ProfileDM profileDM) { if (profileDM.DateOfBirth.Date > DateTime.Now.AddYears(-18).Date || profileDM.DateOfBirth.Date < DateTime.Now.AddYears(-80).Date) { ModelState.AddModelError("DateOfBirth", "Неверная дата"); } if (profileDM.DateOfExpiry.Date < DateTime.Now.Date) { ModelState.AddModelError("DateOfExpiry", "Неверная дата"); } if (profileDM.DateOfIssue.Date > DateTime.Now.Date || profileDM.DateOfIssue.Date < DateTime.Now.AddYears(-50).Date) { ModelState.AddModelError("DateOfIssue", "Неверная дата"); } if (ModelState.IsValid) { ProfileDTO profileDTO = _identityMapperDM.ToProfileDTO.Map <ProfileDM, ProfileDTO>(profileDM); profileDTO.User = new User() { Id = User.Identity.GetUserId() }; _clientService.CreateProfile(profileDTO); _logWriter.CreateLog("Добавил паспортные данные", User.Identity.GetUserId()); return(RedirectToAction("ShowProfile")); } return(View(profileDM)); }
public JsonResult AddorEidt(MonitoringconfigViewModel model) { object retJson = new { success = 0, msg = "操作失败" }; if (model.Id > 0)//如果是修改 删除已存在的数据 { var boo = bll.DeleteByType(model.TypeId, model.TargetId, model.RelatedId); } else//如果是修改判断是否已存在 { var isextist = bll.Exists(model.TypeId, model.TargetId, model.RelatedId); if (isextist) { retJson = new { success = 1, msg = "此数据已存在" }; return(Json(retJson)); } } foreach (var op in model.WhichHourLists) { JMP.MDL.jmp_channel_filter_config mo = new JMP.MDL.jmp_channel_filter_config(); if (op.Threshold == 0) { continue; } else { mo.TypeId = model.TypeId; mo.RelatedId = model.RelatedId; mo.TargetId = model.TargetId; mo.WhichHour = op.WhichHour; mo.IntervalOfRecover = model.IntervalOfRecover; mo.Threshold = op.Threshold; mo.CreatedByUserId = UserInfo.UserId; mo.CreatedByUserName = UserInfo.UserName; mo.CreatedOn = DateTime.Now; int cg = bll.Add(mo); if (cg > 0) { Logger.CreateLog("操作监控配置", mo); retJson = new { success = 1, msg = "操作成功" }; } else { retJson = new { success = 0, msg = "操作失败" }; } } } return(Json(retJson)); }
public JsonResult AddUser(JMP.MDL.jmp_user jmpuser) { object obj = new { success = 0, msg = "添加失败!" }; JMP.BLL.jmp_user userBll = new JMP.BLL.jmp_user(); jmpuser.u_password = DESEncrypt.Encrypt(jmpuser.u_password); jmpuser.relation_person_id = UserInfo.UserId; jmpuser.relation_type = (int)Relationtype.Bp; jmpuser.u_state = 1; int RoleID = int.Parse(ConfigurationManager.AppSettings["UserRoleId"]); jmpuser.ServiceFeeRatioGradeId = _CoAgentService.FindMax(" select top 1 Id from CoServiceFeeRatioGrade where ServiceFeeRatio in(select max(ServiceFeeRatio) from CoServiceFeeRatioGrade ) "); jmpuser.u_role_id = RoleID; jmpuser.u_photof = string.IsNullOrEmpty(jmpuser.u_photof) ? "" : jmpuser.u_photof; jmpuser.u_licence = string.IsNullOrEmpty(jmpuser.u_licence) ? "" : jmpuser.u_licence; try { if (jmpuser.u_category == 0) { jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? "" : jmpuser.u_photo; } else { jmpuser.u_blicense = string.IsNullOrEmpty(jmpuser.u_blicense) ? "" : jmpuser.u_blicense; jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? " " : jmpuser.u_photo; } jmpuser.u_qq = string.IsNullOrEmpty(jmpuser.u_qq) ? "" : jmpuser.u_qq; jmpuser.u_address = string.IsNullOrEmpty(jmpuser.u_address) ? " " : jmpuser.u_address; jmpuser.u_time = DateTime.Now; bool flag = false; if (!userBll.ExistsEmail(jmpuser.u_email)) { flag = _UserService.Insert(jmpuser) > 0; } obj = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" }; //写日志 if (flag) { Logger.CreateLog("添加开发者", jmpuser); } } catch (Exception ex) { obj = new { success = 0, msg = "添加异常!" }; Logger.OperateLog("添加开发者报错", ex.ToString()); } return(Json(obj)); }
/// <summary> /// 添加修改投诉类型 /// </summary> /// <returns></returns> public JsonResult InsertOrUpdateAddType(JMP.MDL.CsComplainType mode) { object retJson = new { success = 0, msg = "操作失败" }; if (mode.Id > 0) { #region 修改 //得到一个实体对象 mo = bll.GetModel(mode.Id); //拷贝 var mocolne = mo.Clone(); mo.Name = mode.Name; mo.Description = mode.Description; if (bll.Update(mo)) { Logger.ModifyLog("修改投诉类型", mocolne, mo); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加 mode.state = 0; mode.CreatedOn = DateTime.Now; mode.CreatedByUserId = UserInfo.UserId; int num = bll.Add(mode); if (num > 0) { Logger.CreateLog("添加投诉类型", mode); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } return(Json(retJson)); }
/// <summary> /// 保存用户(添加页面) /// </summary> /// <returns></returns> public JsonResult AjaxAddUser() { object retJson = new { success = 0, msg = "操作失败" }; JMP.MDL.jmp_locuser mol_localuser = new JMP.MDL.jmp_locuser(); mol_localuser.u_loginname = Request["name"]; mol_localuser.u_pwd = JMP.TOOL.DESEncrypt.Encrypt(Request["pwd"]); mol_localuser.u_realname = Request["realName"]; mol_localuser.u_department = Request["department"]; mol_localuser.u_position = Request["position"]; mol_localuser.u_role_id = int.Parse(Request["roteId"]); mol_localuser.u_state = int.Parse(Request["state"]); mol_localuser.u_mobilenumber = Request["mobilenumber"]; mol_localuser.u_emailaddress = Request["emailaddress"]; mol_localuser.u_qq = Request["qq"]; if (bll_localuser.ExistsName(mol_localuser.u_loginname)) { retJson = new { success = 2, msg = "用户名重复,请重新填写" }; } else { int result = bll_localuser.Add(mol_localuser); if (result >= 0) { #region 添加日志 Logger.CreateLog("添加本地管理员用户", mol_localuser); #endregion retJson = new { success = 1, msg = "操作成功" }; } } return(Json(retJson)); }
public JsonResult AddUser(JMP.MDL.jmp_user jmpuser) { JMP.BLL.CoServiceFeeRatioGrade grade_bll = new JMP.BLL.CoServiceFeeRatioGrade(); //查询默认费率 JMP.MDL.CoServiceFeeRatioGrade grade_model = grade_bll.GetModelById(); object obj = new { success = 0, msg = "添加失败!" }; JMP.BLL.jmp_user userBll = new JMP.BLL.jmp_user(); jmpuser.u_password = DESEncrypt.Encrypt(jmpuser.u_password); jmpuser.u_role_id = int.Parse(ConfigurationManager.AppSettings["JSRoleID"]); try { if (jmpuser.u_category == 0) { jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? "" : jmpuser.u_photo; } else { jmpuser.u_blicense = string.IsNullOrEmpty(jmpuser.u_blicense) ? "" : jmpuser.u_blicense; jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? " " : jmpuser.u_photo; } jmpuser.u_qq = string.IsNullOrEmpty(jmpuser.u_qq) ? "" : jmpuser.u_qq; jmpuser.u_address = string.IsNullOrEmpty(jmpuser.u_address) ? " " : jmpuser.u_address; jmpuser.ServiceFeeRatioGradeId = string.IsNullOrEmpty(grade_model.Id.ToString()) ? 0 : grade_model.Id; jmpuser.u_time = DateTime.Now; bool flag = false; if (!userBll.ExistsEmail(jmpuser.u_email)) { flag = userBll.Add(jmpuser) > 0; } obj = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" }; //写日志 if (flag) { Logger.CreateLog("添加开发者", jmpuser); } } catch (Exception ex) { obj = new { success = 0, msg = "添加异常!" }; Logger.OperateLog("添加开发者报错", ex.ToString()); } return(Json(obj)); }
/// <summary> /// 添加或修改系统配置 /// </summary> /// <param name="mode"></param> /// <returns></returns> public JsonResult InsertOrUpdateSystem(JMP.MDL.jmp_system mode) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_system bll = new JMP.BLL.jmp_system(); JMP.MDL.jmp_system mo = new JMP.MDL.jmp_system(); if (mode.s_id > 0) { mo = bll.GetModel(mode.s_id); mode.s_state = mo.s_state; if (mo.s_name == "password") { //md5加密 mode.s_value = DESEncrypt.Encrypt(mode.s_value); } if (bll.Update(mode)) { #region 日志说明 Logger.ModifyLog("用户" + UserInfo.UserName + "修改系统配置", mo, mode); #endregion retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; }; } else { #region mode.s_state = 1; int cg = bll.Add(mode); if (cg > 0) { Logger.CreateLog("添加系统配置", mode); retJson = new { success = 1, msg = "操作成功" }; } else { retJson = new { success = 0, msg = "操作失败" }; } #endregion } return(Json(retJson)); }
/// <summary> /// 添加修改方法 /// </summary> /// <returns></returns> public JsonResult AddorEidt(JMP.MDL.jmp_Help_Classification model) { object retJson = new { success = 0, msg = "操作失败" }; if (model.ID <= 0) { model.State = 0; model.CreateByID = UserInfo.Uid; model.CreateByName = UserInfo.UserName; model.CreateOn = DateTime.Now; int cg = bll.Add(model); if (cg > 0) { Logger.CreateLog("添加分类", model); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } else { JMP.MDL.jmp_Help_Classification mo = new jmp_Help_Classification(); mo = bll.GetModel(model.ID); mo.ParentID = model.ParentID; mo.Sort = model.Sort; mo.ClassName = model.ClassName; mo.Description = model.Description; mo.Icon = model.Icon; mo.Type = model.Type; if (bll.Update(mo)) { Logger.ModifyLog("修改分类", mo, model); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } } return(Json(retJson)); }
public JsonResult InsertPayChannel(JMP.MDL.PayChannel mode) { object retJson = new { success = 0, msg = "操作失败" }; mode.Append = UserInfo.UserName; mode.Appendtime = DateTime.Now; int num = PayChannelBll.Add(mode); if (num > 0) { Logger.CreateLog("添加代付通道", mode); retJson = new { success = 1, msg = "操作成功" }; } return(Json(retJson)); }
public JsonResult InsertAgent(JMP.MDL.CoAgent jmpagent) { object obj = new { success = 0, msg = "添加失败!" }; jmpagent.Password = DESEncrypt.Encrypt(jmpagent.Password); jmpagent.ServiceFeeRatioGradeId = _coAgentService.FindMax(" select top 1 Id from CoServiceFeeRatioGrade where AgentPushMoneyRatio in(select max(AgentPushMoneyRatio) from CoServiceFeeRatioGrade )"); jmpagent.RoleId = int.Parse(ConfigurationManager.AppSettings["AgentRoleId"]); try { if (jmpagent.Classify == 0) { jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" : jmpagent.PersonalPhotoPath; } else { jmpagent.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" : jmpagent.BusinessLicensePhotoPath; jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " : jmpagent.PersonalPhotoPath; } jmpagent.QQ = string.IsNullOrEmpty(jmpagent.QQ) ? "" : jmpagent.QQ; jmpagent.ContactAddress = string.IsNullOrEmpty(jmpagent.ContactAddress) ? " " : jmpagent.ContactAddress; jmpagent.CreatedOn = DateTime.Now; jmpagent.CreatedById = UserInfo.UserId; jmpagent.CreatedByName = UserInfo.UserName; jmpagent.OwnerId = UserInfo.UserId; jmpagent.OwnerName = UserInfo.UserName; bool flag = false; flag = _coAgentService.Insert(jmpagent) > 0; obj = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" }; //写日志 if (flag) { Logger.CreateLog("添加代理商", jmpagent); } } catch (Exception ex) { obj = new { success = 0, msg = "添加异常!" }; Logger.OperateLog("添加代理商报错", ex.ToString()); } return(Json(obj)); }
public JsonResult InsertAgent(JMP.MDL.CoAgent jmpagent) { object obj = new { success = 0, msg = "添加失败!" }; JMP.BLL.CoAgent userBll = new JMP.BLL.CoAgent(); jmpagent.Password = DESEncrypt.Encrypt(jmpagent.Password); jmpagent.RoleId = int.Parse(ConfigurationManager.AppSettings["AgentRoleID"]); try { if (jmpagent.Classify == 0) { jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" : jmpagent.PersonalPhotoPath; } else { jmpagent.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" : jmpagent.BusinessLicensePhotoPath; jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " : jmpagent.PersonalPhotoPath; } jmpagent.QQ = string.IsNullOrEmpty(jmpagent.QQ) ? "" : jmpagent.QQ; jmpagent.ContactAddress = string.IsNullOrEmpty(jmpagent.ContactAddress) ? " " : jmpagent.ContactAddress; jmpagent.CreatedOn = DateTime.Now; jmpagent.CreatedById = UserInfo.UserId; jmpagent.CreatedByName = UserInfo.UserName; bool flag = false; flag = userBll.Add(jmpagent) > 0; obj = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" }; //写日志 if (flag) { Logger.CreateLog("添加代理商", jmpagent); } } catch (Exception ex) { obj = new { success = 0, msg = "添加异常!" }; Logger.OperateLog("添加代理商报错", ex.ToString()); } return(Json(obj)); }
/// <summary> /// 添加后台角色方法 /// </summary> /// <returns></returns> public JsonResult AddRoleAjax() { object retJson = new { success = 0, msg = "操作失败" }; m_role.r_name = Request["name"]; m_role.r_value = ""; m_role.r_state = int.Parse(Request["state"]); m_role.r_type = 0; int result = bll_role.Add(m_role); if (result > 0) { #region 添加日志 Logger.CreateLog("添加角色数据", m_role); #endregion retJson = new { success = 1, msg = "操作成功" }; } return(Json(retJson)); }
/// <summary> /// Ban user by id. /// </summary> /// <param name="id">User id</param> /// <returns>View</returns> public ActionResult BanUser(string id) { if (!String.IsNullOrEmpty(id)) { _adminService.BanUser(id); _logWriter.CreateLog("Забанил пользователя " + id, User.Identity.GetUserId()); } return(RedirectToAction("GetUsers")); }
/// <summary> /// 添加或修改公告 /// </summary> /// <returns></returns> public JsonResult insertOrUpdatenotice(JMP.MDL.jmp_notice mo) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_notice noticebll = new JMP.BLL.jmp_notice(); mo.n_time = DateTime.Now; mo.n_state = 0; mo.n_locuserid = UserInfo.UserId; if (mo.n_id > 0) { JMP.MDL.jmp_notice mod = noticebll.GetModel(mo.n_id); var modClone = mod.Clone(); mod.n_title = mo.n_title; mod.n_content = mo.n_content; mod.n_top = mo.n_top; if (noticebll.Update(mod)) { Logger.ModifyLog("修改公告", modClone, mo); retJson = new { success = 1, msg = "修改成功!" }; } else { retJson = new { success = 1, msg = "修改失败!" }; } } else { int cg = noticebll.Add(mo); if (cg > 0) { Logger.CreateLog("新增公告", mo); retJson = new { success = 1, msg = "发布成功!" }; } else { retJson = new { success = 0, msg = "发布失败!" }; } } return(Json(retJson)); }
public JsonResult InsertUpdateNewsRelease(JMP.MDL.newsrelease model) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.newsrelease bll = new JMP.BLL.newsrelease(); //string xgzfc = ""; if (model.n_id > 0) { // 修改新闻管理 JMP.MDL.newsrelease modComplaint = new JMP.MDL.newsrelease(); modComplaint = bll.GetModel(model.n_id); var modComplaintClone = modComplaint.Clone(); modComplaint.n_title = model.n_title; modComplaint.n_info = model.n_info; modComplaint.n_picture = model.n_picture; modComplaint.n_category = model.n_category; modComplaint.keywords = model.keywords; modComplaint.description = model.description; //model.n_count = modComplaint.n_count; //model.n_time = modComplaint.n_time; //model.n_user = modComplaint.n_user; if (bll.Update(modComplaint)) { Logger.ModifyLog("修改新闻信息", modComplaintClone, model); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } } else { model.n_time = DateTime.Now; model.n_user = UserInfo.UserName; model.n_count = 0; int cg = bll.Add(model); if (cg > 0) { Logger.CreateLog("添加新闻", model); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 1, msg = "添加失败" }; } } return(Json(retJson)); }
/// <summary> /// 添加权限方法 /// </summary> /// <returns></returns> public JsonResult AjaxAddLimit() { object retJson = new { success = 0, msg = "操作失败" }; m_limit.l_name = Request["name"]; m_limit.l_url = Request["url"]; m_limit.l_sort = int.Parse(Request["values"]); m_limit.l_topid = int.Parse(Request["topid"]); m_limit.l_state = int.Parse(Request["state"]); m_limit.l_icon = Request["icon"]; m_limit.l_type = 0; int result = bll_limit.Add(m_limit); if (result > 0) { #region 添加日志 //AddLocLog.AddLog(int.Parse(UserInfo.UserId), 3, RequestHelper.GetClientIp(), "操作添加权限页面,进行权限值添加", "添加权限"); Logger.CreateLog("操操作添加权限页面,进行权限值添加", m_limit); #endregion retJson = new { success = 1, msg = "操作成功" }; } return(Json(retJson)); }
public JsonResult Create(JMP.MDL.jmp_merchant model) { var json = new JsonResponseModel { success = 1, msg = "" }; var bll = new JMP.BLL.jmp_merchant(); model.m_loginname = model.m_loginname.Trim(); var exsits = bll.GetModelList(string.Format("m_loginname='{0}'", model.m_loginname)); if (exsits.Count > 0) { json.success = 0; json.msg = "登录名已存在"; return(Json(json)); } model.m_realname = model.m_realname.Trim(); model.m_pwd = DESEncrypt.Encrypt(model.m_pwd); bll.Add(model); Logger.CreateLog("信息商户信息", model); json.success = 1; json.msg = "操作成功"; return(Json(json)); }
public JsonResult Create(JMP.Model.MonitorChannel model) { object retJson = new { success = 0, msg = "操作失败" }; var bll = new MonitorChannel(); var xgzfc = ""; if (model.a_id > 0) { // 修改通道监控 var modComplaint = bll.GetModel(model.a_id); var modComplaintClone = modComplaint.Clone(); modComplaint.ChannelId = model.ChannelId; modComplaint.a_type = model.a_type; // model.a_datetime = modComplaint.a_datetime; // model.a_state = modComplaint.a_state; // model.ChannelId = modComplaint.ChannelId; modComplaint.Threshold = model.Threshold / 100; if (model.StartDay != -1 && model.EndDay != -1 && model.DayMinute != 0) { modComplaint.a_time_range += model.StartDay + "-" + model.EndDay + ":" + model.DayMinute + "_"; } if (model.StartNight != -1 && model.EndNight != -1 && model.NightMinute != 0) { modComplaint.a_time_range += model.StartNight + "-" + model.EndNight + ":" + model.NightMinute; } if (model.OtherMinte != 0) { modComplaint.a_time_range += "_100:" + model.OtherMinte; } var exitmod = bll.GetModelByTD(model.ChannelId, model.a_type); if (exitmod != null && model.a_id != exitmod.a_id) { retJson = new { success = 0, msg = "此通道监控已存在" }; return(Json(retJson)); } var monitorList = modComplaint.a_time_range.ParseAppMonitorTimeRangeTo24Hours(); AddMonitorMinuteDetails(modComplaint.ChannelId, modComplaint.a_type, monitorList); if (bll.Update(modComplaint)) { Logger.ModifyLog("修改通道监控信息", modComplaintClone, model); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } } else { model.a_datetime = DateTime.Now; model.a_state = 1; if (model.StartDay != -1 && model.EndDay != -1 && model.DayMinute != 0) { model.a_time_range += model.StartDay + "-" + model.EndDay + ":" + model.DayMinute + "_"; } if (model.StartNight != -1 && model.EndNight != -1 && model.NightMinute != 0) { model.a_time_range += model.StartNight + "-" + model.EndNight + ":" + model.NightMinute; } if (model.OtherMinte == 0) { model.a_time_range += "_100:" + 5; } else { model.a_time_range += "_100:" + model.OtherMinte; } var monitorList = model.a_time_range.ParseAppMonitorTimeRangeTo24Hours(); model.Threshold = model.Threshold / 100; var appidList = model.a_appidList.Split(','); foreach (var i in appidList) { var appId = int.Parse(i); if (appId <= 0) { continue; } var exists = bll.Exists(appId, model.a_type); if (exists) { retJson = new { success = 0, msg = "此通道监控已存在" }; continue; } model.ChannelId = appId; var cg = bll.Add(model); if (cg > 0) { AddMonitorMinuteDetails(model.ChannelId, model.a_type, monitorList); Logger.CreateLog("添加通道监控信息", model); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 1, msg = "添加失败" }; } } } return(Json(retJson)); }
public JsonResult InsertOrUpdateBusinessPersonnel(JMP.MDL.CoBusinessPersonnel mode) { object retJson = new { success = 0, msg = "操作失败" }; string loname = Request["LoginName"]; string userName = Request["DisplayName"]; if (mode.Id > 0) { #region 修改商务 //修改前数据 co_model = bll_co.GetModel(mode.Id); var modclone = co_model.Clone(); JMP.MDL.CoBusinessPersonnel co_mod = new JMP.MDL.CoBusinessPersonnel(); co_model.Password = DESEncrypt.Encrypt(mode.Password); co_model.CreatedOn = DateTime.Now; co_model.LoginName = mode.LoginName; co_model.DisplayName = mode.DisplayName; co_model.EmailAddress = mode.EmailAddress; co_model.MobilePhone = mode.MobilePhone; co_model.QQ = mode.QQ; co_model.Website = mode.Website; // mode.CreatedById = UserInfo.UserId; // mode.CreatedByName = UserInfo.UserName; // mode.LoginCount = co_model.LoginCount; // mode.State = co_model.State; // mode.LogintTime = co_model.LogintTime == null ? null : co_model.LogintTime; if (bll_co.Update(co_model)) { Logger.ModifyLog("修改商务信息", modclone, co_model); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加商务 JMP.MDL.CoBusinessPersonnel co_mod = new JMP.MDL.CoBusinessPersonnel(); mode.Password = DESEncrypt.Encrypt(mode.Password); mode.CreatedOn = DateTime.Now; mode.CreatedById = UserInfo.UserId; mode.CreatedByName = UserInfo.UserName; mode.LoginCount = 0; int roleId; int.TryParse(ConfigReader.GetSettingValueByKey("RoleID"), out roleId); mode.RoleId = roleId; mode.State = 0; int cg = bll_co.Add(mode); if (cg > 0) { Logger.CreateLog("添加商务信息", mode); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } return(Json(retJson)); }
public JsonResult InsertUpdateApp(JMP.MDL.jmp_app mod) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); if (mod.a_apptype_id == 0) { retJson = new { success = 0, msg = "请选择应用类型" }; } else { if (mod.a_id > 0) { #region 修改应用 string rzsm = ""; JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app(); modapp = bll.GetModel(mod.a_id); var modcolne = modapp.Clone(); modapp.a_name = mod.a_name; //应用名称 modapp.a_platform_id = mod.a_platform_id; //关联平台ID modapp.a_paymode_id = mod.a_paymode_id; //关联支付类型ID modapp.a_apptype_id = mod.a_apptype_id; //关联应用类型ID modapp.a_notifyurl = mod.a_notifyurl; //回掉地址 modapp.a_user_id = mod.a_user_id; //开发者ID modapp.a_showurl = mod.a_showurl; //同步地址 modapp.a_appurl = mod.a_appurl; //应用审核地址 modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介 if (bll.Update(modapp)) { Logger.ModifyLog("修改应用", modcolne, mod); retJson = new { success = mod.a_id, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加应用 mod.a_rid = 0; mod.a_auditor = ""; mod.a_state = 1; mod.a_auditstate = 0; mod.a_key = ""; mod.a_secretkey = ""; mod.a_time = DateTime.Now; int cg = _AppService.Insert(mod); // int cg = bll.Add(mod); if (cg > 0) { // Logger.CreateLog("新增应用",mod); mod.a_key = DESEncrypt.Encrypt(mod.a_user_id + ";" + cg + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); mod.a_secretkey = DESEncrypt.Encrypt(cg + ";" + mod.a_key + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); mod.a_id = cg; if (bll.Update(mod)) { Logger.CreateLog("新增应用", mod); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } } return(Json(retJson)); }
/// <summary> /// 添加或修改应用 /// </summary> /// <returns></returns> public JsonResult InsertUpdateApp(JMP.MDL.jmp_app mod) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); //string xgzfc = ""; if (string.IsNullOrEmpty(mod.a_paymode_id)) { retJson = new { success = 0, msg = "请选择支付类型" }; } else { if (mod.a_apptype_id == 0) { retJson = new { success = 0, msg = "请选择应用类型" }; } else { if (mod.a_id > 0) { #region 修改应用 JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app(); modapp = bll.GetModel(mod.a_id); //克隆对象 // object modclone = CloneObject.Clone(modapp); var modclone = modapp.Clone(); if (mod.a_apptype_id != modapp.a_apptype_id) { modapp.a_auditstate = 0; //应用审核状态(0未审核) modapp.a_rid = 0; //风险等级配置表id } modapp.a_name = mod.a_name; //应用名称 modapp.a_platform_id = mod.a_platform_id; //关联平台ID modapp.a_paymode_id = mod.a_paymode_id; //关联支付类型ID modapp.a_apptype_id = mod.a_apptype_id; //关联应用类型ID modapp.a_notifyurl = mod.a_notifyurl; //回掉地址 modapp.a_user_id = mod.a_user_id; //开发者ID modapp.a_showurl = mod.a_showurl; //同步地址 modapp.a_appurl = mod.a_appurl; //应用审核地址 modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介 if (mod.a_auditstate != 0) { if (string.IsNullOrEmpty(mod.a_auditor)) { mod.a_auditor = UserInfo.UserName; } } else { mod.a_auditor = ""; } if (bll.Update(modapp)) { Logger.ModifyLog("修改应用", modclone, modapp); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加应用 mod.a_state = 1; mod.a_auditstate = 0; mod.a_key = ""; mod.a_secretkey = ""; mod.a_time = DateTime.Now; int cg = bll.Add(mod); if (cg > 0) { Logger.CreateLog("添加应用", mod); //while (true) //{ mod.a_key = DESEncrypt.Encrypt(mod.a_user_id + ";" + cg + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); //if (!bll.Existss(mod.a_key)) //{ // break; //} //} mod.a_secretkey = DESEncrypt.Encrypt(cg + ";" + mod.a_key + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); mod.a_id = cg; if (bll.Update(mod)) { Logger.OperateLog("修改应用key", mod.a_key); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } } } return(Json(retJson)); }