Ejemplo n.º 1
0
 public static Event CreateEvent(Proposal proposal)
 {
     Event e = new Event();
     e.CreatorId = proposal.CreatorId;
     e.ProposalId = proposal.Id;
     e.CreateTime = DateTime.Now;
     e.GuestLimit = GetEventCapacity(proposal.Content);
     e.HostOrg = GetHostOrg(proposal.Content);
     e.HostName = GetContactName(proposal.Content);
     e.HostEmail = GetContactEmail(proposal.Content);
     e.HostPhone = GetContactPhone(proposal.Content);
     e.EventName = GetEventName(proposal.Content);
     e.StartTime = GetEventStartTime(proposal.Content);
     e.EndTime = GetEventEndTime(proposal.Content);
     e.RegDeadline = GetRegDeadline(proposal.Content);
     e.Location = GetEventLocation(proposal.Content);
     e.Descr = GetEventDesc(proposal.Content);
     e.MeetLocation = GetMeetingLocation(proposal.Content);
     e.MeetTime = GetMeetingTime(proposal.Content);
     e.Transportation = GetTrasportation(proposal.Content);
     e.RequestDrivers = GetRequestDrivers(proposal.Content);
     e.Costs = GetCost(proposal.Content);
     e.Equipment = GetEquipment(proposal.Content);
     e.Food = GetFood(proposal.Content);
     e.Other = GetOther(proposal.Content);
     return e;
 }
Ejemplo n.º 2
0
 //public void Save()
 //{
 //    string queryStr = "UPDATE Proposals SET createTime=@time, creatorId=@creator " +
 //        "title=@title, content=@content, approved=@app, declined=@dec " +
 //        "WHERE proposalId=@proposalId";
 //    using (SqlConnection con = new SqlConnection(Config.SqlConStr))
 //    {
 //        SqlCommand command = new SqlCommand(queryStr, con);
 //        command.Parameters.Add(new SqlParameter("proposalId", Id));
 //        command.Parameters.Add(new SqlParameter("time", CreateTime));
 //        command.Parameters.Add(new SqlParameter("creator", CreatorId));
 //        command.Parameters.Add(new SqlParameter("title", Title));
 //        command.Parameters.Add(new SqlParameter("content", Content));
 //        command.Parameters.Add(new SqlParameter("app", Approved));
 //        command.Parameters.Add(new SqlParameter("dec", Declined));
 //        con.Open();
 //        command.ExecuteNonQuery();
 //    }
 //}
 public static void ValidateFields(Proposal proposal)
 {
     if (string.IsNullOrEmpty(proposal.Title))
         throw new ApplicationException("Proposal title is null or empty.");
     if (string.IsNullOrEmpty(proposal.Content))
         throw new ApplicationException("Proposal content is null or empty.");
 }