コード例 #1
0
        //private List<Relationship> _relationships;
        public FrmResignKeyMember(MemberPosition memberPosition)
        {
            InitializeComponent();

            //_memberPositions = memberPositions;
            _memberPosition = memberPosition;
            //_relationships = relationships;
            InitControls();
        }
コード例 #2
0
        public static List <MemberPosition> GetPositions(int keyMemAccountId)
        {
            List <MemberPosition> positions = new List <MemberPosition>();

            using (SqlConnection conn = new SqlConnection(ConnStr))
            {
                string query = @"select USERSHADOW.USER_NAME,
	                    RSUDepend.dbo.CP_Member.*,
	                    ISSUER_NAME,
	                    DIRECTOR_STATUS_DESCRIPTION"     //,
//                        ACCOUNT_REFERENCE,
//                        isnull(NAME_SURNAME,'') + ', ' + isnull(NAME_FORENAMES,'') as MemberName

                               + @" from
	                    RSUDepend.dbo.CP_Member
	                    left join ISSUER on ISSUER_ID = RSUDepend.dbo.CP_Member.MEMBER_ISSUER
						left join CONFIG_DIRECTOR_STATUS on RSUDepend.dbo.CP_Member.MEMBER_DIRECTOR	= DIRECTOR_STATUS_CODE
		                left join USERSHADOW on USERSHADOW.USER_ID = RSUDepend.dbo.CP_Member.EnteredByUserID
	                    left join DEPOUSER on USERSHADOW.USER_ID = DEPOUSER.DEPOUSER_USER
	                    left join DEPOPART on DEPOPART.DEPOPART_ID = DEPOUSER.DEPOUSER_PART_ID "
                               //left join ACCOUNT on ACCOUNT.ACCOUNT_ID = RSUDepend.dbo.CP_Member.MEMBER_ACCOUNT
                               //left join NAME on NAME.NAME_ACCOUNT = ACCOUNT.ACCOUNT_ID and NAME_SEQUENCE = 1
                               + @"where   MEMBER_ACCOUNT = " + keyMemAccountId.ToString();

                conn.Open();
                SqlCommand    cmd    = new SqlCommand(query, conn);
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    MemberPosition memPos = new MemberPosition()
                    {
                        KeyMemberAccountID = (int)reader["MEMBER_ACCOUNT"],
                        //KeyMemberAccountRef = reader["ACCOUNT_REFERENCE"].ToString(),
                        RSUMemberPosition   = reader["MEMBER_POSITION"].ToString(),
                        KeyMemberJoinReason = reader["MEMBER_JOIN_REASON"].ToString(),
                        KeyMemberReportType = reader["MEMBER_REPORT_TYPE"].ToString(),
                        KeyMemberTRN        = reader["MEMBER_TRN"].ToString(),
                        //KeyMemberName = reader["MemberName"].ToString(),
                        KeyMemberIssuer     = reader["ISSUER_NAME"].ToString(),
                        KeyMemberPosition   = reader["DIRECTOR_STATUS_DESCRIPTION"].ToString(),
                        KeyMemberJoinDate   = (DateTime)reader["MEMBER_JOINED"],
                        KeyMemberResignDate = (DateTime)reader["MEMBER_RESIGNED"],
                        EnteredBy           = reader["USER_NAME"].ToString(),
                        EnteredAt           = (DateTime)reader["EnteredAt"]
                    };

                    positions.Add(memPos);
                }
            }

            return(positions);
        }
コード例 #3
0
        public static List <MemberPosition> GetPositions(int keyMemAccountId, int issuerId, string memberPosition)
        {
            List <MemberPosition> positions = new List <MemberPosition>();

            DateTime resignOn = new DateTime(9998, 12, 31);

            using (SqlConnection conn = new SqlConnection(ConnStr))
            {
                string query = @"select USERSHADOW.USER_NAME,
	                    RSUDepend.dbo.CP_Member.*,
	                    ISSUER_NAME,
	                    DIRECTOR_STATUS_DESCRIPTION
                        
                    from
	                    RSUDepend.dbo.CP_Member
	                    left join ISSUER on ISSUER_ID = RSUDepend.dbo.CP_Member.MEMBER_ISSUER
						left join CONFIG_DIRECTOR_STATUS on RSUDepend.dbo.CP_Member.MEMBER_DIRECTOR	= DIRECTOR_STATUS_CODE
		                left join USERSHADOW on USERSHADOW.USER_ID = RSUDepend.dbo.CP_Member.EnteredByUserID
	                    left join DEPOUSER on USERSHADOW.USER_ID = DEPOUSER.DEPOUSER_USER
	                    left join DEPOPART on DEPOPART.DEPOPART_ID = DEPOUSER.DEPOUSER_PART_ID
	                    where MEMBER_ACCOUNT = "     + keyMemAccountId.ToString() +
                               "and ISSUER_ID = " + issuerId +
                               "and MEMBER_DIRECTOR = '" + memberPosition + "'" +
                               "and cast(MEMBER_RESIGNED as date) = '" + resignOn + "'";

                conn.Open();
                SqlCommand    cmd    = new SqlCommand(query, conn);
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    MemberPosition memPos = new MemberPosition()
                    {
                        KeyMemberAccountID  = (int)reader["MEMBER_ACCOUNT"],
                        KeyMemberIssuer     = reader["ISSUER_NAME"].ToString(),
                        KeyMemberPosition   = reader["DIRECTOR_STATUS_DESCRIPTION"].ToString(),
                        KeyMemberTRN        = reader["MEMBER_TRN"].ToString(),
                        KeyMemberJoinDate   = (DateTime)reader["MEMBER_JOINED"],
                        KeyMemberResignDate = (DateTime)reader["MEMBER_RESIGNED"],
                        RSUMemberPosition   = reader["MEMBER_POSITION"].ToString(),
                        KeyMemberJoinReason = reader["MEMBER_JOIN_REASON"].ToString(),
                        KeyMemberReportType = reader["MEMBER_REPORT_TYPE"].ToString(),
                        EnteredBy           = reader["USER_NAME"].ToString(),
                        EnteredAt           = (DateTime)reader["EnteredAt"]
                    };

                    positions.Add(memPos);
                }
            }

            return(positions);
        }
