Ejemplo n.º 1
0
        /// <summary>
        /// 保存部门信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMdmDeptInfo(MdmDeptMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new MdmDeptMstr();
            var isOk   = CheckMdmDeptInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (dto.Id == 0)
            {
                dto.ORG_NO = AbpSession.ORG_NO;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _mdmDeptMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _mdmDeptMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
Ejemplo n.º 2
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            Model.News news = new Model.News()
            {
                News_Title   = this.txtName.Text,
                News_Content = this.txtNewsContent.Value,
                News_Image   = upFileName(FileUpload1, "../../upload/news/")
            };

            var       res = newsSvc.Add(news);
            ReturnMsg rs  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.Ok,
                Message = "添加新闻成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "添加新闻失败",
                Data    = null
            };

            Session["Msg"] = rs;
            Response.Redirect("News_List.aspx");
        }
Ejemplo n.º 3
0
        public ReturnMsg Translate(TransRequestData model)
        {
            ReturnMsg data = new ReturnMsg();
            string    url  = $"{API_URL}?q={model.q}&from={model.from}&to={model.to}&appid={model.appid}&salt={model.salt}&sign={model.sign}";

            if (webClient == null)
            {
                webClient = new WebClient();
            }
            string responseStr = string.Empty;

            try
            {
                responseStr = webClient.DownloadString(url);
                var responseData = JsonConvert.DeserializeObject <TransResponseData>(responseStr);
                data.Code = responseData.error_code;
                data.Msg  = responseData.trans_result?[0].dst;
            }
            catch (Exception ex)
            {
                data.Msg = $"错误信息:{ex.Message},API报文:{responseStr}";
            }

            return(data);
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> GetUserList(int page, int limit, string userName, string userPhone, string userEmail)
        {
            var list = await _manager.GetAllUser();

            if (!string.IsNullOrEmpty(userName))
            {
                list = list.Where(m => m.Name.Contains(userName)).ToList();
            }
            if (!string.IsNullOrEmpty(userPhone))
            {
                list = list.Where(m => m.Phone.Contains(userPhone)).ToList();
            }
            if (!string.IsNullOrEmpty(userEmail))
            {
                list = list.Where(m => m.Mail.Contains(userEmail)).ToList();
            }
            var count = list.Count();
            var data  = list.Select(m => new
            {
                m.LoginId,
                m.Address,
                m.Mail,
                m.Name,
                m.Phone,
                userStateName = m.UserStateId
            }).ToList().Skip((page - 1) * limit).Take(limit);
            ReturnMsg result = new ReturnMsg()
            {
                Data      = data,
                IsSuccess = true,
                Info      = count.ToString()
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            object ob = Session["LoginOk"];

            if (ob == null)
            {
                Response.Write("<script>alert('账号过期,请重新登入');location.href='../Login.aspx'</script>");
            }

            var id = Request.Params["action"];

            if (id != null)
            {
                Guid      rid = Guid.Parse(id);
                var       res = IntroSvc.PutTrash(rid);
                ReturnMsg rm  = res > 0 ? new ReturnMsg()
                {
                    Code    = StatusCode.OK,
                    Message = "删除用户信息成功",
                    Data    = null
                }
                    : new ReturnMsg()
                {
                    Code    = StatusCode.Error,
                    Message = "删除用户信息失败",
                    Data    = null
                };
                Session["Msg"] = rm;
                Response.Redirect("Intro_List.aspx");
            }
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> Add(UserListViewModel user)
        {
            var result = await _manager.InsertUser(new Users()
            {
                LoginId      = user.LoginId,
                LoginPwd     = user.LoginPwd,
                Name         = user.Name,
                Address      = user.Address,
                Phone        = user.Phone,
                Mail         = user.Mail,
                Birthday     = user.Birthday,
                UserRoleId   = 1,
                UserStateId  = 1,
                RegisterTime = DateTime.Now
            });

            ReturnMsg msg = new ReturnMsg();

            if (result == 1)
            {
                msg.IsSuccess = true;
                msg.Info      = "添加成功";
            }

            return(Json(msg));
        }
Ejemplo n.º 7
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            Model.Users u = new Model.Users
            {
                Users_Account  = this.txtEmail.Text,
                Users_Password = this.txtPassword.Text,
                Users_NickName = this.txtNickName.Text,
                Users_Photo    = upFileName(this.FileUpload1, "../../upload/users/"),
                Users_RolesId  = Guid.Parse(this.ddlRolesId.SelectedValue)
            };
            var       res = usersSvc.Add(u);
            ReturnMsg rm  = res > 0
               ? new ReturnMsg()
            {
                Code    = StatusCode.Ok,
                Message = "新增用户信息成功",
                Data    = null
            }
               : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Users_List.aspx");
        }
Ejemplo n.º 8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Culture u = new Model.Culture
            {
                Culture_Intro    = this.txtIntro.Text.Trim(),
                Culture_Title1   = this.txtTitle1.Text,
                Culture_content1 = this.txtcontent1.Text,
                Culture_Title2   = this.txtTitle2.Text,
                Culture_content2 = this.txtcontent2.Text,
                Culture_Title3   = this.txtTitle3.Text,
                Culture_content3 = this.txtcontent3.Text,
                Culture_Title4   = this.txtTitle4.Text,
                Culture_content4 = this.txtcontent4.Text,
                Culture_Title5   = this.txtTitle5.Text,
                Culture_content5 = this.txtcontent5.Text,
            };
            var       res = CultureSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Culture_List.aspx");
        }
Ejemplo n.º 9
0
        public void Bind()
        {
            var id = Request.Params["action"] == null?Guid.NewGuid() : Guid.Parse(Request.Params["action"]);

            var data = productSvc.GetProductById(id);

            if (data == null)
            {
                ReturnMsg rm = new ReturnMsg()
                {
                    Code    = StatusCode.Error,
                    Message = "数据丢失,请稍后再试",
                    Data    = null
                };
                Session["msg"] = rm;
                Response.Redirect("Users_List.aspx");
            }

            this.hfId.Value      = data.Product_Id.ToString();
            this.txtName.Text    = data.Product_Title;
            this.textIntro.Text  = data.Product_Intro;
            this.txtContent.Text = data.Product_Content;
            this.txtPrice.Text   = data.Product_Price.ToString();
            imgUrl = data.Product_Image;
        }
Ejemplo n.º 10
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Map u = new Model.Map
            {
                Map_Site  = this.txtSite.Text.Trim(),
                Map_Phone = this.txtPhone.Text.Trim()
            };
            var       res = MapSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Map_List.aspx");
        }
