private void Doselect() { EmpVoiceAskQuestion ent = null; if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = EmpVoiceAskQuestion.Find(id); } this.SetFormData(ent); } else { var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID); //公司与部门 string SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName from sysuser As A left join sysgroup As B on A.pk_corp=B.groupID left join sysgroup As C on C.GroupID=A.pk_deptdoc where A.UserID='{0}'"; SQL = string.Format(SQL, UserInfo.UserID); DataTable Dt1 = DataHelper.QueryDataTable(SQL); string CompanyName = string.Empty, CompanyId = string.Empty; string DeptName = string.Empty, DeptId = string.Empty; if (Dt1.Rows.Count > 0) { CompanyName = Dt1.Rows[0]["CompanyName"].ToString(); CompanyId = Dt1.Rows[0]["CompanyId"].ToString(); DeptId = Dt1.Rows[0]["DeptId"].ToString(); DeptName = Dt1.Rows[0]["DeptName"].ToString(); } if (Ent != null) { var Obj = new { UserId = Ent.UserID, UserName = Ent.Name, Sex = Ent.Sex, Age = Ent.Wage, WorkNo = Ent.WorkNo, IndutyData = Ent.Indutydate, CorpName = CompanyName, CorpId = CompanyId, DeptId = DeptId, DeptName = DeptName, }; this.SetFormData(Obj); } } this.PageState.Add("QuestionEnum", SysEnumeration.GetEnumDict("QuestionType")); }
private void DoCreate() { string Anonymity = RequestData.Get("Anonymity") + ""; string Answer = RequestData.Get("Answer") + ""; string QuestionId = RequestData.Get("QuestionId") + ""; var QEnt = EmpVoiceAskQuestion.Find(QuestionId); if (QEnt != null) { QEnt.AnswerCount = QEnt.AnswerCount.GetValueOrDefault() + 1; QEnt.DoUpdate(); } ent = this.GetPostedData <EmpVoiceAnswerInfo>(); ent.Anonymity = Anonymity; ent.DoCreate(); }