public static Certification CreateCertification(CertificationTypes certificationType, DCAnalyticsObject parent) { Certification certification = null; switch (certificationType) { case CertificationTypes.FairTrade: certification = new FairTrade(parent); break; case CertificationTypes.Organic: certification = new Organic(parent); break; case CertificationTypes.UTZ: certification = new UTZ(parent); break; } return(certification); }
private void AddMore() { EnumList prices = _configuration.EnumerationLists.Add(); prices.Name = "Prices"; EnumListValue val = prices.EnumValues.Add(); val.Code = 2000; val.Description = "Coffee"; val = prices.EnumValues.Add(); val.Code = 2000; val.Description = "Cotton"; val = prices.EnumValues.Add(); val.Code = 2000; val.Description = "Vanilla"; //Certifications FairTrade fairTrade = _configuration.Certifications.Add(CertificationTypes.FairTrade) as FairTrade; fairTrade.Farmer = new Questionaire(null); fairTrade.Name = "fairTrade"; Section section = fairTrade.Sections.Add(); section.Name = "Section1"; SubSection sb2 = section.SubSections.Add(); sb2.Name = "SubSection1"; var openQuestion1 = sb2.Questions.AddOpenQuestion(); openQuestion1.QuestionText = "Where do you stay"; openQuestion1.Name = "Residence"; var openQuestion = section.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; openQuestion = fairTrade.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; //organic Organic organic = _configuration.Certifications.Add(CertificationTypes.Organic) as Organic; organic.Farmer = new Questionaire(null); fairTrade.Name = "fairTrade"; section = fairTrade.Sections.Add(); organic.Name = "Section1"; SubSection sb1 = section.SubSections.Add(); sb1.Name = "SubSection1"; openQuestion = sb1.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; openQuestion = section.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; openQuestion = organic.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; // UTZ utz = _configuration.Certifications.Add(CertificationTypes.UTZ) as UTZ; utz.Farmer = new Questionaire(null); utz.Name = "fairTrade"; section = utz.Sections.Add(); organic.Name = "Section1"; SubSection sb = section.SubSections.Add(); sb.Name = "SubSection1"; openQuestion = sb.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; openQuestion = section.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; openQuestion = utz.Questions.AddOpenQuestion(); openQuestion.QuestionText = "Where do you stay"; openQuestion.Name = "Residence"; //Trainings Training training = _configuration.Trainings.Add(); training.Name = "Training1"; training.StartDate = DateTime.Now; training.EndDate = DateTime.Now; //trainees var tra = training.Trainees.Add(); tra.Name = "Nana"; var topic = training.Topics.Add(); topic.Name = "Topic1"; var trainer = training.Trainers.Add(); trainer.Name = "Kato"; //Purchases Purchase purchase = _configuration.Purchases.Add(); purchase.DateOfPurchase = DateTime.Now; purchase.Quantity = 50; purchase.Prices = _configuration.EnumerationLists.ByName("Prices"); purchase.ProductPrice = purchase.Prices.EnumValues.ByDescription("Coffee"); purchase.Lotid = "Lot90343"; purchase.Products = _configuration.EnumerationLists.ByName("Products"); purchase.Product = purchase.Products.EnumValues.ByDescription("Coffee"); purchase.Farmer = new Questionaire(null); Questionaire questionaire = _configuration.Questionaires[0]; Section section_o = questionaire.Sections[0]; OpenQuestion question = section_o.Questions.AddOpenQuestion(); question.QuestionText = "What's your name"; question.Name = "Name"; Dependency dependency = question.Dependencies.Add(); dependency.Target = questionaire.Sections[1]; //inspection FieldInspection inspection = _configuration.Inspections.Add(); inspection.FieldName = "Kasese 1"; var fieldSection = inspection.Sections.Add(); fieldSection.Name = "Field Section"; var qn = fieldSection.Questions.Add(QuestionTypes.Open); qn.QuestionText = "Whats your name?"; inspection.Farmer = _configuration.Questionaires[0]; inspection.Coordinates.Add("Lat:78834;Long:459"); //adding clients _configuration.Client.Contact = "0775407583"; _configuration.Client.CreatedBy = "Admin"; _configuration.Client.Email = "*****@*****.**"; _configuration.Client.Name = "Kakembo"; User user = _configuration.Client.Users.Add(UserTypes.ClientUser); user.UserName = "******"; user.Password = "******"; user.Email = "*****@*****.**"; user.Firstname = "Nanana"; user.IsAdmin = true; user.Lastname = "Nanana"; user.Usercode = "N009"; }