public void TestMethod1() { string p1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; string de = MapCipher.Decrypt(p1); string en = MapCipher.Encrypt(de); Assert.AreEqual(p1, en); }
public ActionResult ProjectBasicInfo(string p) { string projectId = MapCipher.Decrypt(HttpUtility.HtmlDecode(p)); Project project = null; if (string.IsNullOrEmpty(projectId)) { SessionContext.Log(0, this.PageID, 0, MessageException.ProjectMessage.GetBasicInfo, MessageException.Null("The project id is emptry.")); ViewBag.ErrorMessage = MessageException.Error; } try { project = SessionContext.PersistenceSession.Get <Project>(long.Parse(projectId)); } catch (Exception ex) { SessionContext.LogButNotFlush(0, this.PageID, 0, MessageException.ProjectMessage.GetBasicInfo, MessageException.Fail(ex.Message)); ViewBag.ErrorMessage = MessageException.Error; } return(View(project)); }
public ActionResult ProjectDetail(string p) { string projectId = MapCipher.Decrypt(HttpUtility.HtmlDecode(p)); Project project = null; if (string.IsNullOrEmpty(projectId)) { SessionContext.Log(0, this.PageID, 0, MessageException.ProjectMessage.GetDetail, MessageException.Null("The project id is emptry.")); ViewBag.ErrorMessage = MessageException.Error; } try { project = SessionContext.PersistenceSession.Get <Project>(long.Parse(projectId)); //ข้อมูลโครงการ ViewBag.MinistryCode = SessionContext.User.Organization.Code; ViewBag.MinistryName = SessionContext.User.Organization.CurrentName.Name.GetValue(SessionContext.CurrentLanguage.Code); ViewBag.DepartmentCode = SessionContext.User.OrgUnit.Code; ViewBag.DepartmentName = SessionContext.User.OrgUnit.CurrentName.Name.GetValue(SessionContext.CurrentLanguage.Code); //รหัสโครงการ ระบบจะต้องสร้างให้ ViewBag.ProjectCode = project.ProjectNo; //ยุทธศาสตร์การจัดสรรงบประมาณ query effective only ViewBag.Strategics = Strategic.GetEffectives(SessionContext) .Select(x => new SelectListItem { Text = x.Name, Value = x.ID.ToString(), Selected = x.ID == project.Strategic.ID }); //ปีงบประมาณ IList <SelectListItem> datetimes = new List <SelectListItem>(); for (int i = 2558; i < (DateTime.Now.Year + 543) + 5; i++) { datetimes.Add(new SelectListItem { Text = i.ToString(), Value = i.ToString(), Selected = project.BudgetYear == i.ToString() }); } ViewBag.Year = datetimes; //งบรายจ่ายประเภท List <SelectListItem> budgetTypes = new List <SelectListItem>(); budgetTypes.Add(new SelectListItem { Text = Project.BudgetTypeString(BudgetType.Action), Value = ((int)BudgetType.Action).ToString(), Selected = project.BudgetType == BudgetType.Action }); budgetTypes.Add(new SelectListItem { Text = Project.BudgetTypeString(BudgetType.Investment), Value = ((int)BudgetType.Investment).ToString(), Selected = project.BudgetType == BudgetType.Investment }); budgetTypes.Add(new SelectListItem { Text = Project.BudgetTypeString(BudgetType.Contribute), Value = ((int)BudgetType.Contribute).ToString(), Selected = project.BudgetType == BudgetType.Contribute }); budgetTypes.Add(new SelectListItem { Text = Project.BudgetTypeString(BudgetType.OtherExpenses), Value = ((int)BudgetType.OtherExpenses).ToString(), Selected = project.BudgetType == BudgetType.OtherExpenses }); ViewBag.Expenditure = budgetTypes; } catch (Exception ex) { SessionContext.LogButNotFlush(0, this.PageID, 0, MessageException.ProjectMessage.GetDetail, MessageException.Fail(ex.Message)); ViewBag.ErrorMessage = MessageException.Error; } return(View(project)); }