Exemple #1
0
 public static PriceSendModelDto ConvertPriceSendModelDto(PriceSendModel psm)
 {
     return(new PriceSendModelDto()
     {
         GroupId = psm.GroupId, Body = psm.Body, DaysSend = psm.DaysSend, FileConfig = psm.FileConfig, FileName = psm.FileName, Subject = psm.Subject, TimesSend = psm.TimesSend, IsEnabled = psm.IsEnabled, Email = psm.Email, ClientId = psm.ClientId, FileType = psm.FileType, ProfileId = psm.ProfileId, EmailSetting = psm.EmailSetting
     });
 }
Exemple #2
0
        public static PriceChangeClientEvent CalculateClientUpdates(PriceSendModel model, PriceGroupToClient changedModel, string userName)
        {
            //можно было сделать через Object.GetProperties, но пока для теста так
            var    list  = new List <KeyValuePair <string, string> >();
            var    days  = new string(changedModel.DaysSend);
            string times = changedModel.TimeSend.Aggregate("", (current, s) => current + (s + "; "));


            if (!days.Equals(model.DaysSend))
            {
                list.Add(new KeyValuePair <string, string>("DaysSend", days + " => " + model.DaysSend));
            }
            if (!times.Equals(model.TimesSend))
            {
                list.Add(new KeyValuePair <string, string>("TimeSend", times + " => " + model.TimesSend));
            }
            if (!model.Email.Equals(changedModel.ToEmail))
            {
                list.Add(new KeyValuePair <string, string>("ToEmail", changedModel.ToEmail + " => " + model.Email));
            }
            if (!model.FileName.Equals(changedModel.FileName))
            {
                list.Add(new KeyValuePair <string, string>("FileName", changedModel.FileName + " => " + model.FileName));
            }
            if (!model.Subject.Equals(changedModel.MailSubject))
            {
                list.Add(new KeyValuePair <string, string>("MailSubject", changedModel.MailSubject + " => " + model.Subject));
            }
            if (!model.Body.Equals(changedModel.MailBody))
            {
                var bodyres = (changedModel.MailBody + " => " + model.Body).Substring(0, 490);
                list.Add(new KeyValuePair <string, string>("MailBody", bodyres));
            }
            if (!model.FileConfig.Equals(changedModel.FileConfig))
            {
                list.Add(new KeyValuePair <string, string>("FileConfig", model.FileConfig));
            }

            return(ServiceFactory.GetPriceChangeClientEvent(model.GroupId, list, userName, "Изменены данные клиента " + changedModel.ClientCode, "update"));
        }