Ejemplo n.º 11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Product u = new Model.Product
            {
                Product_Title   = this.txtName.Text,
                Product_Image   = upFileName(this.FileUpload1, "../../upload/Product/"),
                Product_Intro   = this.textIntro.Text,
                Product_Content = this.txtContent.Text,
                Product_Price   = int.Parse(this.txtPrice.Text)
            };
            var       res = productSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Product_List.aspx");
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取app菜单
        /// </summary>
        /// <param name="rm"></param>
        /// <returns></returns>
        public ReturnMsg GetAppInfoList(ReturnMsg rm)
        {
            var appList     = new List <WctAppInfoModel>();
            var appItemList = new List <WctAppItemModel>();

            appList = _wctAppMstrRepository.GetAppMstrList();
            if (appList.Count == 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "app菜单异常,请检查";
                return(rm);
            }
            appItemList = _wctAppItemRepository.GetAppItemList();
            foreach (var item in appList)
            {
                if (item.moduleType == "1")
                {
                    item.itemList = appItemList.Where(c => c.appId == item.key).ToList();
                }
            }
            rm.IsSuccess = true;
            rm.result    = JsonConvert.SerializeObject(appList);

            return(rm);
        }
Ejemplo n.º 13
0
        private bool SaveSettings()
        {
            ReturnMsg<string> msg = new ReturnMsg<string>() { result = false };
            try
            {
               if (tabitem1.IsSelected)
                {

                    if ((bool)NoNetProxyRB.IsChecked)
                    {
                        SettingConfig.NetProxyType = NetProxyType.NoProxy;
                    }
                    else if ((bool)WebBrowserSettingProxyRB.IsChecked)
                    {
                        SettingConfig.NetProxyType = NetProxyType.WebBrowserSettingProxy;
                    }
                    SettingConfig.SaveProxySettings();
                    msg.result = true;
                    msg.@object = "保存成功";
                }
            }
            catch (Exception e)
            {
                msg.@object = e.Message;
            }
            MsgLevel level = msg.result ? MsgLevel.Successful : MsgLevel.Mistake;
            new MsgBox(level, msg.@object).ShowDialog();
            return msg.result;
        }
