예제 #1
0
        public UserInfoPage(RespUserInfo info)
        {
            InitializeComponent();

            m_viewModel    = new ViewModel(info);
            BindingContext = m_viewModel;
        }
        private async void BtnShow_Clicked(object sender, EventArgs e)
        {
            RespUserInfo result = null;
            await App.RunLongTask(() =>
            {
                result = App.instance.core.user.ShowUserInfo(m_viewModel.reported);
            });

            if (result != null)
            {
                await Navigation.PushAsync(new UserInfoPage(result));
            }
        }
예제 #3
0
            public RespUserInfo SendShowUserInfo(string userID)
            {
                RespUserInfo result = null;

                m_userPP.DoRequest <ReqUserInfo, RespUserInfo>("ReqUserInfo",
                                                               (send) =>
                {
                    send.SetParameter(new ReqUserInfo {
                        userID = userID
                    });
                },
                                                               (recv) =>
                {
                    result = recv.param;
                });
                return(result);
            }
        private async void BtnAction_Clicked(object sender, EventArgs e)
        {
            var actions = new List <string>();

            if (m_viewModel.author == (string)App.Current.Properties["username"])
            {
                actions.Add(c_actionDelete);
            }
            else
            {
                actions.Add(c_actionUserInfo);
            }

            if (App.instance.isAdmin)
            {
                actions.Add(c_actionBlindPost);
                actions.Add(c_actionBlindAuthor);
            }
            else
            {
                actions.Add(c_actionReportPost);
                actions.Add(c_actionReportAuthor);
            }

            var choice = await DisplayActionSheet("무엇을 하시겠습니까?", "취소", null, actions.ToArray());

            switch (choice)
            {
            case c_actionUserInfo:
            {
                RespUserInfo result = null;
                await App.RunLongTask(() =>
                    {
                        result = App.instance.core.user.ShowUserInfo(m_viewModel.author);
                    });

                if (result != null)
                {
                    await Navigation.PushAsync(new UserInfoPage(result));
                }
            }
            break;

            case c_actionDelete:
            {
                var result = await DisplayAlert("삭제 확인", "정말로 글을 삭제하시겠습니까?", "네", "아니오");

                if (result)
                {
                    await App.RunLongTask(() =>
                        {
                            App.instance.core.post.DeletePost(m_postingID);
                        });
                    await DisplayAlert("삭제 완료", "글을 삭제하였습니다.", "확인");

                    App.GetMainPage();
                }
            }
            break;

            case c_actionReportPost:
            {
                await Navigation.PushAsync(new NewReportPosPage(m_postingID, m_viewModel.title));
            }
            break;

            case c_actionReportAuthor:
            {
                await Navigation.PushAsync(new NewReportUserPage(m_viewModel.author));
            }
            break;

            case c_actionBlindPost:
            {
                var result = await DisplayAlert("블라인드 처리", "해당 포스팅을 정말로 블라인드 처리 하시겠습니까? 이 포스팅은 본인과 운영자 외엔 아무도 열람할 수 없게 됩니다.", "네", "아니오");

                if (result)
                {
                    await App.RunLongTask(() =>
                        {
                            App.instance.core.post.BlindPost(m_postingID, true);
                        });
                    await DisplayAlert("블라인드 처리", "해당 포스팅이 블라인드 처리 되었습니다.", "확인");

                    App.GetMainPage();
                }
            }
            break;

            case c_actionBlindAuthor:
            {
                var result = await DisplayAlert("블라인드 처리", "해당 유저를 정말로 블라인드 처리 하시겠습니까? 유저가 작성한 모든 포스팅이 블라인드 처리된 것처럼 취급되며 해당 유저는 더이상 로그인할 수 없게 됩니다.", "네", "아니오");

                if (result)
                {
                    await App.RunLongTask(() =>
                        {
                            App.instance.core.user.BlindUser(m_viewModel.author, true);
                        });
                    await DisplayAlert("블라인드 처리", "해당 유저가 블라인드 처리 되었습니다.", "확인");

                    App.GetMainPage();
                }
            }
            break;
            }
        }
