本文整理汇总了C#中Registration.AddRegistrationLine方法的典型用法代码示例。如果您正苦于以下问题:C# Registration.AddRegistrationLine方法的具体用法?C# Registration.AddRegistrationLine怎么用?C# Registration.AddRegistrationLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration.AddRegistrationLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRegistration
public Registration CreateRegistration(User curRegisteringUser)
{
string connection = ConfigurationManager.ConnectionStrings["EVENTSConnectionString"].ToString();
SqlConnection dbConnection = new SqlConnection(connection);
try
{
dbConnection.Open();
List<Conference> registeringConferences = new List<Conference>();
List<RegistrationLine> lineItemCourses = new List<RegistrationLine>();
HttpCookie testc = Request.Cookies["CoursesToRegisterFor"];
foreach (string course in Request.Cookies["CoursesToRegisterFor"].Values)
{
Course newCourse = new Course(course);
if (registeringConferences.ToString().Contains(((Request.Cookies["CoursesToRegisterFor"][course]))))
{
lineItemCourses.Add(new RegistrationLine(newCourse));
}
else
{
lineItemCourses.Add(new RegistrationLine(newCourse));
registeringConferences.Add(new Conference(Request.Cookies["CoursesToRegisterFor"][course]));
newCourse.getCourseInfo();
}
}
if (lineItemCourses.Count > 0)
{
Registration thisRegistration = new Registration(curRegisteringUser, lineItemCourses);
thisRegistration.CalculateCost();
SqlParameter RegisteringUserParam = new SqlParameter("@REGISTERING_USER", System.Data.SqlDbType.NVarChar, 50);
RegisteringUserParam.Value = thisRegistration.RegisteringUser.Email;
SqlParameter CostParam = new SqlParameter("@REGISTRATION_COST", System.Data.SqlDbType.Int);
CostParam.Value = thisRegistration.Cost;
SqlParameter registrationID = new SqlParameter("REGISTRATION_ID", System.Data.SqlDbType.Int);
//parameter value can be set server side and will be returned to client
registrationID.Direction = System.Data.ParameterDirection.Output;
SqlCommand createRegistration = new SqlCommand("CREATE_REGISTRATION", dbConnection);
List<SqlParameter> CreateRegistrationParameters =
new List<SqlParameter> { RegisteringUserParam, CostParam, registrationID };
createRegistration.CommandType = System.Data.CommandType.StoredProcedure;
createRegistration.Parameters.AddRange(CreateRegistrationParameters.ToArray());
createRegistration.ExecuteNonQuery();
thisRegistration.RegistrationID = createRegistration.Parameters["REGISTRATION_ID"].Value.ToString();
thisRegistration.AddRegistrationLine();
dbConnection.Close();
return thisRegistration;
}
else
return new Registration("");
}
catch (SqlException exception)
{
Response.Write("<p> Error Code " + exception.Number + ": " + exception.Message + "</p>");
return new Registration("");
}
}