Ejemplo n.º 14
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Contact u = new Model.Contact
            {
                Contact_Title1 = this.txtTitle1.Text.Trim(),
                Contact_Phone  = this.txtPhone.Text.Trim(),
                Contact_Fax    = this.txtFax.Text.Trim(),
                Contact_Email  = this.txtEmail.Text.Trim(),
                Contact_Title2 = this.txtTitle2.Text.Trim(),
                Contact_Site   = this.txtSite.Text.Trim(),
                Contact_Image1 = upFileName(this.FileUpload1, "../../upload/Contact/"),
                Contact_Image2 = upFileName(this.FileUpload2, "../../upload/Contact/"),
                Contact_Image3 = upFileName(this.FileUpload3, "../../upload/Contact/")
            };
            var       res = ContactSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Contact_List.aspx");
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 导出到服务器
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportExcelToServer()
        {
            MemoryStream ms = new MemoryStream();
            ReturnMsg    rm = ZZTOA_BLL.ExportExcel_BLL.ExportMs(ref ms, 1, "D:/人员信息.xls");

            return(Json(new { code = rm.code, msg = rm.msg }));
        }
Ejemplo n.º 16
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Team u = new Model.Team
            {
                Team_Title   = this.txtTitle.Text.Trim(),
                Team_Image   = upFileName(this.FileUpload1, "../../upload/Team/"),
                Team_Content = this.txtContent.Text,
            };
            var       res = TeamSvc.Add(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Team_List.aspx");
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <returns></returns>
        public FileResult ExportExcelToClient()
        {
            //导出到客户端
            MemoryStream ms = new MemoryStream();
            ReturnMsg    rm = ZZTOA_BLL.ExportExcel_BLL.ExportMs(ref ms, 0, "");

            return(File(ms, "application/vnd.ms-excel", "人员信息.xls"));
        }
Ejemplo n.º 18
0
    // 回傳結果使用,輸入狀態與訊息
    public string getStageJson(bool stage, string msg)
    {
        ReturnMsg reMsg = new ReturnMsg();

        reMsg.stage   = stage;
        reMsg.message = msg;
        return(JsonConvert.SerializeObject(reMsg));
    }
Ejemplo n.º 19
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            ReturnMsg msg = null;
            if (this.hfExamineId.Value == "")
            {
                //新增
                var model = new Examine
                {
                    Examine_OrderId = Guid.Parse(this.hfOrderId.Value),
                    Examine_Result = this.ddlResult.SelectedValue,
                    Examine_Reason = this.txtExamineContent.Value
                };

                var res = examineSvc.Add(model);
                msg = res > 0 ? new ReturnMsg()
                {
                    Code = StatusCode.Ok,
                    Message = "编辑审核信息成功",
                    Data = null
                } : new ReturnMsg()
                {
                    Code = StatusCode.Ok,
                    Message = "编辑审核信息失败",
                    Data = null
                };
            }
            else
            {
                //执行修改

                var model = new Examine
                {
                    Examine_Id = Guid.Parse(this.hfExamineId.Value),
                    Examine_OrderId = Guid.Parse(this.hfOrderId.Value),
                    Examine_Result = this.ddlResult.SelectedValue,
                    Examine_Reason = this.txtExamineContent.Value,
                };

                var res = examineSvc.Edit(model);
                msg = res > 0 ? new ReturnMsg()
                {
                    Code = StatusCode.Ok,
                    Message = "编辑审核信息成功",
                    Data = null
                } : new ReturnMsg()
                {
                    Code = StatusCode.Ok,
                    Message = "编辑审核信息失败",
                    Data = null
                };
            }
            Session["Msg"] = msg;

            orderSvc.ContactOrder(Guid.Parse(this.hfOrderId.Value));

            Response.Redirect("Order_List.aspx");
        }
