コード例 #1
0
        public ActionResult Register(CardApplyVM pModel)
        {
            try
            {
                ResultM result = MemberBL.Register(pModel.TemData);

                if (result.IsSuccess)
                {
                    //return Detail(pModel.OpenID);
                    EGExceptionResult pResult = CreateCardApplyVM(pModel.OpenID, pModel);
                    if (pResult != null)
                    {
                        return(Json(pResult));
                    }

                    pModel.NewMemberInfo = "恭喜你成為我們的會員";
                    return(View("CardApply", pModel));
                }
                return(Json(result));
            }
            catch (Exception ex)
            {
                return(Json(new { IsSuccess = false, Message = ex.Message }));
            }
        }
コード例 #2
0
        public ActionResult Edit(UserVM model)
        {
            if (string.IsNullOrEmpty(model.Password) && string.IsNullOrEmpty(model.ConfirmPassword))
            {
                ModelState.Remove("Password");
                ModelState.Remove("ConfirmPassword");
            }
            if (ModelState.IsValid)
            {
                try
                {
                    ResultM result = UserBL.Edit(model.TemData, UserID);

                    if (result.IsSuccess)
                    {
                        return(RedirectToAction("List", "User"));
                    }
                    else
                    {
                        ModelState.AddModelError("ErrorMessage", result.Message);
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("ErrorMessage", ex.Message);
                }
            }
            return(View(model));
        }
コード例 #3
0
        public virtual ResultM New(T_Group model, string userID)
        {
            ResultM result = new ResultM();

            model.CreatedBy      = userID;
            model.LastModifiedBy = userID;
            result.Affected      = GroupDA.Add(model);

            return(result);
        }
コード例 #4
0
        public virtual ResultM Register(T_Member model)
        {
            ResultM result = new ResultM();

            model.ID             = DateTime.Now.Ticks.ToString();
            model.CreatedBy      = model.OpenID;
            model.LastModifiedBy = model.OpenID;
            result.Affected      = MemberDA.Add(model);
            return(result);
        }
コード例 #5
0
        public virtual ResultM Delete(string userId, string currentUserID)
        {
            ResultM result = new ResultM();
            T_User  data   = GetUser(userId);

            data.IsDeleted   = true;
            data.DeletedBy   = currentUserID;
            data.DeletedTime = DateTime.Now;
            result.Affected  = UserDA.Edit(data);
            return(result);
        }
コード例 #6
0
ファイル: MediaBL.cs プロジェクト: zero1036/TGNet
        /// <summary>
        /// 添加媒體資源
        /// </summary>
        /// <param name="OpenId"></param>
        /// <param name="Media"></param>
        /// <returns></returns>
        public virtual ResultM NewMedia(string OpenId, string MediaID, UploadMediaFileType Type)
        {
            ResultM  result = new ResultM();
            WC_Media model  = new WC_Media()
            {
                ID = MediaID, OpenID = OpenId, Type = Type.GetHashCode(), Date = DateTime.Now
            };

            result.Affected = MediaDA.Add(model);
            return(result);
        }
コード例 #7
0
ファイル: TextBL.cs プロジェクト: zero1036/TGNet
        /// <summary>
        /// 添加媒體資源
        /// </summary>
        /// <param name="OpenId"></param>
        /// <param name="Media"></param>
        /// <returns></returns>
        public virtual ResultM NewText(string OpenId, string content, float?lng = null, float?lat = null)
        {
            ResultM result = new ResultM();
            WC_Text model  = new WC_Text()
            {
                OpenID = OpenId, Date = DateTime.Now, Lat = lat, Lng = lng, Content = content
            };

            result.Affected = TextDA.Add(model);
            return(result);
        }
コード例 #8
0
        public virtual ResultM Delete(int groupID, string currentUserID)
        {
            ResultM result = new ResultM();
            T_Group data   = GetGroup(groupID);

            data.IsDeleted   = true;
            data.DeletedBy   = currentUserID;
            data.DeletedTime = DateTime.Now;
            result.Affected  = GroupDA.Edit(data);
            return(result);
        }
コード例 #9
0
        public ResultM AddInput(List <AttributeValueM> inputAttributeValue)
        {
            ResultM result = new ResultM();
//                calculator.Calculate(inputAttributeValue);
            InputLog log = new InputLog()
            {
                Values = inputAttributeValue,
                Result = result
            };

            _portDAO.SaveInputLog(log);
            return(result);
        }
コード例 #10
0
        public ActionResult DelUserGroup(int GroupID, string userUIDs)
        {
            ResultM result = new ResultM();

            try
            {
                result = UserBL.DelUserGroup(GroupID, userUIDs);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            return(Json(result));
        }
コード例 #11
0
        public virtual ResultM Cancellation(string ID, string openID)
        {
            ResultM  result = new ResultM();
            T_Member data   = MemberDA.GetByPKey(new T_Member()
            {
                ID = ID, OpenID = openID, IsDeleted = false
            });

            data.IsDeleted   = true;
            data.DeletedBy   = openID;
            data.DeletedTime = DateTime.Now;
            result.Affected  = MemberDA.Edit(data);
            return(result);
        }
コード例 #12
0
        public ActionResult SaveList(int GroupID, string Data)
        {
            ResultM result = new ResultM();

            try
            {
                result = AccessRightBL.Save(GroupID, Data);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            return(Json(result));
        }
コード例 #13
0
        public ActionResult Delete(string sessionId)
        {
            ResultM result = new ResultM();

            if (StaticLibrary.ActiveSession.ContainsKey(sessionId))
            {
                var activeUser = StaticLibrary.ActiveSession.FirstOrDefault(z => z.Key == sessionId).Value;
                activeUser.RemoveAll();
                activeUser.Abandon();
                result.Affected = 1;
            }

            return(Json(result));
        }
コード例 #14
0
        public virtual ResultM DelUserGroup(int groupID, string userIDs)
        {
            ResultM result = new ResultM();

            foreach (var item in userIDs.Split(',').Where(z => z.Length > 0))
            {
                TR_User_Group model = new TR_User_Group()
                {
                    UserID = item, GroupID = groupID
                };
                result.Affected = result.Affected + UserDA.Del(model);
            }
            return(result);
        }
コード例 #15
0
        public ActionResult GetSelectUser(int GroupID, string SelectUser)
        {
            ResultM <T_User> result = new ResultM <T_User>();

            try
            {
                result.EntityList = UserBL.GetSelectUser(GroupID, SelectUser);
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;
            }
            return(Json(result));
        }
コード例 #16
0
        public virtual ResultM Edit(T_Group model, string userID)
        {
            ResultM result = new ResultM();

            T_Group data = GetGroup(model.GroupID);

            data.GroupName        = model.GroupName;
            data.Description      = model.Description;
            data.State            = model.State;
            data.LastModifiedBy   = userID;
            data.LastModifiedTime = DateTime.Now;

            result.Affected = GroupDA.Edit(data);

            return(result);
        }
コード例 #17
0
        public virtual ResultM New(T_User model, string userID)
        {
            ResultM result = new ResultM();

            T_User data = GetUser(model.UserID);

            if (data != null)
            {
                result.Message = "Existing UserID!";
            }
            else
            {
                model.CreatedBy      = userID;
                model.LastModifiedBy = userID;
                model.Password       = GetSHA512Encrypt(model.Password);
                result.Affected      = UserDA.Add(model);
            }
            return(result);
        }
コード例 #18
0
        public virtual ResultM Edit(T_User model, string userID)
        {
            ResultM result = new ResultM();

            T_User data = GetUser(model.UserID);

            data.UserName         = model.UserName;
            data.State            = model.State;
            data.LastModifiedBy   = userID;
            data.LastModifiedTime = DateTime.Now;

            if (!string.IsNullOrEmpty(model.Password))
            {
                data.Password = GetSHA512Encrypt(model.Password);
            }

            result.Affected = UserDA.Edit(data);

            return(result);
        }
コード例 #19
0
        public ActionResult Cancellation(string ID, string openID)
        {
            try
            {
                ResultM result = MemberBL.Cancellation(ID, openID);

                if (result.IsSuccess)
                {
                    return(View("Register", new MemberVM()
                    {
                        OpenID = openID
                    }));
                }
                return(Json(result));
            }
            catch (Exception ex)
            {
                return(Json(new { IsSuccess = false, Message = ex.Message }));
            }
        }
コード例 #20
0
        public ActionResult UnValidation(AccountVM model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ResultM result = AccountBL.DelAccount(model.TemData);

                    if (result.IsSuccess)
                    {
                        EG.WeChat.Service.WeiXin.WeixinMessageSender.SendText(model.OpenID, "戶口解綁 成功!\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    }
                    return(Json(result));
                }
                catch (Exception ex)
                {
                    return(Json(new { IsSuccess = false, Message = ex.Message }));
                }
            }
            return(View(model));
        }
コード例 #21
0
        public ActionResult Validation(AccountVM model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ResultM result = AccountBL.SaveAccount(model.TemData);

                    if (result.IsSuccess)
                    {
                        EG.WeChat.Service.WeiXin.WeixinMessageSender.SendText(model.OpenID, String.Format("戶口綁定 成功!\r\n關聯的交易帳號為:{0}。\r\n{1}", model.AccountNumber, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                    }
                    return(Json(result));
                }
                catch (Exception ex)
                {
                    return(Json(new { IsSuccess = false, Message = ex.Message }));
                }
            }
            return(View(model));
        }
コード例 #22
0
        public virtual ResultM Save(int GroupID, string Data)
        {
            ResultM result = new ResultM();

            //删除全部
            int r = AccessRightDA.Del(GroupID);

            //添加
            foreach (var item in Data.Split(';').Where(z => z.Length > 0))
            {
                var info = item.Split(':');
                foreach (var a in info[1].Split(',').Where(z => z.Length > 0))
                {
                    TR_Group_Right model = new TR_Group_Right()
                    {
                        GroupID = GroupID, Controller = info[0], Action = a
                    };
                    result.Affected += AccessRightDA.Add(model);
                }
            }

            return(result);
        }
コード例 #23
0
        public ActionResult New(UserVM model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ResultM result = UserBL.New(model.TemData, UserID);

                    if (result.IsSuccess)
                    {
                        return(RedirectToAction("List", "User"));
                    }
                    else
                    {
                        ModelState.AddModelError("ErrorMessage", result.Message);
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("ErrorMessage", ex.Message);
                }
            }
            return(View(model));
        }
コード例 #24
0
ファイル: GroupController.cs プロジェクト: zero1036/TGNet
        public ActionResult Delete(int GroupID)
        {
            ResultM result = GroupBL.Delete(GroupID, UserID);

            return(Json(result));
        }
コード例 #25
0
ファイル: MediaBL.cs プロジェクト: zero1036/TGNet
        /*      媒體資源下載和管理        */

        /// <summary>
        /// 保存多媒体资源
        /// </summary>
        /// <param name="openId">用户的OpenId</param>
        /// <param name="MediaId">媒体的MediaId</param>
        /// <param name="localId">成为本地资源之后的本地Id</param>
        /// <param name="type">多媒体的类型</param>
        /// <returns></returns>
        public virtual ResultM SaveMediaResource(string openId, string MediaId, UploadMediaFileType Type)
        {
            //结果容器
            ResultM result  = new ResultM();
            int     localId = -1;

            //通过“本地资源”模块,下载资源并获得LocalId
            switch (Type)
            {
            default:
                throw new Exception("目前不支持此类型。" + Type.ToString());

            case UploadMediaFileType.thumb:
            case UploadMediaFileType.image:
            {
                WeChatPictureService service = new WeChatPictureService("QY");
                localId = service.DownLoadResources(MediaId);
                EGExceptionResult pResult = service.GetActionResult();
                if (pResult != null)
                {
                    result.Message = pResult.Message;
                }
            }
            break;

            //case UploadMediaFileType.video:     //视频类型,微信文档写着不支持下载
            //break;

            case UploadMediaFileType.voice:
            {
                WeChatVoiceService service = new WeChatVoiceService("QY");
                localId = service.DownLoadResources(MediaId);
                EGExceptionResult pResult = service.GetActionResult();
                if (pResult != null)
                {
                    result.Message = pResult.Message;
                }
            }
            break;
            }

            //记录到数据库
            if (localId >= 0)
            {
                var affectedRows =
                    MediaDA.SaveMediaResource(new WCR_Media_Resource
                {
                    OpenId      = openId,
                    ID          = MediaId,
                    LocalID     = localId,
                    Type        = (int)Type,
                    Date        = DateTime.Now.Date,
                    CreatedTime = DateTime.Now,
                });

                result.Affected = affectedRows;
            }

            //返回结果
            return(result);
        }
コード例 #26
0
        public ActionResult Delete(string userID)
        {
            ResultM result = UserBL.Delete(userID, UserID);

            return(Json(result));
        }