예제 #5
0
        protected override void Initialize()
        {
            // 새 유저 등록
            procedurePool.AddProcedure <ReqNewUser, RespNewUser>("ReqNewUser", "RespNewUser", UserType.Guest, (recv, send) =>
            {
                var id    = recv.param.userid;
                var pass  = recv.param.password;
                var email = recv.param.email;

                sqlHelper.RunSqlSession((sql) =>
                {
                    var sendParam = new RespNewUser();

                    var cmd         = sql.CreateCommand();
                    cmd.CommandText = @"select 
											(select count(*) from user where iduser = @id) as iddup, 
											(select count(*) from user where email = @email) as emaildup"                                            ;
                    cmd.Parameters.AddWithValue("@id", id);
                    cmd.Parameters.AddWithValue("@email", email);

                    var reader = cmd.ExecuteReader();
                    reader.Read();

                    var dupUserID = reader.GetInt32("iddup") != 0;
                    var dupEmail  = reader.GetInt32("emaildup") != 0;

                    reader.Close();

                    if (dupUserID)                                      // ID 중복
                    {
                        send.header.code = Packet.Header.Code.ClientSideError;
                        sendParam.status = RespNewUser.Status.DuplicatedID;
                    }
                    else if (dupEmail)                                  // Email중복
                    {
                        send.header.code = Packet.Header.Code.ClientSideError;
                        sendParam.status = RespNewUser.Status.AlreadyRegisteredEmail;
                    }
                    else
                    {                                                                   // 중복 없음.
                        var addCmd         = sql.CreateCommand();
                        addCmd.CommandText = "insert into user(iduser, password, email, is_admin, is_blinded) values(@id, @pass, @email, false, false)";
                        addCmd.Parameters.AddWithValue("@id", id);
                        addCmd.Parameters.AddWithValue("@pass", pass);
                        addCmd.Parameters.AddWithValue("@email", email);

                        send.header.code = Packet.Header.Code.OK;
                        sendParam.status = RespNewUser.Status.OK;

                        addCmd.ExecuteNonQuery();

                        // NOTE : 로그인은 별도로 해야한다.
                    }

                    send.SetParameter(sendParam);
                });
            });

            // 유저 탈퇴
            procedurePool.AddProcedure <EmptyParam, EmptyParam>("ReqDeleteUser", "RespDeleteUser", UserType.Registered, (recv, send) =>
            {
                var id = authServer.GetUserIDFromAuthKey(recv.header.authKey);

                sqlHelper.RunSqlSessionWithTransaction((sql) =>
                {
                    var cmd         = sql.CreateCommand();
                    cmd.CommandText = "delete from user where iduser = @id";
                    cmd.Parameters.AddWithValue("@id", id);
                    cmd.ExecuteNonQuery();

                    return(true);
                });
            });

            // 유저 블라인드 세팅
            procedurePool.AddProcedure <ReqBlindUser, EmptyParam>("ReqBlindUser", "RespBlindUser", UserType.Administrator,
                                                                  (recv, send) =>
            {
                sqlHelper.RunSqlSessionWithTransaction((sql) =>
                {
                    var cmd         = sql.CreateCommand();
                    cmd.CommandText = @"update user set is_blinded = @blind where iduser = @id";
                    cmd.Parameters.AddWithValue("@id", recv.param.userID);
                    cmd.Parameters.AddWithValue("@blind", recv.param.setBlind);
                    cmd.ExecuteNonQuery();

                    return(true);
                });
            });

            // 유저 정보 얻기
            procedurePool.AddProcedure <ReqUserInfo, RespUserInfo>("ReqUserInfo", "RespUserInfo", UserType.Registered,
                                                                   (recv, send) =>
            {
                sqlHelper.RunSqlSession((sql) =>
                {
                    var result = new RespUserInfo();
                    var userid = recv.param.userID;

                    var cmd         = sql.CreateCommand();
                    cmd.CommandText = @"select email, is_admin, is_blinded from user where iduser = @id";
                    cmd.Parameters.AddWithValue("@id", userid);

                    using (var reader = cmd.ExecuteReader())
                    {
                        reader.Read();

                        result.userID    = userid;
                        result.email     = reader.GetString("email");
                        result.isBlinded = reader.GetBoolean("is_blinded");
                        result.isAdmin   = reader.GetBoolean("is_admin");

                        reader.Close();
                    }

                    // 응답

                    send.SetParameter(result);
                    send.header.code = BakjeProtocol.Packet.Header.Code.OK;
                });
            });
        }
