protected void Page_Load(object sender, EventArgs e) { MyAddInit(); if (!IsPostBack) { T_Question_MDL questionMDL = questionBLL.GetModel(ConvertEx.ToInt(ID)); if (questionMDL != null) { ltCreateUserName.Text = questionMDL.CreateUserName; ltCreateDate.Text = ConvertEx.ToDate(questionMDL.CreateDate).ToString("yyyy-MM-dd"); ltTitle.Text = questionMDL.Title; ltDescriptionHtml.Text = questionMDL.DescriptionHtml; ltClickCount.Text = questionMDL.ClickCount.ToString(); List <T_SystemInfo_MDL> ltSysMDL = new T_SystemInfo_BLL().GetModelListForCurrentType("QuestionType", "'" + questionMDL.QuestionTypeCode + "'"); if (ltSysMDL != null && ltSysMDL.Count > 0) { ltQuestionTypeTitle.Text = ltSysMDL[0].SystemInfoName; } questionMDL.ClickCount += 1; questionBLL.Update(questionMDL); } } }
public string AddQuestion(string action, int questionID, string questionType, string title, string description, string descriptionHtml) { try { if (action == CommonEnum.PageState.ADD.ToString().ToLower()) { T_Question_MDL questionMDL = new T_Question_MDL(); questionMDL.Title = title; questionMDL.QuestionTypeCode = questionType; questionMDL.Description = description; questionMDL.DescriptionHtml = descriptionHtml; questionMDL.CreateDate = DateTime.Now; questionMDL.CreateUserName = Common.Session.GetSession("UserName"); questionMDL.CreateUserID = Common.Session.GetSessionInt("UserID"); questionMDL.ClickCount = 0; questionBLL.Add(questionMDL); } else if (action == CommonEnum.PageState.EDIT.ToString().ToLower()) { T_Question_MDL questionMDL = questionBLL.GetModel(questionID); if (questionMDL != null) { questionMDL.Title = title; questionMDL.QuestionTypeCode = questionType; questionMDL.Description = description; questionMDL.DescriptionHtml = descriptionHtml; questionBLL.Update(questionMDL); } } return(SystemSet._RETURN_SUCCESS_VALUE); } catch (Exception ex) { return(SystemSet._RETURN_FAILURE_VALUE + ex.Message); } }