예제 #1
0
파일: BizMember.cs 프로젝트: chae87/First
 /// <summary>Member 삭제</summary>
 public bool DeleteMember(BmMember pDataRq)
 {
     try
     {
         using (SqlConn = new SqlConnection(ConnectionString))
         {
             using (TransactionScope scope = new TransactionScope())
             {
                 try
                 {
                     SqlConn.Open();
                     var result = dac.DeleteMember(pDataRq);
                     scope.Complete();
                     return result;
                 }
                 catch (Exception ex)
                 {
                     throw ex;
                 }
                 finally
                 {
                     SqlConn.Dispose();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         WriteLog("Exception", ex.Message);
         throw;
     }
 }
예제 #2
0
    public static bool CheckOverLapId(string pId)
    {
        if (!string.IsNullOrEmpty(pId.Trim()))
        {
            BizMember bizMember = new BizMember();
            BmMember bmMember = new BmMember();

            bmMember.Id = pId;

            var result = bizMember.GetMemberList(bmMember);

            if (result.Count == 0)
            {
                return true;
            }
        }

        return false;
    }
예제 #3
0
파일: DacMember.cs 프로젝트: chae87/First
        /// <summary>Member 삭제</summary> 로그 등록 필요
        public bool DeleteMember(BmMember pDataRq)
        {
            try
            {
                #region SetQuery

                string strQuery = @"DELETE tbMember WHERE Seq = @Seq";

                #endregion SetQuery

                int result = 0;
                SqlCommand cmd = new SqlCommand();

                cmd.Connection = SqlConn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = strQuery.ToString();

                #region Set Parameters

                cmd.Parameters.Add("@Seq", SqlDbType.Int, 0).Value = pDataRq.Seq;

                #endregion Set Parameters

                result = cmd.ExecuteNonQuery();

                cmd.Dispose();

                if (result == 1)
                {
                    WriteHistory(pDataRq, HistoryCommandType.DELETE);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
    /// <summary>회원 삭제</summary>
    private void DeleteMember(int pSeq)
    {
        string strMsg = "";

        if (pSeq > 0)
        {
            BmMember bmMember = new BmMember();
            BizMember bizMember = new BizMember();

            bmMember = vwMemberList.FirstOrDefault(o => o.Seq.Equals(pSeq));

            if (bmMember != null)
            {
                bmMember.Modifyer = LoginMgr.Id;

                bool result = bizMember.DeleteMember(bmMember);

                if (result)
                {
                    strMsg = "회원삭제가 완료되었습니다.";
                }
                else
                {
                    strMsg = "회원삭제에 실패하였습니다.";
                }
            }
        }
        else
        {
            strMsg = "잘못된 회원입니다.";
        }

        SetAndShowCmmModal("회원삭제", strMsg);

        ucPaging.CurPage = 0;
        Search();
        ucPaging.ReSetPageControl();
    }
예제 #5
0
파일: DacMember.cs 프로젝트: chae87/First
        /// <summary>회원 Convert DataTable -> BizMember</summary>
        private List<BmMember> ConvertToBmMember(DataTable dt)
        {
            List<BmMember> bmMemberList = new List<BmMember>();

            foreach (DataRow dr in dt.Rows)
            {
                BmMember data = new BmMember();

                data.Seq = (int)dr["Seq"];
                data.Id = dr["Id"].ToString();
                data.Pw = dr["pw"].ToString();
                data.Name = dr["Name"].ToString();
                data.Addr = dr["Addr"].ToString();
                data.Sex = dr["Sex"].ToString();
                data.Lv = (int)dr["Level"];
                data.Cash = Convert.ToDouble(dr["Cash"].ToString());
                data.Point = Convert.ToDouble(dr["Point"].ToString());
                data.RegDt = (DateTime)dr["RegDt"];
                data.ModifyDt = string.IsNullOrEmpty(dr["ModifyDt"].ToString()) ? null : (DateTime?)dr["ModifyDt"];
                data.Modifyer = dr["Modifyer"].ToString();
                data.State = (int)dr["State"];

                bmMemberList.Add(data);
            }

            return bmMemberList;
        }
예제 #6
0
파일: DacMember.cs 프로젝트: chae87/First
        /// <summary>Member 수정</summary>
        public bool UpdateMember(BmMember pDataRq)
        {
            try
            {
                #region SetQuery

                string strQuery = @"UPDATE tbMember SET
                                        Pw = @Pw,
                                        Name = @Name,
                                        Addr = @Addr,
                                        Sex = @Sex,
                                        Level = @Level,
                                        Cash = @Cash,
                                        Point = @Point,
                                        State = @State,
                                        Modifyer = @Modifyer,
                                        ModifyDt = dbo.getkordate()
                                    WHERE
                                        Seq = @Seq";

                #endregion SetQuery

                int result = 0;
                SqlCommand cmd = new SqlCommand();

                cmd.Connection = SqlConn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = strQuery.ToString();

                #region Set Parameters

                cmd.Parameters.Add("@Seq", SqlDbType.Int, 0).Value = pDataRq.Seq;
                cmd.Parameters.Add("@Pw", SqlDbType.VarChar, 100).Value = pDataRq.Pw;
                cmd.Parameters.Add("@Name", SqlDbType.VarChar, 20).Value = pDataRq.Name;
                cmd.Parameters.Add("@Addr", SqlDbType.VarChar, 100).Value = pDataRq.Addr;
                cmd.Parameters.Add("@Sex", SqlDbType.VarChar, 1).Value = pDataRq.Sex;
                cmd.Parameters.Add("@Level", SqlDbType.Int, 0).Value = pDataRq.Lv;
                cmd.Parameters.Add("@Cash", SqlDbType.Decimal, 0).Value = pDataRq.Cash;
                cmd.Parameters.Add("@Point", SqlDbType.Decimal, 0).Value = pDataRq.Point;
                cmd.Parameters.Add("@State", SqlDbType.Int, 0).Value = pDataRq.State;
                cmd.Parameters.Add("@Modifyer", SqlDbType.VarChar, 50).Value = pDataRq.Modifyer;

                #endregion Set Parameters

                result = cmd.ExecuteNonQuery();

                cmd.Dispose();

                if (result == 1)
                {
                    WriteHistory(pDataRq, HistoryCommandType.UPDATE);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
파일: DacMember.cs 프로젝트: chae87/First
        /// <summary>Member 등록</summary>
        public bool InsertMember(BmMember pDataRq)
        {
            try
            {
                #region SetQuery

                string strQuery = @"Insert Into tbMember
                                        (Id
                                        , Pw
                                        , Name
                                        , Addr
                                        , Sex
                                        , Level
                                        , Cash
                                        , Point
                                        , State
                                        )
                                    Values
                                        (@Id
                                        , @Pw
                                        , @Name
                                        , @Addr
                                        , @Sex
                                        , @Level
                                        , @Cash
                                        , @Point
                                        , @State)
                                    SELECT @@Identity";

                #endregion SetQuery

                int result = 0;
                SqlCommand cmd = new SqlCommand();

                cmd.Connection = SqlConn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = strQuery.ToString();

                #region Set Parameters

                cmd.Parameters.Add("@Id", SqlDbType.VarChar, 20).Value = pDataRq.Id;
                cmd.Parameters.Add("@Pw", SqlDbType.VarChar, 100).Value = pDataRq.Pw;
                cmd.Parameters.Add("@Name", SqlDbType.VarChar, 20).Value = pDataRq.Name;
                cmd.Parameters.Add("@Addr", SqlDbType.VarChar, 100).Value = pDataRq.Addr;
                cmd.Parameters.Add("@Sex", SqlDbType.VarChar, 1).Value = pDataRq.Sex;
                cmd.Parameters.Add("@Level", SqlDbType.Int, 0).Value = pDataRq.Lv;
                cmd.Parameters.Add("@Cash", SqlDbType.Decimal, 0).Value = pDataRq.Cash;
                cmd.Parameters.Add("@Point", SqlDbType.Decimal, 0).Value = pDataRq.Point;
                cmd.Parameters.Add("@State", SqlDbType.Int, 0).Value = pDataRq.State;

                #endregion Set Parameters

                result = Convert.ToInt32(cmd.ExecuteScalar());

                cmd.Dispose();

                if (result > 0)
                {
                    pDataRq.Seq = result;
                    WriteHistory(pDataRq, HistoryCommandType.INSERT);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
파일: DacMember.cs 프로젝트: chae87/First
        /// <summary>MemberList 조회</summary>
        public List<BmMember> GetMemberList(BmMember pDataRq)
        {
            try
            {
                #region SetQuery

                StringBuilder sbQuery = new StringBuilder("SELECT * FROM tbMember WHERE 1=1");

                if (pDataRq.Seq > 0)
                    sbQuery.AppendLine(" AND Seq = @Seq");
                if (!string.IsNullOrEmpty(pDataRq.Id))
                    sbQuery.AppendLine(" AND Id = @Id");

                sbQuery.AppendLine(" order by RegDt");

                #endregion SetQuery

                List<BmMember> result = new List<BmMember>();
                SqlCommand cmd = new SqlCommand();

                cmd.Connection = SqlConn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = sbQuery.ToString();

                #region Set Parameters

                if (pDataRq.Seq > 0)
                    cmd.Parameters.Add("@Seq", SqlDbType.Int, 0).Value = pDataRq.Seq;
                if (string.IsNullOrEmpty(pDataRq.Id) == false)
                    cmd.Parameters.Add("@Id", SqlDbType.VarChar, 20).Value = pDataRq.Id;

                #endregion Set Parameters

                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    DataTable dt = new DataTable();

                    dt.Load(reader);
                    result = ConvertToBmMember(dt);
                }

                reader.Dispose();
                cmd.Dispose();

                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
    protected override void LoadViewState(object savedState)
    {
        base.LoadViewState(savedState);

        upMemberRq = (BmMember)ViewState["upMemberRq"];
    }
예제 #10
0
    /// <summary>Member 등록</summary>
    private void InsertMember()
    {
        string strMsg = "";

        BizMember bizMember = new BizMember();
        BmMember bmMemberRq = new BmMember();

        bmMemberRq.Id = tbxId.Text;

        var checkId = bizMember.GetMemberList(bmMemberRq);

        if (checkId.Count == 0)
        {
            #region Set InsertModel Rq

            bmMemberRq.Id = tbxId.Text;
            bmMemberRq.Pw = tbxPw.Text;
            bmMemberRq.Name = tbxNm.Text;
            bmMemberRq.Addr = tbxAddr.Text;
            bmMemberRq.Sex = ddlSex.SelectedValue;
            bmMemberRq.Lv = Convert.ToInt32(ddlLevel.SelectedValue);
            bmMemberRq.Cash = Convert.ToDouble(tbxCash.Text);
            bmMemberRq.Point = Convert.ToDouble(tbxPoint.Text);
            bmMemberRq.State = Convert.ToInt32(ddlUserState.SelectedValue);
            bmMemberRq.Registrant = LoginMgr.Id;

            #endregion Set InsertModel Rq

            bool result = bizMember.InsertMember(bmMemberRq);

            if (result)
            {
                strMsg = "회원 등록이 완료 되었습니다.";

                strId = tbxId.Text;
                GetMember();
            }
            else
            {
                strMsg = "회원 등록이 실패하였습니다.";
            }
        }
        else
        {
            strMsg = "이미 존재하는 ID입니다.";
        }
        SetAndShowCmmModal("회원등록", strMsg);
    }
예제 #11
0
    /// <summary>멤버 가져오기</summary>
    private void GetMember()
    {
        if (iSeq != 0 || !string.IsNullOrEmpty(strId.Trim()))
        {
            BizMember bizMember = new BizMember();
            BmMember bmMember = new BmMember();

            if (iSeq != 0) { bmMember.Seq = iSeq; }
            if (!string.IsNullOrEmpty(strId)) { bmMember.Id = strId; }

            var result = bizMember.GetMemberList(bmMember);

            if (result.Count == 1)
            {
                upMemberRq = result[0];
                ViewState["upMemberRq"] = upMemberRq;

                BindCtrls(result[0]);
            }
            else
            {
                ResetControl();
            }
        }
        else
        {
            ResetControl();
        }
    }
예제 #12
0
    /// <summary>데이터 바인드</summary>
    private void BindCtrls(BmMember pData)
    {
        tbxId.Text = pData.Id;
        tbxPw.Text = pData.Pw;
        tbxNm.Text = pData.Name;
        tbxAddr.Text = pData.Addr;
        ddlSex.SelectedValue = pData.Sex;
        ddlLevel.SelectedValue = pData.Lv.ToString();
        tbxCash.Text = pData.Cash.ToString();
        tbxPoint.Text = pData.Point.ToString();
        ddlUserState.SelectedValue = pData.State.ToString();
        tbxRegDt.Text = pData.RegDt.ToString();
        tbxModifyer.Text = pData.Modifyer;
        tbxModifyDt.Text = pData.ModifyDt.ToString();

        btnInsertConfirm.Enabled = false;
        btnInsertConfirm.CssClass += " disabled";

        btnModify.Enabled = true;
        btnModify.CssClass = btnModify.CssClass.Replace("disabled", "");

        tbxId.ReadOnly = true;
    }
예제 #13
0
파일: BmMember.cs 프로젝트: chae87/First
 public BmMemberPagingRq()
 {
     Member = new BmMember();
     Paging = new BmPaging();
 }