예제 #1
0
    public void Insert(VotingReplyEntryInfo votingReplyEntryInfo)
    {
        db.Open();
        String query = "INSERT INTO [dbo].[VotingReplyEntry] "
                       + "([ClientID] "
                       + ",[EventID] "
                       + ",[CreditorID] "
                       + ",[Attendance] "
                       + ",[VoteMethod] "
                       + ",[ReplyDate] "
                       + ",[EMSStatus] "
                       + ",[EMSTrackingNo] "
                       + ",[CreateUser] "
                       + ",[CreateDate] "
                       + ",[LastModifiedUser] "
                       + ",[LastModifiedDate] ) "
                       + "VALUES "
                       + "(@ClientID "
                       + ",@EventID "
                       + ",@CreditorID "
                       + ",@Attendance "
                       + ",@VoteMethod "
                       + ",@ReplyDate "
                       + ",@EMSStatus "
                       + ",@EMSTrackingNo "
                       + ",@CreateUser "
                       + ",@CreateDate "
                       + ",@LastModifiedUser "
                       + ",@LastModifiedDate ) ";

        db.Execute(query, votingReplyEntryInfo);
        db.Close();
    }
예제 #2
0
 public void Save(VotingReplyEntryInfo votingReplyEntryInfo)
 {
     if (this.IsExisted(votingReplyEntryInfo.ClientID, votingReplyEntryInfo.EventID, votingReplyEntryInfo.CreditorID))
     {
         this.Update(votingReplyEntryInfo);
     }
     else
     {
         this.Insert(votingReplyEntryInfo);
     }
 }
예제 #3
0
    public string TakeAttendance(AttendanceInfo info)
    {
        VotingReplyEntry     votingReplyEntry     = new VotingReplyEntry();
        VotingReplyEntryInfo VotingReplyEntryList = votingReplyEntry.Get(info.ClientID, info.EventID, info.CreditorID);

        //if (VotingReplyEntryList == null) return null;

        ////voting method checking
        //if (VotingReplyEntryList != null && VotingReplyEntryList.VoteMethod != "2") return null;


        db.Open();
        try
        {
            if (!this.IsAttended(info.ClientID, info.CreditorID, info.EventID))
            {
                info.CreditorIDNo = VotingReplyEntryList.CreditorIDNo;

                string query = "INSERT INTO [dbo].[Attendance] "
                               + "([ClientID] "
                               + ",[EventID] "
                               + ",[CreditorID] "
                               + ",[CreditorIDNo] "
                               + ",[CreditAgent] "
                               + ",[CreditAgentIDNo] "
                               + ",[CreateDate] "
                               + ",[CreateUser]) "
                               + "VALUES "
                               + "(@ClientID "
                               + ",@EventID "
                               + ",@CreditorID "
                               + ",@CreditorIDNo "
                               + ",@CreditAgent "
                               + ",@CreditAgentIDNo "
                               + ",@CreateDate "
                               + ",@CreateUser) ";
                db.Execute(query, info, transaction);
                return("1");
            }
            else
            {
                return("2");
            }
        }
        finally
        {
            db.Close();
        }
        // return VotingReplyEntryList;
    }
예제 #4
0
    public VotingReplyEntryInfo Get(string clientID, int eventID, string creditorID)
    {
        db.Open();
        try
        {
            string query = @"
select VotingReplyEntry.*, 
CreditorMaster.CreditorName, 
CreditorMaster.CreditorIDNo,
VotingEventSetup.EventID, 
VotingEventSetup.EventDescription 
from VotingReplyEntry  
join CreditorMaster on VotingReplyEntry.ClientID = CreditorMaster.ClientID and VotingReplyEntry.CreditorID = CreditorMaster.CreditorID
left outer join VotingEventSetup on VotingEventSetup.ClientID = VotingReplyEntry.ClientID and VotingEventSetup.EventID = VotingReplyEntry.EventID
WHERE VotingReplyEntry.ClientID = @ClientID AND VotingReplyEntry.EventID = @EventID AND VotingReplyEntry.CreditorID = @CreditorID

";
            var    obj   = (List <VotingReplyEntryInfo>)db.Query <VotingReplyEntryInfo>(query, new { ClientID = clientID, EventID = eventID, CreditorID = creditorID });
            if (obj.Count > 0)
            {
                return(obj[0]);
            }
            else
            {
                query = @"

select top 1
VotingEventSetup.EventID, 
VotingEventSetup.EventDescription
from VotingEventSetup  
WHERE VotingEventSetup.ClientID = @ClientID AND VotingEventSetup.EventID = @EventID 
";
                var objEventSetup = db.Query(query, new { ClientID = clientID, EventID = eventID });
                foreach (var info in objEventSetup)
                {
                    VotingReplyEntryInfo backInfo = new VotingReplyEntryInfo();
                    backInfo.ClientID         = clientID;
                    backInfo.EventID          = info.EventID;
                    backInfo.CreditorID       = creditorID;
                    backInfo.EventDescription = info.EventDescription;
                    return(backInfo);
                }
            }
        }
        finally
        {
            db.Close();
        }
        return(null);
    }
예제 #5
0
    public void Update(VotingReplyEntryInfo votingReplyEntryInfo)
    {
        db.Open();
        String query = "UPDATE [dbo].[VotingReplyEntry] "
                       + "SET "
                       + "[Attendance] = @Attendance "
                       + ",[VoteMethod] = @VoteMethod "
                       + ",[ReplyDate] = @ReplyDate "
                       + ",[EMSStatus] = @EMSStatus "
                       + ",[EMSTrackingNo] = @EMSTrackingNo "
                       + ",[LastModifiedUser] = @LastModifiedUser "
                       + ",[LastModifiedDate] = @LastModifiedDate "
                       + "WHERE ClientID = @ClientID AND CreditorID = @CreditorID AND EventID = @EventID ";

        db.Execute(query, votingReplyEntryInfo);
        db.Close();
    }