public ProfessionalSchedule(IDataReader dbReader,string type)
            : this()
        {
            kendo = new KendoEntity();
            try
            {
                if (dbReader.HasColumn("OwnerID") && dbReader["OwnerID"] != DBNull.Value)
                    kendo.OwnerID = dbReader["OwnerID"].ToString();

                if (dbReader.HasColumn("IsAllday") && dbReader["IsAllday"] != DBNull.Value)
                    kendo.IsAllDay = false;

                if (dbReader.HasColumn("Title") && dbReader["Title"] != DBNull.Value)
                    kendo.Title = dbReader["Title"].ToString();

                if (dbReader.HasColumn("Description") && dbReader["Description"] != DBNull.Value)
                    kendo.Description = dbReader["Description"].ToString();

                if (dbReader.HasColumn("Start") && dbReader["Start"] != DBNull.Value)
                    kendo.Start = dbReader["Start"].ToString();

                if (dbReader.HasColumn("End") && dbReader["End"] != DBNull.Value)
                    kendo.End = dbReader["End"].ToString();

                if (dbReader.HasColumn("TaskId") && dbReader["TaskId"] != DBNull.Value)
                    kendo.TaskID = dbReader["TaskId"].ToString();
            }
            catch (Exception ex)
            {
                string exc = ex.Message;
            }
        }
        public bool AddProfessionalSchedule(KendoEntity professionalSchedule)
        {
            using (var conn = new SqlConnection(PrescienceRxConnectionString))
            {
                conn.Open();

                using (var cmd = new SqlCommand(AddProfessionalScheduleSp, conn))
                {
                    //ToDo  : Fix this method

                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                    professionalSchedule.Start = TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(professionalSchedule.Start).ToUniversalTime(), easternZone).ToString();
                    professionalSchedule.End=TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(professionalSchedule.End).ToUniversalTime(),easternZone).ToString();
                    cmd.Parameters.Add("@ProfessionalId", SqlDbType.Int).Value = professionalSchedule.ProfessionalId;
                    cmd.Parameters.Add("@CustomerId", SqlDbType.Int).Value = professionalSchedule.OwnerID;
                    cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = professionalSchedule.Title;
                    cmd.Parameters.Add("@StartTime", SqlDbType.DateTime).Value = professionalSchedule.Start;
                    cmd.Parameters.Add("@EndTime", SqlDbType.DateTime).Value = professionalSchedule.End;
                    cmd.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = professionalSchedule.Description;
                    cmd.Parameters.Add("@CreatedBy ", SqlDbType.NVarChar).Value = professionalSchedule.UserId;
                    cmd.Parameters.Add("@DateCreated", SqlDbType.NVarChar).Value = DateTime.UtcNow;

                //TODO: Add this back, these parms missing from sp
                    //cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar).Value = professionalSchedule.CreatedBy;
                    //cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = DateTime.UtcNow;

                    return Convert.ToBoolean(cmd.ExecuteScalar());

                }
            }
        }
Beispiel #3
0
        public ProfessionalSchedule(IDataReader dbReader, string type)
            : this()
        {
            kendo = new KendoEntity();
            try
            {
                if (dbReader.HasColumn("OwnerID") && dbReader["OwnerID"] != DBNull.Value)
                {
                    kendo.OwnerID = dbReader["OwnerID"].ToString();
                }

                if (dbReader.HasColumn("IsAllday") && dbReader["IsAllday"] != DBNull.Value)
                {
                    kendo.IsAllDay = false;
                }

                if (dbReader.HasColumn("Title") && dbReader["Title"] != DBNull.Value)
                {
                    kendo.Title = dbReader["Title"].ToString();
                }

                if (dbReader.HasColumn("Description") && dbReader["Description"] != DBNull.Value)
                {
                    kendo.Description = dbReader["Description"].ToString();
                }

                if (dbReader.HasColumn("Start") && dbReader["Start"] != DBNull.Value)
                {
                    kendo.Start = dbReader["Start"].ToString();
                }

                if (dbReader.HasColumn("End") && dbReader["End"] != DBNull.Value)
                {
                    kendo.End = dbReader["End"].ToString();
                }

                if (dbReader.HasColumn("TaskId") && dbReader["TaskId"] != DBNull.Value)
                {
                    kendo.TaskID = dbReader["TaskId"].ToString();
                }
            }
            catch (Exception ex)
            {
                string exc = ex.Message;
            }
        }