Beispiel #1
0
        public static MsCrmResultObject GetEducationInfo(Guid educationId, SqlDataAccess sda)
        {
            MsCrmResultObject returnValue = new MsCrmResultObject();

            try
            {
                #region | SQL QUERY |
                string query = @"SELECT
	                                E.new_educationId EducationId
	                                ,E.new_name Name
	                                ,E.new_summary Summary
	                                ,E.new_content [Description]
	                                ,E.new_imageurl [Image]
	                                ,CAST({2}.dbo.fn_UTCToTzSpecificLocalTime(E.CreatedOn, us.TimeZoneBias, us.TimeZoneDaylightBias,us.TimeZoneDaylightYear, us.TimeZoneDaylightMonth, us.TimeZoneDaylightDay, us.TimeZoneDaylightHour,us.TimeZoneDaylightMinute, us.TimeZoneDaylightSecond, 0, us.TimeZoneDaylightDayOfWeek,us.TimeZoneStandardBias, us.TimeZoneStandardYear, us.TimeZoneStandardMonth, us.TimeZoneStandardDay,us.TimeZoneStandardHour, us.TimeZoneStandardMinute, us.TimeZoneStandardSecond, 0,us.TimeZoneStandardDayOfWeek) as DATETIME) CreatedOn
                                FROM
	                                new_education E (NoLock)
                                INNER JOIN 
	                                dbo.UserSettingsBase US (NoLock)
	                                ON 
	                                US.SystemUserId ='{1}'
                                WHERE
	                                E.new_educationId = '{0}'"    ;
                #endregion

                DataTable dt = sda.getDataTable(string.Format(query, educationId, Globals.AdminId, Globals.DatabaseName));
                if (dt != null && dt.Rows.Count > 0)
                {
                    Education _education = new Education();
                    _education.EducationId     = (Guid)dt.Rows[0]["EducationId"];
                    _education.Name            = dt.Rows[0]["Name"].ToString();
                    _education.Summary         = dt.Rows[0]["Summary"].ToString();
                    _education.Description     = dt.Rows[0]["Description"].ToString();
                    _education.ImagePath       = dt.Rows[0]["Image"] != DBNull.Value ? dt.Rows[0]["Image"].ToString() : "no_image_available.png";
                    _education.CreatedOnString = dt.Rows[0]["CreatedOn"] != DBNull.Value ? ((DateTime)dt.Rows[0]["CreatedOn"]).ToString("dd MMMM yyyy ddddd HH:mm", new CultureInfo("tr-TR", false)) : string.Empty;

                    MsCrmResultObject resultLike = LikeHelper.GetEntityLikeInfo(_education.EducationId, "new_graffiti", sda);

                    if (resultLike.Success)
                    {
                        _education.LikeDetail = (LikeInfo)resultLike.ReturnObject;
                    }

                    #region | GET COMMENTS |
                    MsCrmResultObject commentResult = CommentHelper.GetEducationComments(educationId, sda);
                    if (commentResult.Success)
                    {
                        _education.CommentList = (List <Comment>)commentResult.ReturnObject;
                    }
                    #endregion

                    #region | GET ATTACHMENTS |
                    MsCrmResultObject attachmentResult = AttachmentFileHelper.GetEducationAttachmentFiles(educationId, sda);
                    if (attachmentResult.Success)
                    {
                        _education.AttachmentFileList = (List <AttachmentFile>)attachmentResult.ReturnObject;
                    }
                    #endregion

                    returnValue.Success      = true;
                    returnValue.ReturnObject = _education;
                }
                else
                {
                    returnValue.Success = true;
                    returnValue.Result  = "M017"; //"Eğitim kaydına ulaşılamadı.";
                }
            }
            catch (Exception ex)
            {
                returnValue.Success = false;
                returnValue.Result  = ex.Message;
            }

            return(returnValue);
        }