internal Campaign GetEntity(Campaign campaign) { var executionTime = DateRangeHelper.GetDateRange(ExecutionTime); var regTime = DateRangeHelper.GetDateRange(RegisterTime); var feedbackTime = DateRangeHelper.GetDateRange(FeedbackBefore); campaign.Quantity = Quantity; campaign.DateStart = regTime != null ? (DateTime?)regTime.Value.Start : null; campaign.DateEnd = regTime != null ? (DateTime?)regTime.Value.End : null; campaign.CustomKolNames = CustomKolNames.ToListString(); campaign.KPIMin = KPIMin; campaign.InteractiveMin = InteractiveMin; //campaign.InteractiveMin = KPIMin + InteractiveMin; campaign.ExecutionStart = executionTime != null ? (DateTime?)executionTime.Value.Start : null; campaign.ExecutionEnd = executionTime != null ? (DateTime?)executionTime.Value.End : null; campaign.FeedbackStart = feedbackTime != null ? (DateTime?)feedbackTime.Value.Start : null; campaign.FeedbackEnd = feedbackTime != null ? (DateTime?)feedbackTime.Value.End : null; campaign.AmountMax = AmountMax; campaign.AmountMin = AmountMin; return(campaign); }
public Campaign GetEntity(int agencyid, CampaignTypeCharge campaignTypeCharge, Core.Models.SettingModel setting, string code, string username) { //var accountChargeAmount = 0; //if (Type == CampaignType.CustomService || Type == CampaignType.JoinEvent) //{ // accountChargeAmount = AccountChargeAmount ?? 0; //} //else //{ // accountChargeAmount = campaignTypeCharge.AccountChargeAmount; //} //var accountChargeExtraPercent = 0; //if (Type == CampaignType.ShareContent || Type == CampaignType.ShareContentWithCaption) //{ // if (EnabledExtraType) // { // accountChargeExtraPercent = campaignTypeCharge.AccountChargeExtraPercent; // } //} var start = ""; var end = ""; if (!string.IsNullOrEmpty(ExecutionTime)) { var arrDate = ExecutionTime.Split('-'); if (arrDate.Length == 2) { start = arrDate[0].Trim(); end = arrDate[1].Trim(); } } var image = string.Empty; if (Type == CampaignType.ChangeAvatar) { image = Image; } else if (Type == CampaignType.ShareContentWithCaption) { image = AddonImages.ToListString(); } return(new Campaign() { DateCreated = DateTime.Now, AgencyId = agencyid, Data = Data, DateModified = DateTime.Now, Deleted = false, Description = Description, Image = image, Published = true, //Status = CampaignStatus.Created, // cap nhat status da duyet luon de facebook check, Status = CampaignStatus.Confirmed, Title = Title, UserCreated = username, UserModified = username, ExtraOptionChargePercent = setting.CampaignExtraOptionChargePercent, ServiceChargePercent = setting.CampaignServiceChargePercent, ServiceVATPercent = setting.CampaignVATChargePercent, ServiceChargeAmount = 0, AccountChargeExtraPercent = 0, AccountChargeAmount = 0, EnabledAccountChargeExtra = false, AccountChargeTime = 0, Requirement = Type == CampaignType.CustomService ? Requirement : string.Empty, Type = Type, Code = code, Quantity = Quantity, DateStart = start.ToViDateTime(), DateEnd = end.ToViDateTime(), AccountFeedbackBefore = FeedbackBefore.ToViDateTime(), CustomKolNames = CustomKolNames.ToListString(), Method = Method, SampleContent = SampleContent.ToListString(), Hashtag = HashTag.ToListString(), SampleContentText = SampleContentText }); }