Ejemplo n.º 1
0
        public void AddNewModelToMailSmtpCollection(List <MailSmtpModel> smtpList)
        {
            int c = smtpList.Count / 5;

            for (int i = 0; i < c; i++)
            {
                StringBuilder value = new StringBuilder();
                for (int j = 0; j < 5; j++)
                {
                    var    smtpLog = smtpList[i * 5 + j];
                    string temp    = string.Format("('{0}','{1}','{2}',{3},N'{4}',N'{5}',N'{6}',{7},{8},N'{9}'),", smtpLog.Guid, DateTimeBuilder.CommonStrDateTime(smtpLog.StartTime), DateTimeBuilder.CommonStrDateTime(smtpLog.EndTime), smtpLog.Mask.ToString(), smtpLog.IPAddress, smtpLog.SendMailAddress, smtpLog.ReserveMailAddress, smtpLog.MaxSize.ToString(), smtpLog.ReserveSize.ToString(), smtpLog.Details);
                    value.Append(temp);
                }
                string sql = string.Format("insert into T_SmtpLog values {0}", value.ToString().TrimEnd(','));
                sqlo.getSomeDate(sql);
            }

            if (smtpList.Count - c * 5 > 0)
            {
                string value2 = "";
                for (int i = c * 5; i < smtpList.Count; i++)
                {
                    var    smtpLog = smtpList[i];
                    string temp    = string.Format("('{0}','{1}','{2}',{3},N'{4}',N'{5}',N'{6}',{7},{8},N'{9}'),", smtpLog.Guid, DateTimeBuilder.CommonStrDateTime(smtpLog.StartTime), DateTimeBuilder.CommonStrDateTime(smtpLog.EndTime), smtpLog.Mask.ToString(), smtpLog.IPAddress, smtpLog.SendMailAddress, smtpLog.ReserveMailAddress, smtpLog.MaxSize.ToString(), smtpLog.ReserveSize.ToString(), smtpLog.Details);
                    value2 += temp;
                }
                string sql2 = string.Format("insert into T_SmtpLog values {0}", value2.TrimEnd(','));
                sqlo.getSomeDate(sql2);
            }
        }
Ejemplo n.º 2
0
        public void AddNewModelToMailQueueCollection(List <MailQueueModel> queueList)
        {
            int c = queueList.Count / 50;

            for (int i = 0; i < c; i++)
            {
                StringBuilder value = new StringBuilder();
                for (int j = 0; j < 50; j++)
                {
                    var    queueLog = queueList[i * 50 + j];
                    string temp     = string.Format("('{0}','{1}','{2}',{3},N'{4}',{5},N'{6}',N'{7}'),", queueLog.Guid, DateTimeBuilder.CommonStrDateTime(queueLog.StartTime), DateTimeBuilder.CommonStrDateTime(queueLog.EndTime), queueLog.Mask.ToString(), queueLog.SendMailAddress, queueLog.SendSize.ToString(), queueLog.Details, queueLog.MailID);
                    value.Append(temp);
                }
                string sql = string.Format("insert into T_QueueLog values {0}", value.ToString().TrimEnd(','));
                sqlo.getSomeDate(sql);
            }

            if (queueList.Count - c * 50 > 0)
            {
                string value2 = "";
                for (int i = c * 50; i < queueList.Count; i++)
                {
                    var    queueLog = queueList[i];
                    string temp     = string.Format("('{0}','{1}','{2}',{3},N'{4}',{5},N'{6}',N'{7}'),", queueLog.Guid, DateTimeBuilder.CommonStrDateTime(queueLog.StartTime), DateTimeBuilder.CommonStrDateTime(queueLog.EndTime), queueLog.Mask.ToString(), queueLog.SendMailAddress, queueLog.SendSize.ToString(), queueLog.Details, queueLog.MailID);
                    value2 += temp;
                }
                string sql2 = string.Format("insert into T_QueueLog values {0}", value2.TrimEnd(','));
                sqlo.getSomeDate(sql2);
            }
        }
Ejemplo n.º 3
0
        public void AddNewModelToPrintLogCollection(List <PrintLogViewModel> printLogList)
        {
            int c = printLogList.Count / 50;

            for (int i = 0; i < c; i++)
            {
                StringBuilder value = new StringBuilder();
                for (int j = 0; j < 50; j++)
                {
                    var    printLog = printLogList[i * 50 + j];
                    string temp     = string.Format("('{0}','{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}',N'{8}'),", printLog.Guid, DateTimeBuilder.CommonStrDateTime(printLog.ExecuteTime), printLog.UserName, printLog.IPAddress, printLog.ComputerName, printLog.MACAddress, printLog.ProgramName, printLog.PrintType, printLog.FileName);

                    value.Append(temp);
                }
                string sql = string.Format("insert into T_PrintLog values {0}", value.ToString().TrimEnd(','));
                sqlo.getSomeDate(sql);
            }

            if (printLogList.Count - c * 50 > 0)
            {
                string value2 = "";
                for (int i = c * 50; i < printLogList.Count; i++)
                {
                    var    printLog = printLogList[i];
                    string temp     = string.Format("('{0}','{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}',N'{8}'),", printLog.Guid, DateTimeBuilder.CommonStrDateTime(printLog.ExecuteTime), printLog.UserName, printLog.IPAddress, printLog.ComputerName, printLog.MACAddress, printLog.ProgramName, printLog.PrintType, printLog.FileName);
                    value2 += temp;
                }
                string sql2 = string.Format("insert into T_PrintLog values {0}", value2.TrimEnd(','));
                sqlo.getSomeDate(sql2);
            }

            UpdatePrintLogCollection();
        }