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 virtual string ProjectCompleteSignUrl(string appName) { appName = appName == "" ? "" : "/" + appName; return(string.Format("<a class='link' href='{0}/Government/ProjectSignSummary?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); }
public virtual string ProjectUnRiskUrl(string appName) { appName = appName == "" ? "" : "/" + appName; switch (this.StatusCategory) { case StatusCategory.UnRisk: return(string.Format("<a class='link' href='{0}/Government/ProjectSummary?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); default: return("unLink"); } }
public virtual string ProjectIncompleteUrl(string appName) { appName = appName == "" ? "" : "/" + appName; switch (this.Status) { case Status.SaveDeail: return(string.Format("<a class='link' href='{0}/Government/ProjectFilter?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); case Status.SaveFilter: return(string.Format("<a class='link' href='{0}/Government/ProjectBasicInfo?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); case Status.SaveBasicInfo: return(string.Format("<a class='link' href='{0}/Government/ProjectCategory?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); case Status.SaveCategory: return(string.Format("<a class='link' href='{0}/Government/ProjectType?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); case Status.SaveType: case Status.SaveAnswerSetA1: case Status.SaveAnswerSetA2: case Status.SaveAnswerSetB1: case Status.SaveAnswerSetB2: case Status.SaveAnswerSetB3: case Status.SaveAnswerSetB4: case Status.SaveAnswerSetB5: case Status.SaveAnswerSetB6: case Status.SaveAnswerSetC1: case Status.SaveAnswerSetD1: case Status.SaveAnswerSetD2: case Status.SaveAnswerSetD3: case Status.SaveAnswerSetD4: case Status.SaveAnswerSetD5: case Status.SaveAnswerSetD6: case Status.SaveAnswerSetE1: case Status.SaveAnswerSetR1: case Status.SaveAnswerSetR2: case Status.SaveAnswerSetR3: case Status.SaveAnswerSetR4: case Status.SaveAnswerSetR5: return(string.Format("<a class='link' href='{0}/Government/QuestionChoice?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); case Status.SaveAnswerSetR6: return(string.Format("<a class='link' href='{0}/Government/ProjectSummary?p={1}'>{2}</a>", appName, MapCipher.Encrypt(HttpUtility.UrlEncode(this.ID.ToString())), this.Name)); default: return("unLink"); } }
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)); }