Ejemplo n.º 20
0
        public ReturnMsg AddOrUpdateAppMstrInfo(WctAppMstrDto dto, ReturnMsg rm)
        {
            var entity = new WctAppMstr();
            var isAdd  = string.IsNullOrEmpty(dto.Id) ? true : false;

            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id      = Guid.NewGuid().ToString("N");
                dto.APP_KEY = "primary";
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Insert(entity);
                    unitOfWork.Complete();
                }
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Update(entity);
                    unitOfWork.Complete();
                }
            }
            if (dto.WCT_MODULE_TYPE == "1")
            {
                var appItem = new WctAppItem();
                if (!isAdd)
                {
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        _wctAppItemRepository.DelAppItemInfo(dto.Id);
                        unitOfWork.Complete();
                    }
                }
                var i = 1;
                foreach (var item in dto.appItemList)
                {
                    item.Id        = Guid.NewGuid().ToString("N");
                    item.ITEM_SORT = i;
                    _initHelper.InitAdd(item, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        appItem = item.ToEntity();
                        _wctAppItemRepository.Insert(appItem);
                        unitOfWork.Complete();
                    }
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
Ejemplo n.º 21
0
        protected ReturnMsg <T> ApiReturn <T>(T data, bool success = true, string msg = "")
        {
            var returnMsg = new ReturnMsg <T>();

            returnMsg.Code    = (int)ResponseCode.Success;
            returnMsg.Data    = data;
            returnMsg.Success = success;
            returnMsg.Message = msg;
            return(returnMsg);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 标记消息为已处理
 /// </summary>
 /// <param name="guid"></param>
 public void TagProcessed(string guid)
 {
     string    Url        = "vendor-svc/vendor/handleMsg";
     string    returnjson = Requests(Url, guid, "");
     ReturnMsg dbMsg      = JsonConvert.DeserializeObject <ReturnMsg>(returnjson);
     string    code       = dbMsg.code;
     string    message    = dbMsg.message;
     string    Success    = dbMsg.Success;
     string    data       = dbMsg.data;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// 保存角色信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveSysRoleInfo(SysRoleMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new SysRoleMstr();

            if (string.IsNullOrEmpty(dto.ROLE_NAME))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入角色名称";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.ROLE_SCOPE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择角色范围";
                return(rm);
            }
            if (dto.Id == 0)
            {
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _sysRoleMstrRepository.InsertAndGetId(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _sysRoleMstrRepository.Update(entity);
            }
            if (!string.IsNullOrEmpty(dto.menuIds))
            {
                if (dto.Id != 0)
                {
                    _sysRoleMenuPermissionRepository.DelSysRoleMenuInfo(dto.Id.ToString());
                }
                var list     = dto.menuIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                var menuList = _sysNavTreeRepository.GetAllList(c => c.DEL_FLAG == 1).Where(c => list.Contains(c.NAV_PARENT_NO) || list.Contains(c.Id)).ToList();

                foreach (var item in menuList)
                {
                    var model = new SysRoleMenuPermission
                    {
                        ROLE_ID    = (int)entity.Id,
                        PERMISSION = item.Id,
                        DEL_FLAG   = 1
                    };
                    _sysRoleMenuPermissionRepository.Insert(model);
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
Ejemplo n.º 24
0
        public ReturnMsg SendBPInfo(JObject json)
        {
            ReturnMsg msg = new ReturnMsg
            {
                STATUS   = "",
                CARDID   = "",
                USERNAME = "",
                MESSAGE  = ""
            };

            try
            {
                MySqlConnection conn          = new MySqlConnection(connStr);
                MySqlCommand    command       = conn.CreateCommand();
                BLOODPRESSURE   BLOODPRESSURE = new BLOODPRESSURE
                {
                    CARDID = json["CARDID"].ToString(),
                    DBP    = json["DBP"].ToString(),
                    SBP    = json["SBP"].ToString(),
                    HB     = json["HB"].ToString(),
                    PU     = "0"
                             //PU = json["PU"].ToString()
                };
                msg.CARDID = BLOODPRESSURE.CARDID;
                conn.Open();
                command.CommandText = "select * from cardlist C left join userinfo U on C.USERID=U.USERID WHERE CARDID='" + BLOODPRESSURE.CARDID + "'";
                DataTable        DT  = new DataTable();
                DataTable        DTb = new DataTable();
                MySqlDataAdapter MDA = new MySqlDataAdapter(command.CommandText, conn);
                MDA.Fill(DT);
                if (DT != null && DT.Rows.Count > 0 && DT.Rows[0]["USERID"].ToString() != "")
                {
                    msg.USERNAME        = DT.Rows[0]["USERNAME"].ToString() == "" ? "使用者" : DT.Rows[0]["USERNAME"].ToString();
                    command.CommandText = "INSERT INTO BLOODPRESSURE(USERID,DBP,SBP,HB,PU,CDATE) values('" + DT.Rows[0]["USERID"].ToString() + "'," + BLOODPRESSURE.DBP + "," + BLOODPRESSURE.SBP + "," + BLOODPRESSURE.HB + "," + BLOODPRESSURE.PU + ",NOW())";
                    msg.MESSAGE         = "INSERT SUCCESSFUL";
                    command.ExecuteNonQuery();
                }
                else
                {
                    command.CommandText = "INSERT INTO BLOODPRESSURE(USERID,DBP,SBP,HB,PU,CDATE) values('" + BLOODPRESSURE.CARDID + "'," + BLOODPRESSURE.DBP + "," + BLOODPRESSURE.SBP + "," + BLOODPRESSURE.HB + "," + BLOODPRESSURE.PU + ",NOW())";
                    msg.MESSAGE         = "INSERT SUCCESSFUL";
                    command.ExecuteNonQuery();
                }
                conn.Close();
                msg.STATUS = "200";
            }
            catch (Exception EX)
            {
                msg.STATUS  = "500";
                msg.MESSAGE = EX.Message;
            }
            return(msg);
        }
Ejemplo n.º 25
0
        public BaseController()
        {
            result = new ReturnMsg();



            funList = new List <FunModel>
            {
                new FunModel(1, "拼团商品", ""),
                new FunModel(2, "入驻申请", "")
            };
        }
Ejemplo n.º 26
0
        public IHttpActionResult ForgotPassword(ForgotPasswordViewModel model)
        {
            ReturnMsg obj = new ReturnMsg();

            try
            {
                if (!ModelState.IsValid)
                {
                    string message = string.Join("", ErrorHelper.GetErrorListFromModelState(ModelState));
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)));
                }
                bool isValidEmail = ValidateEmail(model.Email);
                if (!isValidEmail)
                {
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Please give a valid email.")));
                }
                var userDetails = _userService.GetUserDetailsByEmail(model.Email);
                if (userDetails != null)
                {
                    string password = "";
                    string salt     = "";
                    string ranPass  = "";
                    PasswordAndTrevoHelper.GetRandomPassword(ref password, ref salt, ref ranPass);
                    userDetails.Password     = salt;
                    userDetails.PasswordHash = password;
                    _userService.UpdateUserDetails(userDetails);


                    string       SiteURL  = ConfigurationManager.AppSettings["SiteURL"].ToString();
                    string       InfoMail = ConfigurationManager.AppSettings["InfoMail"].ToString();
                    StreamReader reader   = new StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/EmailTemplate/ForgotPasswordReset.html"));
                    string       readFile = reader.ReadToEnd();
                    string       mailBody = "";
                    mailBody = readFile;
                    TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
                    mailBody = mailBody.Replace("$$UserName$$", myTI.ToTitleCase(userDetails.Name));
                    mailBody = mailBody.Replace("$$Password$$", ranPass);
                    ReturnMsg mailResult = SendMail.SendEmail(InfoMail, userDetails.Email_Id, "Password Reset", mailBody);
                }
                else
                {
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "User not found.")));
                }
            }
            catch (Exception e)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message)));
            }


            return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.OK, "Your password has been sent into your mailbox.")));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 获取角色权限分页列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagerList <dynamic> GetRolePageList(SysRoleMstrQuery query)
        {
            var rm   = new ReturnMsg();
            var auth = _sysUsrAuthRepository.FirstOrDefault(c => c.USR_ID == AbpSession.USR_ID && c.DEL_FLAG == 1);

            if (auth != null)
            {
                query.sql = " or role.ROLE_ID=" + auth.ROLE_ID + "";
            }
            var roleList = _sysRoleMstrRepository.GetRolePageList(query);

            return(roleList);
        }
