public OperationYearMonthProvider() { this.operationYearObj = new OperationYearObj(); this.operationMonthObj = new OperationMonthObj(); }
public int GetOperationMonth(Page page, ComboBox cmbMonth, HiddenField hfMonth, int applicantSendedMonth) { string CurrentLangID = string.Empty; string SysLangID = string.Empty; string Identifier = string.Empty; int currentMonth = 0; string pagePath = "~/DesktopModules/Atlas/" + HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1]; DateTime currentDateTime = DateTime.Now; CurrentLangID = this.LangProv.GetCurrentLanguage(); SysLangID = this.LangProv.GetCurrentSysLanguage(); switch (SysLangID) { case "en-US": switch (CurrentLangID) { case "en-US": Identifier = "ee"; break; case "fa-IR": Identifier = "ef"; break; } currentMonth = currentDateTime.Month; break; case "fa-IR": switch (CurrentLangID) { case "en-US": Identifier = "fe"; break; case "fa-IR": Identifier = "ff"; break; } PersianCalendar pCal = new PersianCalendar(); currentMonth = pCal.GetMonth(currentDateTime); break; } for (int i = 1; i <= 12; i++) { ComboBoxItem cmbItemMonth = new ComboBoxItem(HttpContext.GetLocalResourceObject(pagePath, "Month" + i + "" + Identifier + "").ToString()); cmbItemMonth.Value = i.ToString(); cmbMonth.Items.Add(cmbItemMonth); } if (applicantSendedMonth != 0) { this.operationMonthObj.Month = applicantSendedMonth; int indexItem = 0; for (int i = 0; i < cmbMonth.Items.Count; i++) { if (cmbMonth.Items[i].Value == applicantSendedMonth.ToString()) { indexItem = i; } } operationMonthObj.Index = indexItem; } else { if (HttpContext.Current.Session["CurrentOperationMonth"] == null) { this.operationMonthObj.Month = currentMonth; this.operationMonthObj.Index = currentMonth - 1; HttpContext.Current.Session.Add("CurrentOperationMonth", this.operationMonthObj); } this.operationMonthObj = (OperationMonthObj)HttpContext.Current.Session["CurrentOperationMonth"]; } hfMonth.Value = this.operationMonthObj.Month.ToString(); cmbMonth.SelectedIndex = this.operationMonthObj.Index; return(currentMonth); }