コード例 #4
0
        private void btnMemResign_Click(object sender, EventArgs e)
        {
            if (dgvPositions.Rows.Count > 0)
            {
                //dgvPositions.SelectedRows

                MemberPosition pos = (MemberPosition)dgvPositions.SelectedRows[0].DataBoundItem;

                //List<DataGridViewRow> rowCollection = new List<DataGridViewRow>();

                //foreach(DataGridViewCell cell in dgvPositions.SelectedCells)
                //{
                //    rowCollection.Add(dgvPositions.Rows[cell.RowIndex]);
                //}

                //MemberPosition memPos = new MemberPosition();
                //memPos.KeyMemberAccountID = rowCollection[0].;
                //MemberPositions = rowCollection;

                //FrmResignKeyMember frm = new FrmResignKeyMember(pos); //dgvConnections.SelectedRows[0].DataBoundItem
                //frm.ShowDialog();
                FrmEditKeyMember frm = new FrmEditKeyMember(pos); //dgvConnections.SelectedRows[0].DataBoundItem
                frm.ShowDialog();

                //MemberConnection con = (MemberConnection)dgvConnections.SelectedRows[0].DataBoundItem;

                //string message = "You are about to delete the connection between {0} and {1}.\n\nAre you sure that you want to do this?";
                //var dResult = MessageBox.Show(string.Format(message, con.KeyMemberName, con.ConnectedPartyName),
                //    "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                //if (dResult == DialogResult.Yes)
                //{
                //    try
                //    {
                //        DataSource.ResignPosition(pos.KeyMemberAccountID, pos.KeyMemberIssuer, pos.KeyMemberPosition, pos.KeyMemberJoinDate, pos.KeyMemberResignDate);
                //        // reload data grid
                LoadPositions(pos.KeyMemberAccountID);
                //    }
                //    catch (Exception ex)
                //    {
                //        MessageBox.Show("Oops! Something went wrong. \n\n" + ex.Message,
                //            "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    }
                //}
            }
        }
コード例 #5
0
        public static List <MemberPosition> GetPositions(int keyMemAccountId, int issuerId, string memberPosition)
        {
            List <MemberPosition> positions = new List <MemberPosition>();

            DateTime resignOn = new DateTime(9998, 12, 31);


            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DependTest"].ConnectionString);

            conn.Open();
            SqlCommand cmd = new SqlCommand("getPositionsTertiary", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@keyMemAccountID", keyMemAccountId);
            cmd.Parameters.AddWithValue("@issuerID", issuerId);
            cmd.Parameters.AddWithValue("@resignOn", resignOn);
            cmd.Parameters.AddWithValue("@memberPosition", memberPosition);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                MemberPosition memPos = new MemberPosition()
                {
                    KeyMemberAccountID  = (int)reader["MEMBER_ACCOUNT"],
                    KeyMemberIssuer     = reader["ISSUER_NAME"].ToString(),
                    KeyMemberPosition   = reader["DIRECTOR_STATUS_DESCRIPTION"].ToString(),
                    KeyMemberTRN        = reader["MEMBER_TRN"].ToString(),
                    KeyMemberJoinDate   = (DateTime)reader["MEMBER_JOINED"],
                    KeyMemberResignDate = (DateTime)reader["MEMBER_RESIGNED"],
                    RSUMemberPosition   = reader["MEMBER_POSITION"].ToString(),
                    KeyMemberJoinReason = reader["MEMBER_JOIN_REASON"].ToString(),
                    KeyMemberReportType = reader["MEMBER_REPORT_TYPE"].ToString(),
                    EnteredBy           = reader["USER_NAME"].ToString(),
                    EnteredAt           = (DateTime)reader["EnteredAt"]
                };

                positions.Add(memPos);
            }


            return(positions);
        }
コード例 #6
0
        private MemberPosition GetUserSelectedMember(string selected, int issuer)
        {
            MemberPosition memPos   = null;
            DateTime       resignOn = new DateTime(9998, 12, 31);


            try
            {
                memPos = _memberPositions
                         .Where(x => x.KeyMemberAccountID == Int32.Parse(selected.Split('-').ElementAt(1).Trim()) &&
                                x.KeyMemberIssuer == issuer.ToString() &&
                                x.KeyMemberResignDate == resignOn)
                         .SingleOrDefault();

                //mem = _members
                //.Where(x => x.AccountReference == selected.Split('-').Last().Trim())
                //.SingleOrDefault();
            }
            catch { }

            return(memPos);
        }