public static CourseInfoDTO CourseToken2CourseInfoDto(this CRS_CourseToken token, string trackingId) { if (token == null) { return(null); } var dto = new CourseInfoDTO { CourseId = token.CourseId , uid = token.uid , CourseName = token.CourseName , CourseDescription = token.CourseDescription , IsFreeCourse = token.IsFreeCourse , ThumbUrl = token.SmallImage.ToThumbUrl(Constants.ImageBaseUrl) , Price = token.Price , MonthlySubscriptionPrice = token.MonthlySubscriptionPrice , OverviewVideoIdentifier = token.OverviewVideoIdentifier , DisplayOtherLearnersTab = token.DisplayOtherLearnersTab , MetaTags = token.MetaTags , Author = new UserInfoDTO { UserId = token.AuthorUserId , FirstName = token.FirstName , LastName = token.LastName , FullName = token.Entity2AuthorFullName() , Email = token.Email , FacebookId = token.FacebookID } }; dto.CoursePageUrl = token.GenerateCourseFullPageUrl(dto.Author.FullName, dto.CourseName, trackingId); return(dto); }
private void buttonAdd_Click(object sender, EventArgs e) { if (CourcesDb == null) { CourcesDb = new List <CourseDTO>(); } CourseDTO course = new CourseDTO { Name = textBoxName.Text, Code = textBoxCode.Text }; CourseInfoDTO info = new CourseInfoDTO { LaboratoryHours = Int32.Parse(textBoxLaboratories.Text), LectureHours = Int32.Parse(textBoxLectures.Text), PracticeHours = Int32.Parse(textBoxPractices.Text) }; StaffForm staffForm = new StaffForm(); if (staffForm.ShowDialog(this) == DialogResult.OK) { course.Staff = staffForm.StaffDb; } GroupForm groupForm = new GroupForm(); if (groupForm.ShowDialog(this) == DialogResult.OK) { info.Groups = groupForm.DbGroups; } course.Info = info; CourcesDb.Add(course); dataGridView.Rows.Add(); DataGridViewRow row = dataGridView.Rows[CourcesDb.Count - 1]; row.Cells[0].Value = course.Name; row.Cells[1].Value = course.Code; row.Cells[2].Value = course.Info.LectureHours; row.Cells[3].Value = course.Info.PracticeHours; row.Cells[4].Value = course.Info.LaboratoryHours; foreach (var it in course.Info.Groups) { ((DataGridViewComboBoxCell)row.Cells[5]).Items.Add(it); } buttonClean.Enabled = true; }
//purchase public static ItemPurchaseDataToken CourseInfoDTO2ItemPurchaseDataToken(this CourseInfoDTO token, PriceLineDTO priceToken) { return(new ItemPurchaseDataToken { ItemId = token.CourseId , ItemName = token.CourseName , Type = BillingEnums.ePurchaseItemTypes.COURSE , PriceToken = priceToken , Author = new UserBaseDTO { userId = token.Author.UserId , fullName = token.Author.FullName } }); }
public static ItemPurchaseCompleteToken CourseInfoDto2ItemPurchaseCompleteToken(this CourseInfoDTO token, PriceLineDTO priceToken, BaseUserInfoDTO buyer, decimal totalPrice) { return(new ItemPurchaseCompleteToken { ItemId = token.CourseId , ItemName = token.CourseName , ItemType = BillingEnums.ePurchaseItemTypes.COURSE , ThumbUrl = token.ThumbUrl , FinalPrice = totalPrice , PriceToken = priceToken , BuyerInfo = buyer , Author = new BaseUserInfoDTO { UserId = token.Author.UserId , FullName = token.Author.FullName } }); }