예제 #6
0
파일: List.ashx.cs 프로젝트: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                int    pageIndex      = !string.IsNullOrEmpty(context.Request["page"]) ? int.Parse(context.Request["page"]) : 1;
                int    pageSize       = !string.IsNullOrEmpty(context.Request["rows"]) ? int.Parse(context.Request["rows"]) : 10;
                string keyWord        = context.Request["keyWord"];
                string supplierUserId = "";
                if (currentUserInfo.UserType == 7)
                {
                    supplierUserId = currentUserInfo.UserID;
                }
                int totalCount;
                var sourceData = bllUser.GetSupplierList(bllUser.WebsiteOwner, pageIndex, pageSize, keyWord, supplierUserId, out totalCount);

                List <RespUserInfo> returnList = new List <RespUserInfo>();
                foreach (var p in sourceData)
                {
                    RespUserInfo model      = new RespUserInfo();
                    UserExpand   userExpand = bllUserExpand.GetUserExpand(BLLJIMP.Enums.UserExpandType.BankInfo, p.UserID, p.WebsiteOwner);
                    model.id                    = p.AutoID;
                    model.user_id               = p.UserID;
                    model.company_name          = p.Company;
                    model.true_name             = p.TrueName;
                    model.phone                 = p.Phone;
                    model.email                 = p.Email;
                    model.desc                  = p.Description;
                    model.permission_group_id   = p.PermissionGroupID;
                    model.permission_group_name = p.PermissionGroupID.HasValue ? bllUser.Get <ZentCloud.BLLPermission.Model.PermissionGroupInfo>(string.Format("GroupID={0}", p.PermissionGroupID)).GroupName : "";
                    model.head_img_url          = p.WXHeadimgurl;
                    model.image                 = p.Images;
                    model.ex1                   = p.Ex1;
                    model.ex2                   = p.Ex2; //供应商代码
                    model.ex3                   = p.Ex3;
                    model.ex4                   = p.Ex4; //提醒
                    model.address               = p.Address;
                    model.province              = p.Province;
                    model.city                  = p.City;
                    model.district              = p.District;
                    model.province_code         = p.ProvinceCode;
                    model.city_code             = p.CityCode;
                    model.district_code         = p.DistrictCode;
                    model.back_deposit          = userExpand != null?userExpand.Ex1:"";
                    model.back_account          = userExpand != null?userExpand.Ex2:"";
                    returnList.Add(model);
                }

                var resp = new
                {
                    total = totalCount,

                    rows = returnList
                };
                bllUser.ContextResponse(context, resp);
            }
            catch (Exception ex)
            {
                resp.returnObj = ex.ToString();
                bllUser.ContextResponse(context, resp);
            }
        }
예제 #7
0
 public ViewModel(RespUserInfo info)
 {
     userName = info.userID;
     email    = info.email;
 }
예제 #8
0
        private void InitActions()
        {
            AddAsyncAction("recentPostings", async() =>
            {
                RespLookupPosting result = null;
                await App.RunLongTask(() =>
                {
                    result = App.instance.core.post.LookupPosting(null);
                });

                if (result == null)
                {
                    await DisplayAlert("오류", "포스팅을 읽어올 수 없습니다.", "확인");
                }
                else
                {
                    Detail = new NavigationPage(new PostingListPage(null, result));
                }
            });

            AddAsyncAction("notice", async() =>
            {
                RespLookupNotice result = null;
                await App.RunLongTask(() =>
                {
                    result = App.instance.core.notice.LookupNotice();
                });

                if (result == null)
                {
                    await DisplayAlert("오류", "포스팅을 읽어올 수 없습니다.", "확인");
                }
                else
                {
                    Detail = new NavigationPage(new NoticeListPage(result));
                }
            });

            AddAsyncAction("myinfo", async() =>
            {
                RespUserInfo result = null;
                await App.RunLongTask(() =>
                {
                    result = App.instance.core.user.ShowUserInfo((string)App.Current.Properties["username"]);
                });

                if (result != null)
                {
                    Detail = new NavigationPage(new UserInfoPage(result));
                }
            });

            AddAsyncAction("recentReports", async() =>
            {
                RespLookupReport result = null;

                await App.RunLongTask(() =>
                {
                    result = App.instance.core.report.LookupReport();
                });

                if (result != null)
                {
                    Detail = new NavigationPage(new LookupReportPage(result));
                }
            });

            AddAsyncAction("logout", async() =>
            {
                await Task.Run(() =>
                {
                    App.instance.core.auth.ClearAuth();
                });
                await DisplayAlert("로그아웃", "로그아웃하였습니다.", "확인");
                App.GetLoginPage();
            });
        }