예제 #1
0
파일: ReadFile.cs 프로젝트: 19158742/ENC
        public int GenerateN(ReceiverInfo ri)
        {
            int    cntCharacters = CountReceiverInfoCharacters(ri);
            long   multi         = cntCharacters * Convert.ToInt64(DateTime.Now.Ticks);
            string str           = Convert.ToString(multi).Substring(0, 5);
            int    n             = Convert.ToInt32(str);

            return(n);
            //Multiply operation of count and timestamp and take first 5 digits, then  generate number n
        }
예제 #2
0
        internal void SaveSRAllocation(tbl_SR_allocation tbl_SR_allocation)
        {
            DBOperations dbo = new DBOperations();
            DBModel      db  = new DBModel();
            ReceiverInfo r   = new ReceiverInfo();
            ReadFile     rf  = new ReadFile();

            r.datakeyid = Convert.ToString(tbl_SR_allocation.tbldatakey_id);
            r.senderid  = Convert.ToString(tbl_SR_allocation.sender_id);
            tbl_receiverinfo receiverInfo = db.tbl_receiverinfo.Where(x => x.receiver_id == tbl_SR_allocation.receiver_id).FirstOrDefault();

            r.receiverEmail = receiverInfo.receiver_email;
            r.receiverName  = receiverInfo.receiver_name;
            int    tempn       = rf.GenerateN(r);
            int    n           = rf.ValidateTempN(tempn, tbl_SR_allocation.tbldatakey_id);
            string senderattr  = db.tbl_senderinfo.Where(x => x.sender_id == tbl_SR_allocation.sender_id).Select(x => x.sender_attribute).FirstOrDefault().ToString();
            string receiverKey = rf.GenerateReceiverKey(n, senderattr);

            tbl_SR_allocation.receiver_key = receiverKey;
            dbo.SaveReceiverKeyOnServer(tbl_SR_allocation);
            SendEmailToReceiver(receiverKey, r.receiverEmail, tbl_SR_allocation);
        }
예제 #3
0
파일: ReadFile.cs 프로젝트: 19158742/ENC
 private int CountReceiverInfoCharacters(ReceiverInfo ri)
 {
     return(ri.receiverEmail.Length + ri.receiverName.Length + ri.senderid.Length + ri.datakeyid.Length);
 }