Ejemplo n.º 28
0
        public async Task <ActionResult> DeleteBook(string id)
        {
            ReturnMsg msg    = new ReturnMsg();
            var       result = await _manager.DeleteBook(id);

            if (result == 1)
            {
                msg.IsSuccess = true;
                msg.Info      = "删除成功";
            }

            return(Json(msg));
        }
Ejemplo n.º 29
0
        public FileResult ExportExcelToClient(IFormCollection fc)
        {
            MemoryStream ms = new MemoryStream();
            //DbSet<>
            //string date = "2018-04-29";
            string         tablename    = fc["tablename"];
            string         date         = fc["time"];
            List <BaseAll> list         = (List <BaseAll>) new BaseAll_BLL().GetDataByDate(tablename, date);
            ReturnMsg      rm           = ExportExcel_BLL.ExportMs(ref ms, list, 0, "");
            string         downloadname = date + ".xls";

            return(File(ms, "application/vnd.ms-excel", downloadname));
        }
Ejemplo n.º 30
0
        public ReturnMsg SendBIInfo(JObject json)
        {
            ReturnMsg msg = new ReturnMsg
            {
                STATUS   = "",
                CARDID   = "",
                USERNAME = "",
                MESSAGE  = ""
            };

            try
            {
                MySqlConnection conn      = new MySqlConnection(connStr);
                MySqlCommand    command   = conn.CreateCommand();
                BASICINFO       BASICINFO = new BASICINFO
                {
                    CARDID = json["CARDID"].ToString(),
                    HEIGHT = json["HEIGHT"].ToString(),
                    WEIGHT = json["WEIGHT"].ToString(),
                    BMI    = json["BMI"].ToString()
                };
                msg.CARDID = BASICINFO.CARDID;
                conn.Open();
                command.CommandText = "select * from cardlist C left join userinfo U on C.USERID=U.USERID WHERE CARDID='" + BASICINFO.CARDID + "'";
                DataTable        DT  = new DataTable();
                DataTable        DTb = new DataTable();
                MySqlDataAdapter MDA = new MySqlDataAdapter(command.CommandText, conn);
                MDA.Fill(DT);
                if (DT != null && DT.Rows.Count > 0 && DT.Rows[0]["USERID"].ToString() != "")
                {
                    msg.USERNAME        = DT.Rows[0]["USERNAME"].ToString() == "" ? "使用者" : DT.Rows[0]["USERNAME"].ToString();
                    command.CommandText = "INSERT INTO BASICINFO(USERID,HEIGHT,WEIGHT,BMI,CDATE) values('" + DT.Rows[0]["USERID"].ToString() + "'," + BASICINFO.HEIGHT + "," + BASICINFO.WEIGHT + "," + BASICINFO.BMI + ",NOW())";
                    msg.MESSAGE         = "INSERT SUCCESSFUL";
                    command.ExecuteNonQuery();
                }
                else
                {
                    command.CommandText = "INSERT INTO BASICINFO(USERID,HEIGHT,WEIGHT,BMI,CDATE) values('" + BASICINFO.CARDID + "'," + BASICINFO.HEIGHT + "," + BASICINFO.WEIGHT + "," + BASICINFO.BMI + ",NOW())";
                    msg.MESSAGE         = "INSERT SUCCESSFUL";
                    command.ExecuteNonQuery();
                }
                conn.Close();
                msg.STATUS = "200";
            }
            catch (Exception EX)
            {
                msg.STATUS  = "500";
                msg.MESSAGE = EX.Message;
            }
            return(msg);
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 更改粉丝黑名单状态
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ReturnMsg UpdateFansBlackStatus(SysUsrWctQuery query)
        {
            var rm = new ReturnMsg();

            if (string.IsNullOrEmpty(query.WCT_ID))
            {
                rm.IsSuccess = false;
                rm.msg       = "请先选择粉丝";
                return(rm);
            }
            var wct = _sysUsrWctRepository.FirstOrDefault(c => c.Id == query.WCT_ID && c.DEL_FLAG == 1);

            if (wct == null)
            {
                rm.IsSuccess = false;
                rm.msg       = "该粉丝不存在";
                return(rm);
            }
            var paInfo = _wxHelper.GetPaInfo(1, c => c.PA_ID_NO == AbpSession.ORG_NO, AbpSession.BG_NO);

            if (paInfo == null)
            {
                rm.IsSuccess = false;
                rm.msg       = "公众号信息不存在";
                return(rm);
            }
            var requestToken = _wxHelper.GetAccessToken(paInfo, wct.BG_NO);

            if (!requestToken.IsSuccess)
            {
                return(rm);
            }
            if (query.IsBlack)
            {
                rm = BlackFans(wct.OPEN_ID, requestToken.result, rm);
            }
            else
            {
                rm = UnBlackFans(wct.OPEN_ID, requestToken.result, rm);
            }
            if (!rm.IsSuccess)
            {
                return(rm);
            }
            _initHelper.InitUpdate(wct, AbpSession.USR_ID);
            wct.UDF4 = query.IsBlack.ToString();
            _sysUsrWctRepository.Update(wct);
            rm.IsSuccess = true;

            return(rm);
        }
Ejemplo n.º 32
0
 public ReturnMsg<string> Print(RecordSet data, ReportGenConfig printerConfig)
 {
     ReturnMsg<string> msg = new ReturnMsg<string>() { result = false };
     try
     {
         IReportGen gen = new TecITGener();
         gen.Print(data, printerConfig);
         msg.result = true;
         msg.content = "打印成功";
         msg.level = MsgLevel.Successful;
     }
     catch (Exception e) {
         msg.content = e.Message;
         msg.level = MsgLevel.Mistake;
     }
     return msg;
 }
Ejemplo n.º 33
0
        private bool SaveSettings()
        {
            ReturnMsg<string> msg = new ReturnMsg<string>() { result = false };
            try
            {
                if (tabitem1.IsSelected)
                {

                    int copy = SettingConfig.Copy;
                    if (int.TryParse(number_page.Text, out copy) && copy > 0)
                    {
                        SettingConfig.PrinterName = fax_combo.SelectedItem.ToString();
                        SettingConfig.Copy = copy;
                        SettingConfig.PrinterType = (PrinterType)int.Parse((faxtype_combo.SelectedItem as ComboBoxItem).Tag.ToString());
                        SettingConfig.SavePrinterSettings();
                        msg.result = true;
                        msg.@object = "保存成功";
                    }
                    else
                    {
                        msg.result = false;
                        msg.@object = "打印张数不合法!";
                    }
                }
                else if (tabitem2.IsSelected)
                {

                    if ((bool)NoNetProxyRB.IsChecked)
                    {
                        SettingConfig.NetProxyType = NetProxyType.NoProxy;
                    }
                    else if ((bool)WebBrowserSettingProxyRB.IsChecked)
                    {
                        SettingConfig.NetProxyType = NetProxyType.WebBrowserSettingProxy;
                    }
                    SettingConfig.SaveProxySettings();
                    msg.result = true;
                    msg.@object = "保存成功";
                }
            }
            catch (Exception e)
            {
                msg.@object = e.Message;
            }
            MsgLevel level = msg.result ? MsgLevel.Successful : MsgLevel.Mistake;
            new MsgBox(level, msg.@object).ShowDialog();
            return msg.result;
        }
Ejemplo n.º 34
0
 public static ReturnMsg<string> CopyTemplate(string sourceFileName)
 {
     ReturnMsg<string> msg = new ReturnMsg<string>() { result = false };
     if (File.Exists(sourceFileName))
     {
         string templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SettingConfig.TemplatePath);
         if (!Directory.Exists(templatePath))
         {
             Directory.CreateDirectory(templatePath);
         }
         string destFileName = Path.Combine(templatePath, Path.GetFileName(sourceFileName));
         File.Copy(sourceFileName, destFileName, true);
         msg.result = true;
         msg.@object = "成功导入模版";
     }
     else {
         msg.@object = "源文件不存在,请核实";
     }
     return msg;
 }