private void attach_tblContestForUniversities(tblContestForUniversity entity) { this.SendPropertyChanging(); entity.tblUser = this; }
private void detach_tblContestForUniversities1(tblContestForUniversity entity) { this.SendPropertyChanging(); entity.tblUser1 = null; }
partial void UpdatetblContestForUniversity(tblContestForUniversity instance);
partial void DeletetblContestForUniversity(tblContestForUniversity instance);
partial void InserttblContestForUniversity(tblContestForUniversity instance);
/// <summary> /// build exam lesson for university /// </summary> /// <param name="item"></param> /// <returns></returns> private string buildExamLessonForUniversity(tblContestForUniversity item) { string res = CommonConstants.BLANK; try { BaseServices bs = new BaseServices(); res += " <div class='block_details'>\n" + " <div class='block_details_img'>\n" + " <span title='" + item.Title.Trim() + "'>" + BaseServices.createMsgByTemplate(CommonConstants.TEMP_IMG_THUMBNAIL, bs.getThumbnail(item.Thumbnail, item.Location), item.Title.Trim()) + "</span>\n" + " </div>\n" + " <div class='block_details_title'>\n" + " <span title='" + item.Title.Trim() + "'>" + BaseServices.createMsgByTemplate(CommonConstants.TEMP_ARTICLE_DETAILS_LINK, CommonConstants.SEC_UNIVERSITY_CODE, item.ID.ToString(), bs.subString(item.Title)) + "</span>\n" + " </div>\n" + " <div class='block_details_text'>\n" + " " + BaseServices.getNameSubjectByCode(item.Subject.Trim()) + "<br />\n" + contestDAO.getBranch(item.ID) + "<br/>\n" + item.Year + " </div>\n" + " </div>\n"; } catch (Exception ex) { log.writeLog(Server.MapPath(CommonConstants.PATH_LOG_FILE), ex.Message + CommonConstants.NEWLINE + ex.Source + CommonConstants.NEWLINE + ex.StackTrace + CommonConstants.NEWLINE + ex.HelpLink); Session[CommonConstants.SES_ERROR] = CommonConstants.MSG_E_COMMON_ERROR_TEXT; Response.Redirect(CommonConstants.PAGE_ERROR); } return res; }
/// <summary> /// Thêm một đề thi /// </summary> /// <param name="_title"></param> /// <param name="_content"></param> /// <param name="_author"></param> /// <param name="_posted"></param> /// <param name="_isUniversity"></param> /// <param name="_branch"></param> /// <param name="_year"></param> /// <param name="_location"></param> /// <returns></returns> public Boolean insertContest(string _title, string _content, string _author, DateTime _posted, Boolean _isUniversity, string _sub, int _year, string _location, string _tag, string fileSolved, string _folderID) { LTDHDataContext DB = new LTDHDataContext(@strPathDB); try { using (TransactionScope ts = new TransactionScope()) { tblContestForUniversity record = new tblContestForUniversity(); record.Title = _title; record.Contents = _content; record.Author = _author; record.Posted = _posted; record.State = CommonConstants.STATE_UNCHECK;//Chưa duyệt record.isUniversity = _isUniversity; record.Subject = _sub; record.Year = _year; record.Point = 0;//điểm = số người view record.Location = _location; record.Tag = _tag; record.StickyFlg = false; record.Score = 0;//điểm của checker record.Solving = fileSolved; record.FolderID = _folderID; DB.tblContestForUniversities.InsertOnSubmit(record); DB.SubmitChanges(); ts.Complete(); ltktDAO.Statistics statisticDAO = new ltktDAO.Statistics(); statisticDAO.add(CommonConstants.SF_NUM_UPLOAD, CommonConstants.CONST_ONE); log.writeLog(DBHelper.strPathLogFile, _author, BaseServices.createMsgByTemplate(CommonConstants.SQL_INSERT_SUCCESSFUL_TEMPLATE, record.ID.ToString(), CommonConstants.SQL_TABLE_CONTEST_UNIVERSITY)); } } catch (Exception e) { log.writeLog(DBHelper.strPathLogFile, _author, e.Message + CommonConstants.NEWLINE + e.Source + CommonConstants.NEWLINE + e.StackTrace + CommonConstants.NEWLINE + e.HelpLink); return false; } return true; }
/// <summary> /// Thêm một đề thi /// </summary> /// <param name="record"></param> /// <returns></returns> public Boolean insertContest(tblContestForUniversity record, string _username) { LTDHDataContext DB = new LTDHDataContext(@strPathDB); try { using (TransactionScope ts = new TransactionScope()) { DB.tblContestForUniversities.InsertOnSubmit(record); DB.SubmitChanges(); ts.Complete(); log.writeLog(DBHelper.strPathLogFile, _username, BaseServices.createMsgByTemplate(CommonConstants.SQL_INSERT_SUCCESSFUL_TEMPLATE, record.ID.ToString(), CommonConstants.SQL_TABLE_CONTEST_UNIVERSITY)); } } catch (Exception e) { log.writeLog(DBHelper.strPathLogFile, _username, e.Message + CommonConstants.NEWLINE + e.Source + CommonConstants.NEWLINE + e.StackTrace + CommonConstants.NEWLINE + e.HelpLink); return false; } return true; }
/// <summary> /// Cập nhật đề thi /// </summary> /// <param name="ID"></param> /// <param name="update"></param> /// <returns></returns> public Boolean updateContest(int _id, tblContestForUniversity update, string _username) { LTDHDataContext DB = new LTDHDataContext(@strPathDB); try { using (TransactionScope ts = new TransactionScope()) { var contest = DB.tblContestForUniversities.Single(cont => cont.ID == _id); contest.Title = update.Title; contest.Contents = update.Contents; contest.Author = update.Author; contest.Posted = update.Posted; contest.State = update.State; contest.isUniversity = update.isUniversity; contest.Branch = update.Branch; contest.Year = update.Year; contest.Solving = update.Solving; contest.Point = update.Point; contest.Tag = update.Tag; contest.StickyFlg = update.StickyFlg; contest.Score = update.Score; contest.HtmlEmbedLink = update.HtmlEmbedLink; contest.HtmlPreview = update.HtmlPreview; contest.Location = update.Location; DB.SubmitChanges(); ts.Complete(); log.writeLog(DBHelper.strPathLogFile, _username, BaseServices.createMsgByTemplate(CommonConstants.SQL_UPDATE_SUCCESSFUL_TEMPLATE, contest.ID.ToString(), CommonConstants.SQL_TABLE_CONTEST_UNIVERSITY)); } } catch (Exception e) { log.writeLog(DBHelper.strPathLogFile, _username, e.Message + CommonConstants.NEWLINE + e.Source + CommonConstants.NEWLINE + e.StackTrace + CommonConstants.NEWLINE + e.HelpLink); return false; } return true; }