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 }); }
public Campaign GetEntity(Campaign campaign) { campaign.Title = Title; campaign.Description = Description; campaign.Data = Data; var image = string.Empty; if (!string.IsNullOrEmpty(Image)) { image = Image; } else { image = AddonImages.ToListString(); } //if (Type == CampaignType.ChangeAvatar) //{ // image = Image; //} //else if (Type == CampaignType.ShareContentWithCaption) //{ // image = AddonImages.ToListString(); //} campaign.Image = image; campaign.Requirement = Requirement; campaign.AccountChargeTime = AccountChargeTime ?? 1; campaign.Type = Type; campaign.IsSendProduct = SendProduct; campaign.Code = campaign.Code; campaign.Hashtag = HashTag.ToListString(); if (!string.IsNullOrEmpty(SampleContent.ToListString())) { campaign.SampleContent = SampleContent.ToListString(); } campaign.SampleContentText = SampleContentText; campaign.Method = Method; var reviewTime = DateRangeHelper.GetDateRange(ReviewDate); campaign.ReviewStart = reviewTime != null ? (DateTime?)reviewTime.Value.Start : null; campaign.ReviewEnd = reviewTime != null ? (DateTime?)reviewTime.Value.End : null; if (ReviewType == CampaignReviewType.GuiSanPham) { campaign.ReviewAddress = ReviewAddress; } else { campaign.ReviewAddress = ReviewAddress; } if (ReviewPayback.HasValue == true) { if (ReviewPayback.Value == 1) { campaign.ReviewPayback = true; } else { campaign.ReviewPayback = false; } } else { campaign.ReviewPayback = false; } campaign.ReviewType = ReviewType; return(campaign); }