예제 #1
0
 public void RemoveAppointment(Appointment appointmentToRemove)
 {
     _currentSchedule.RemoveAppointment(appointmentToRemove);
 }
예제 #2
0
        public IResult AddAppointment()
        {
            var appointment = new Appointment {Time = _settings.EarliestAppointment};
            _currentSchedule.AddAppointment(appointment);

            if(_contacts.Count > 0)
            {
                appointment.AllContacts = _contacts;
                return null;
            }

            return new WebServiceResult<ContactServiceClient, GetAllContactsCompletedEventArgs>(
                x => x.GetAllContactsAsync(),
                x =>{
                    x.Result.Apply(dto => _contacts.Add(Map.ToContact(dto)));
                    _contacts.Apply(appointment.AllContacts.Add);
                });
        }
예제 #3
0
 /// <summary>
 /// 往实体集合中添加记录
 /// </summary>
 /// <param name="list">实体列表</param>
 /// <param name="dt">表</param>
 private void LoadListData(ref IList<Model.Appointment > list, DataTable dt)
 {
     if (dt.Rows.Count > 0)
     {
         Model.Appointment  model;
         foreach (DataRow dr in dt.Rows)
         {
             model = new Model.Appointment ();
             LoadEntityData(ref model, dr);
             list.Add(model);
         }
     }
 }
예제 #4
0
 /// <summary>
 /// 获得单个实体对象
 /// </summary>
 /// <param name="whereStr">关键字</param>
 /// <returns>实体对象</returns>
 public Model.Appointment SelectModel(string whereStr)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"select [Id],[JK_Appointment_Number],[JK_Appointment_Member_id],[JK_Appointment_Datetime],[JK_DateTime],[JK_Appointment_Context],[JK_Appointment_Phone],[JK_pointOfDeparture],[JK_Price] from [Appointment] ");
     if (whereStr.Trim() != "")
     {
         strSql.Append(@" where " + whereStr);
     }
     Model.Appointment model = new Model.Appointment();
     DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString());
     if (dt.Rows.Count > 0)
     {
         LoadEntityData(ref model, dt.Rows[0]);
         return model;
     }
     else
     {
         return null;
     }
 }
예제 #5
0
 /// <summary>
 /// 获得单个实体对象
 /// </summary>
 /// <param name="id">关键字</param>
 /// <returns>实体对象</returns>
 public Model.Appointment SelectModel(int id)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"select [Id],[JK_Appointment_Number],[JK_Appointment_Member_id],[JK_Appointment_Datetime],[JK_DateTime],[JK_Appointment_Context],[JK_Appointment_Phone],[JK_pointOfDeparture],[JK_Price] from [Appointment] ");
     strSql.Append(@" where [Id]=@id ");
     SqlParameter[] parameters = {
             new SqlParameter("@id", SqlDbType.Int,4)};
     parameters[0].Value = id;
     Model.Appointment model = new Model.Appointment();
     DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString(), parameters);
     if (dt.Rows.Count > 0)
     {
         LoadEntityData(ref model, dt.Rows[0]);
         return model;
     }
     else
     {
         return null;
     }
 }
예제 #6
0
        /// <summary>
        /// 根据条件查询实体记录
        /// </summary>
        /// <param name="whereStr">查询条件</param>
        /// <returns>实体记录</returns>
        public IList<Model.Appointment> SelectList(int top,string whereStr)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select ");
            if(top>0)
            {
               strSql.Append(" top "+top);
            }
            strSql.Append(" [Id],[JK_Appointment_Number],[JK_Appointment_Member_id],[JK_Appointment_Datetime],[JK_DateTime],[JK_Appointment_Context],[JK_Appointment_Phone],[JK_pointOfDeparture],[JK_Price] from [Appointment] ");
            if (whereStr.Trim() != "")
            {
                strSql.Append(@" where " + whereStr);
            }
            DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString());
            List<Model.Appointment > list = null;
            if (dt.Rows.Count > 0)
            {
                list = new List<Model.Appointment >();
                Model.Appointment  model = null;

                foreach (DataRow dr in dt.Rows)
                {
                    model = new Model.Appointment ();
                    LoadEntityData(ref model, dr);
                    list.Add(model);
                }
            }
            return list;
        }