public GetMonthName ( int month ) : string | ||
month | int | An integer from 1 through 13 representing the name of the month to retrieve. |
Результат | string |
protected void Page_Load(object sender, EventArgs e) { objCommonMIS.BusinessLine_Sno = "2"; objCommonMIS.EmpId = Membership.GetUser().UserName.ToString(); if (!Page.IsPostBack) { objCommonMIS.GetAllRegions(ddlRegion); objCommonMIS.RegionSno = "0"; objCommonMIS.BranchSno = "0"; objCommonMIS.GetUserProductDivisions(ddlProductDivision); // Bhawesh added 1 March 13 for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--) { DDlYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { DDLMonth1.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); DDLMonth2.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); } DDLMonth1.Items.Insert(0, new ListItem("Select", "0")); DDLMonth2.Items.Insert(0, new ListItem("Select", "0")); ddlRegion.Items[0].Text = "Select"; ddlProductDivision.Items[0].Text = "Select"; } }
DataTable GetMainTable(string year) { DataTable table = new DataTable(); table.Columns.Add("Year"); table.Columns.Add("MonthNo"); table.Columns.Add("MonthName"); for (int day = 1; day <= 31; day++) { table.Columns.Add(day.ToString()); } DateTime dt = new DateTime(); for (int month = 1; month <= 12; month++) { DataRow row = table.NewRow(); row["Year"] = year; row["MonthNo"] = month; System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); row["MonthName"] = mfi.GetMonthName(month).ToString(); table.Rows.Add(row); } return(table); }
private void Analysbtn_Click(object sender, EventArgs e) { //we check the input number and if the number length = 14 will move to next step if (IDTB.Text.Length == 14) { //create object from DTFI to get month name DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); //create object from IDAnalyst which contains all of process IDAnalyst id = new IDAnalyst(); //convert id number from string in textBox to long long num = long.Parse(IDTB.Text); //set DateTimePicker "Date" to Date input to extract name of the day and month DTP.Value = new DateTime(int.Parse(id.GetBirthYear(num)), int.Parse(id.GetBirthMonth(num)), int.Parse(id.GetBirthDay(num))); //assign value of Day TextBox to day from IDAnalyst class and get a day from DateTimePicker Daytb.Text = id.GetBirthDay(num)+" : "+DTP.Value.DayOfWeek.ToString(); //Get Month and using DTFI to get month name which we get from DateTimePicker Montb.Text = id.GetBirthMonth(num)+" : "+dtfi.GetMonthName(DTP.Value.Month); //Get Month Year Yeartb.Text = id.GetBirthYear(num); //Get Sex Sextb.Text = id.Sex(num); //Get Get Province Name provtb.Text = id.GetProvince(num); //Get Child number cid.Text = id.NumOfChild(num).ToString(); } }
public static void Main() { Console.WriteLine("Start date, Start time, End date, End time, subject, detail,All Day Event"); int year = DateTime.Now.Year; for (int ycount = 0; ycount < 6; ycount++) { for (int month = 1; month < 13; month++) { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(month).ToString(); //Console.WriteLine(strMonthName); int MaxDays = DateTime.DaysInMonth(year + ycount, month); for (int day = 1; day <= MaxDays; day++) { CheckPlaindromeDate(ycount + year, month, day, 0, 0, 0, "yyyy-MM-dd", "Palindrome whole day"); CheckPlaindromeDate(ycount + year, month, day, 0, 0, 0, "yy-MM-dd", "Palindrome whole day without decade"); for (int hour = 0; hour < 24; hour++) { for (int minute = 0; minute < 60; minute++) { CheckPlaindromeDate(ycount + year, month, day, hour, minute, 0, "yyyy-MM-dd hh:mm", "Palindrome day with time"); CheckPlaindromeDate(ycount + year, month, day, hour, minute, 0, "yy-MM-dd hh:mm", "Palindrome day with time without decade"); } CheckPlaindromeDate(ycount + year, month, day, hour, 0, 0, "yyyy-MM-dd hh:", "Palindrome day with whole hours"); CheckPlaindromeDate(ycount + year, month, day, hour, 0, 0, "yy-MM-dd hh:", "Palindrome day with whole hours without decade"); } } } } }
protected void Page_Load(object sender, EventArgs e) { PageSize = 10; objCommonMIS.EmpId = Membership.GetUser().UserName.ToString(); if (!Page.IsPostBack) { ViewState["First"] = 1; ViewState["Last"] = PageSize; objCommonMIS.GetUserBusinessLine(ddlBusinessLine); objCommonMIS.BusinessLine_Sno = ddlBusinessLine.SelectedValue; objCommonMIS.RegionSno = "0"; objCommonMIS.BranchSno = "0"; objCommonMIS.GetUserProductDivisions(ddlProductDivison); ddlProductLine.Items.Insert(0, new ListItem("All", "0")); for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--) { ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); } ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month); } System.Threading.Thread.Sleep(int.Parse(ConfigurationManager.AppSettings["AjaxPleaseWaitTime"])); }
public void CreateRealTimeChart() { List <int> returnedData = new List <int>(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); RealTimeChart.Titles[0].Text = "Current Month (" + mfi.GetMonthName(DateTime.Now.Month).ToString() + ")"; returnedData = ScoreCardReports.GetRealTime(); RealTimeChart.Series["New"].Points.Add(returnedData[0]); RealTimeChart.Series["Closed"].Points.Add(returnedData[1]); RealTimeChart.Series["Open"].Points.Add(returnedData[2]); RealTimeChart.Series["Unassigned"].Points.Add(returnedData[3]); RealTimeChart.Series["Averg"].Points.Add(returnedData[4]); RealTimeChart.ChartAreas["caScoreCard"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 11); CustomLabel customLabel = new CustomLabel(); string[] months = new string[] { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; customLabel.Text = months[(DateTime.Now.Month - 1)]; customLabel.FromPosition = 0.5; customLabel.ToPosition = 1.5; RealTimeChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); RealTimeChart.Series["Open"].LegendText = "Running Open"; RealTimeChart.Series["Averg"].LegendText = "Average Days Open"; }
protected void Page_Load(object sender, EventArgs e) { try { param[0].Direction = ParameterDirection.ReturnValue; objCommonMIS.EmpId = Membership.GetUser().UserName.ToString(); if (!Page.IsPostBack) { objCommonMIS.EmpId = Membership.GetUser().UserName.ToString(); objCommonMIS.GetUserRegions(ddlRegion); objCommonMIS.ProductDivisionsWithUser(ddlProductDivision); if (ddlProductDivision.Items.Count == 2) { ddlProductDivision.SelectedIndex = 1; } for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--) { ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); } } } catch (Exception ex) { CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString()); } }
private void LoadPDF() { /* * ContractNumber1 ContractNumber2 SumOfMoneyPerTon CropYear1 WithdrawalDate CurrentDayMonth Shareholder Signature PrintLandOwnerName PrintShareholderName ShareholderAddress Director WSCPAC Company Representative CurrentTwoDigitYear */ var pdfReader = new PdfReader(System.Web.HttpContext.Current.Server.MapPath("~/PDF/2015.pdf")); var output = new MemoryStream(); var stamper = new PdfStamper(pdfReader, output); var date = DateTime.Now; DateTimeFormatInfo mfi = new DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(date.Month).ToString(); stamper.AcroFields.SetField("ContractNumber1", ""); stamper.AcroFields.SetField("ContractNumber2", ""); stamper.AcroFields.SetField("SumOfMoneyPerTon", ""); stamper.AcroFields.SetField("CropYear1", ""); stamper.AcroFields.SetField("WithdrawalDate", ""); stamper.AcroFields.SetField("CurrentDayMonth", mfi.GetMonthName(date.Month).ToString() + " " + date.Day); stamper.AcroFields.SetField("Shareholder Signature", ""); stamper.AcroFields.SetField("PrintLandOwnerName", ""); stamper.AcroFields.SetField("PrintShareholderName", ""); stamper.AcroFields.SetField("ShareholderAddress", ""); stamper.AcroFields.SetField("Director WSCPAC", ""); stamper.AcroFields.SetField("Company Representative", ""); stamper.AcroFields.SetField("CurrentTwoDigitYear", date.ToString("yy")); stamper.FormFlattening = true; stamper.Close(); pdfReader.Close(); Response.AddHeader("Content-Disposition", "attachment; filename=YourPDF.pdf"); Response.ContentType = "application/pdf"; Response.BinaryWrite(output.ToArray()); Response.End(); }
/// <summary> /// Generate Months for Month DropdownList /// </summary> private void BuildMonths() { //Months for (int month = 1; month <= 12; month++) { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); string monthName = dateInfo.GetMonthName(month); DropDownListMonth.Items.Add(new ListItem(monthName, month.ToString(CultureInfo.InvariantCulture))); } }
/// <summary> /// Get the friendly name for a month index /// </summary> /// <param name="yearAndMonth">The year and month in yyyyMM format</param> /// <returns>The friendly month name</returns> public virtual string GetFriendlyMonthName(int yearAndMonth) { if (yearAndMonth > 99999) { var month = int.Parse(yearAndMonth.ToString().Substring(4, 2)); DateTimeFormatInfo dtft = new DateTimeFormatInfo(); return dtft.GetMonthName(month); } return "[unknown]"; }
public static string GetMonthName(this string monthCode) { int monthNumber; if (!int.TryParse(monthCode, out monthNumber) || monthNumber < 1 || monthNumber > 12) { throw new InvalidMonthException("An invalid month number was passed", monthCode); } var formatInfo = new DateTimeFormatInfo(); return formatInfo.GetMonthName(monthNumber).ToLower(); }
public decimal GetChildrenPrice() { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string monthname = mfi.GetMonthName(departure.Month).ToString(); Month month = (Month)Enum.Parse(typeof(Month), monthname); decimal ChildrenPrice; ChildrenPrice = (accommodatie.Kinderprijs * amountTravelers) * months[(int)month] / 100; return(ChildrenPrice); }
public decimal GetAdultPrice() { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string monthname = mfi.GetMonthName(departure.Month).ToString(); Month month = (Month)Enum.Parse(typeof(Month), monthname); decimal AdultPrice; AdultPrice = (accommodatie.Volwasseneprijs * 2) * months[(int)month] / 100; return(AdultPrice); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); return(mfi.GetMonthName((int)value).ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); return(0); } }
public static string GetNameMonth(string month) { string strReturn = ""; int intM = 0; if (int.TryParse(month, out intM) == true) { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); strReturn = mfi.GetMonthName(intM).ToString(); } return(strReturn); }
private void ShowAllCampgrounds() { int park_id = CLIHelper.GetInteger("Please Select Park ID "); Console.WriteLine(); Console.WriteLine("Showing All Campgrounds in Selected Park:"); Console.WriteLine(); CampgroundDAL dal = new CampgroundDAL(connectionString); List <Campground> listOfCamps = dal.GetCampGroundsList(park_id); foreach (Campground c in listOfCamps) { System.Globalization.DateTimeFormatInfo gmn = new System.Globalization.DateTimeFormatInfo(); string strMonthName = gmn.GetMonthName(c.OpenFromMM).ToString(); string endMonthName = gmn.GetMonthName(c.OpenToMM).ToString(); Console.WriteLine(); Tools.ColorfulWriteLine("Campground ID".PadRight(20) + "Name".PadRight(35) + "Opens".PadRight(10) + "Closes".PadRight(15) + "Daily Fee", ConsoleColor.Green); Console.WriteLine($"{c.CampgroundId})".PadRight(20) + $"{c.Name}".PadRight(35) + $"{strMonthName}".PadRight(10) + $"{endMonthName}".PadRight(15) + $"${c.DailyFee}"); Console.WriteLine(); } }
private void AddArchives() { var dateTimeFormatInfo = new DateTimeFormatInfo(); var group = _postsList.GroupBy(p => new { p.PostAddedDate.Year, p.PostAddedDate.Month }) .OrderByDescending(g => g.Key.Year) .ThenByDescending(g => g.Key.Month); var archives = @group.Select(g => new Archive { MonthYear = string.Format("{0} {1} ({2})", dateTimeFormatInfo.GetMonthName(g.Key.Month), g.Key.Year, g.Count()), Year = g.Key.Year.ToString(CultureInfo.InvariantCulture), Month = g.Key.Month.ToString("00") }).ToList(); Archives.AddRange(archives); }
static void Main() { int month = int.Parse(Console.ReadLine()); if (month < 1 || month > 12) { Console.WriteLine("Error!"); } else { System.Globalization.DateTimeFormatInfo monthName = new System.Globalization.DateTimeFormatInfo(); Console.WriteLine(monthName.GetMonthName(month)); } }
public IndexViewModel GetModelByUserAndDate(string user, DateTime from, DateTime to) { MembershipUser currentUser; var model = GetModel(user, out currentUser); var dateInfo = new System.Globalization.DateTimeFormatInfo(); var selectedMonth = dateInfo.GetMonthName(from.Month); model.HiChartTitle = "Expenses Chart As Of " + selectedMonth; if (currentUser != null) { model.Expenses = GetExpenseModelByUserEmailAndDate(currentUser.Email, from, to); model.ExpenseChartData = GetExpensesChart(model.Expenses); model.ExpenseTagData = GetExpensesTag(model.Expenses); } model.TagList = GetTagModel(); model.MonthsList = GetMonthsList(); model.ExpenseFilter.FromDate = from; model.ExpenseFilter.ToDate = to; return(model); }
private void AddArchives() { var dateTime = GetDateTime(); var currentYear = dateTime.Year; var currentMonth = dateTime.Month; var dateTimeFormatInfo = new DateTimeFormatInfo(); var post = _postsList.OrderByDescending(p => p.PostEditedDate).LastOrDefault(); if (post != null) { var endYear = post.PostAddedDate.Year; while (currentYear >= endYear) { if (_postsList.Any(p => p.PostAddedDate.Year == currentYear && p.PostAddedDate.Month == currentMonth)) { Archives.Add(new Archive { Year = currentYear.ToString(), Month = currentMonth.ToString("00"), MonthYear = string.Format("{0} {1}", dateTimeFormatInfo.GetMonthName(currentMonth), currentYear) }); } if (currentMonth - 1 < 1) { currentMonth = 12; currentYear--; } else { currentMonth--; } } } }
private static String FormatMonth(int month, int repeatCount, DateTimeFormatInfo dtfi) { Contract.Assert(month >=1 && month <= 12, "month >=1 && month <= 12"); if (repeatCount == 3) { return (dtfi.GetAbbreviatedMonthName(month)); } // Call GetMonthName() here, instead of accessing MonthNames property, because we don't // want a clone of MonthNames, which will hurt perf. return (dtfi.GetMonthName(month)); }
public ActionResult CreateGroupMeeting(string Id) { int GroupMeetingId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString()); GroupMeetingDto groupmeetingdto = new GroupMeetingDto(); if (GroupMeetingId > 0) { groupmeetingdto = _groupmeetingService.GetByID(GroupMeetingId); groupmeetingdto.IsConducted = !groupmeetingdto.IsConducted; } if (groupmeetingdto.lstgroupMembersDto == null || groupmeetingdto.lstgroupMembersDto.Count() < 1) { var newMembers = _memberService.GetByGroupId(GroupInfo.GroupID); var members = new List <GroupMeetingMembersDto>(); foreach (var newmember in newMembers) { members.Add(new GroupMeetingMembersDto() { IsAttended = false, MemberID = newmember.MemberID, MemberName = newmember.MemberName }); } groupmeetingdto.lstgroupMembersDto = members; } GroupMeetingDAL dal = new GroupMeetingDAL(); GroupMeetingDto MeetngDateGroupMeetingDto = dal.GetDate(GroupInfo.GroupID); if (MeetngDateGroupMeetingDto != null) { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(MeetngDateGroupMeetingDto.Month).ToString(); groupmeetingdto.Month = MeetngDateGroupMeetingDto.Month; groupmeetingdto.Year = MeetngDateGroupMeetingDto.Year; groupmeetingdto.GroupMeetingDay = MeetngDateGroupMeetingDto.GroupMeetingDay; groupmeetingdto.MonthName = strMonthName; int NoOfDays = DateTime.DaysInMonth(groupmeetingdto.Year, groupmeetingdto.Month); List <SelectListDto> lstDates = new List <SelectListDto>(); SelectListDto dateSelectListDto = null; for (int i = 1; i <= NoOfDays; i++) { dateSelectListDto = new SelectListDto(); dateSelectListDto.ID = i; dateSelectListDto.Text = i.ToString(); lstDates.Add(dateSelectListDto); } int GroupMeetingDay = GroupMeetingId > 0 ? groupmeetingdto.MeetingDate.Day : groupmeetingdto.GroupMeetingDay; if (TempData["Result"] != null) { ViewBag.Result = TempData["Result"]; } SelectList slDates = new SelectList(lstDates, "ID", "Text", GroupMeetingDay); ViewBag.Dates = slDates; } SelectList Reason = GetDropDownListByMasterCode(Enums.RefMasterCodes.REASON); ViewBag.Reason = Reason; List <GroupMeetingDto> lstGroupMeeting = dal.GetMeetingInfoByGroupID(GroupInfo.GroupID); ViewBag.lstGroupInfo = lstGroupMeeting; return(View(groupmeetingdto)); }
/// <summary> /// Gets the abbreviated or full month name for the specified <paramref name="month"/> and <paramref name="year"/> value, using the /// <paramref name="nameProvider"/> if not null or the <see cref="DateTimeFormatInfo"/> specified by <paramref name="info"/>. /// </summary> /// <param name="month"> /// The month value to get the month name for. /// </param> /// <param name="year"> /// The year value to get the month name for. /// </param> /// <param name="info"> /// The <see cref="DateTimeFormatInfo"/> value to use. /// </param> /// <param name="nameProvider"> /// The <see cref="ICustomFormatProvider"/> to get the name. This parameter has precedence before the /// <paramref name="info"/>. Can be <c>null</c>. /// </param> /// <param name="abbreviated"> /// true to get the abbreviated month name; false otherwise. /// </param> /// <returns> /// The full or abbreviated month name specified by <paramref name="month"/> and <paramref name="year"/>. /// </returns> private static string GetMonthName(int month, int year, DateTimeFormatInfo info, ICustomFormatProvider nameProvider, bool abbreviated) { if (nameProvider != null) { return abbreviated ? nameProvider.GetAbbreviatedMonthName(year, month) : nameProvider.GetMonthName(year, month); } return abbreviated ? info.GetAbbreviatedMonthName(month) : info.GetMonthName(month); }
private void VerificationHelper(DateTimeFormatInfo info, string[] expected) { for (int i = c_MIN_MONTH_VALUE; i <= c_MAX_MONTH_VALUE; ++i) { string actual = info.GetMonthName(i); Assert.Equal(expected[i], actual); } }
private static string FormatMonth(int month, int repeatCount, DateTimeFormatInfo dtfi) { if (repeatCount == 3) { return dtfi.GetAbbreviatedMonthName(month); } return dtfi.GetMonthName(month); }
public void Report() { string selectedServer = ""; /* * if (this.ServerListFilterComboBox.SelectedIndex >= 0) * { * selectedServer = this.ServerListFilterComboBox.SelectedItem.Value.ToString(); * } */ if (ServerListFilterListBox.SelectedItems.Count > 0) { selectedServer = ""; for (int i = 0; i < ServerListFilterListBox.SelectedItems.Count; i++) { selectedServer += "'" + ServerListFilterListBox.SelectedItems[i].Text + "'" + ","; } try { selectedServer = selectedServer.Substring(0, selectedServer.Length - 1); } catch { selectedServer = ""; // throw ex; } finally { } } //2/4/2015 NS added for VSPLUS-1370 if (this.ServerTypeFilterListBox.SelectedItems.Count > 0) { selectedType = ""; for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++) { selectedType += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ","; } try { selectedType = selectedType.Substring(0, selectedType.Length - 1); } catch { selectedType = ""; // throw ex; } finally { } } string date; //10/23/2013 NS modified - added jQuery month/year control /* * if (this.DateParamEdit.Text == "") * { * date = DateTime.Now.ToString(); * this.DateParamEdit.Date = Convert.ToDateTime(date); * } * else * { * date = this.DateParamEdit.Value.ToString(); * } */ /* * if (dde.Text == "") * { * date = DateTime.Now.ToString(); * } * else * { * //date = startDate.Value.ToString(); * date = dde.Text; * } */ if (startDate.Value.ToString() == "") { date = DateTime.Now.ToString(); } else { date = startDate.Value.ToString(); } DateTime dt = Convert.ToDateTime(date); DashboardReports.SrvDiskFreeSpaceTrendXtraRpt report = new DashboardReports.SrvDiskFreeSpaceTrendXtraRpt(); report.Parameters["DateM"].Value = dt.Month; report.Parameters["DateY"].Value = dt.Year; System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString(); report.Parameters["MonthYear"].Value = strMonthName; report.Parameters["ServerName"].Value = selectedServer; //2/4/2015 NS added for VSPLUS-1370 report.Parameters["ServerType"].Value = selectedType; this.ReportViewer1.Report = report; this.ReportViewer1.DataBind(); }
public static string GetLastMonthName() { DateTimeFormatInfo dfi = new DateTimeFormatInfo(); return dfi.GetMonthName(DateTime.Now.Month - 1); }
private static string GetMonthName(int monthNumber) { DateTimeFormatInfo dtf = new DateTimeFormatInfo(); return dtf.GetMonthName(monthNumber); }
public ActionResult getInstallments() { var context = new RRRoadwaysDBContext(); //var dataInstallments = context.Installment.ToList().OrderByDescending(x => x.Id); List <Installment> installments = context.Installment.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); var dataInstallments = (from i in installments join v in vehicles on i.VehicleId equals v.Id select new { i.Id, v.VehicleNumber, InstallmentsMonth = mfi.GetMonthName(Convert.ToInt32(i.InstallmentsMonth)), InstallmentDate = i.InstallmentDate.GetValueOrDefault().ToString("dddd, dd MMMM yyyy"), i.InstallmentDetail, i.Amount } ).ToList(); return(Json(new { data = dataInstallments }, new Newtonsoft.Json.JsonSerializerSettings())); }
protected void Page_Load(object sender, EventArgs e) { //string userRole = objCommonClass.GetRolesForUser(Membership.GetUser().UserName.ToString()); objCommonMIS.EmpId = Membership.GetUser().UserName; //ddlMonth.Enabled = false; Ddlyear.Enabled = false; if (!Page.IsPostBack) { int dt = DateTime.Now.Date.Day; if (dt >= 11 && dt <= 27)//// invoice open only these dyas { // Bind Year and month for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--) { Ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString())); } // uncomment latter //for (int i = 1; i <= 12; i++) // ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); //ddlMonth.Items.Insert(0, new ListItem("Select", "0")); for (int i = DateTime.Now.Month - 2; i <= DateTime.Now.Month; i++) { ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); } ddlMonth.Items.Insert(0, new ListItem("Select", "0")); // by @VT //ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1); // bind amount // after sep // BindInvoiveAmount(); taxableAmt = 0.00; if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS")))) { objCommonMIS.BusinessLine_Sno = "2"; objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion); if (ddlRegion.Items.Count > 0) { ddlRegion.SelectedIndex = 0; } if (ddlRegion.Items.FindByValue("8").Value.Equals("8")) { ListItem lstRegion = ddlRegion.Items.FindByValue("8"); ddlRegion.Items.Remove(lstRegion); } objCommonMIS.RegionSno = ddlRegion.SelectedValue; objCommonMIS.GetUserBranchs(ddlBranch); objCommonMIS.BranchSno = ddlBranch.SelectedValue; objCommonMIS.GetUserSCs(ddlSerContractor); if (ddlSerContractor.Items.Count == 2) { ddlSerContractor.SelectedIndex = 1; } ddlSerContractor.Visible = false; // Added by Mukesh as on 24 Jun 2015 lblASCShowHide.Visible = false; TrInvoiceHideShow.Visible = false; chkServicetaxoption.Visible = false; lblServiceChargesBracks.Visible = false; ShowHideInvoiceDate.Visible = false; } else { UserMaster objUserMaster = new UserMaster(); objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME"); trRB.Visible = false; ddlSerContractor.Items.Clear(); ddlSerContractor.Items.Add(new ListItem(objUserMaster.Name.ToString())); ddlSerContractor.SelectedIndex = 0; ddlSerContractor.Enabled = false; ddlSerContractor.Visible = true; // Added by Mukesh as on 24 Jun 2015 lblASCShowHide.Visible = true; TrInvoiceHideShow.Visible = true; //by @VT 09 Aug 2017 //InvoiceDetails(); } } else { Response.Redirect("~/Pages/Default.aspx"); } ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1); } // ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1); if (Convert.ToInt32(ddlMonth.SelectedValue) > 0) { lblMnth.Text = mfi.GetMonthName(Convert.ToInt32(ddlMonth.SelectedValue)).ToString() + " " + Ddlyear.SelectedValue; } }
private static bool MatchAbbreviatedMonthName(ref __DTString str, DateTimeFormatInfo dtfi, ref int result) { int maxMatchStrLen = 0; result = -1; if (str.GetNext()) { int num2 = (dtfi.GetMonthName(13).Length == 0) ? 12 : 13; for (int i = 1; i <= num2; i++) { string abbreviatedMonthName = dtfi.GetAbbreviatedMonthName(i); int length = abbreviatedMonthName.Length; if ((dtfi.HasSpacesInMonthNames ? str.MatchSpecifiedWords(abbreviatedMonthName, false, ref length) : str.MatchSpecifiedWord(abbreviatedMonthName)) && (length > maxMatchStrLen)) { maxMatchStrLen = length; result = i; } } if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != DateTimeFormatFlags.None) { int num5 = str.MatchLongestWords(dtfi.internalGetLeapYearMonthNames(), ref maxMatchStrLen); if (num5 >= 0) { result = num5 + 1; } } } if (result > 0) { str.Index += maxMatchStrLen - 1; return true; } return false; }
private void LoadCalendarWeeksValue(int monthIndex) { NumberFormatInfo Nfi = new CultureInfo("en-US", false).NumberFormat; DateTimeFormatInfo cultureDateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; double monthly = 0; DateTimeFormatInfo mfi = new DateTimeFormatInfo(); _currentMonthName = mfi.GetMonthName(monthIndex); monthly = MonthProfit[monthIndex - 1]; _monthlyTotal = monthly.ToString("n", Nfi); string emptyStr = ""; for (int i = 0; i < _weeksInMonth.Length;i++ ) _weeksInMonth.SetValue(emptyStr, i); int dayCounter = 0; int weekCounter = 0; _weeklist.Clear(); DateTime[] weekTimes = new DateTime[_calendarResult.Count]; double[] pnlarray = new double[_calendarResult.Count]; foreach (var calitem in _calendarResult) { if (dayCounter == 0) { weekTimes[weekCounter] = calitem.Date; dayCounter++; } if (calitem.Date.DayOfWeek == DayOfWeek.Monday) { weekCounter++; weekTimes[weekCounter] = calitem.Date; } pnlarray[weekCounter] += calitem.Pnl; } int cc = 0; while (cc <= weekCounter) { ResultModel rm = new ResultModel(); rm.Date = weekTimes[cc]; rm.Pnl = pnlarray[cc]; _weeklist.Add(rm); cc++; } var result1 = from item in _weeklist.AsEnumerable() where item.Date.Month == monthIndex select item; bool isSixWeek; var tempdate = result1.ToArray()[0].Date; var sixWeek = new DateTime(tempdate.Year, tempdate.Month, 1); if (sixWeek.DayOfWeek == DayOfWeek.Saturday) isSixWeek = true; else if (sixWeek.DayOfWeek == DayOfWeek.Friday && DateTime.DaysInMonth(sixWeek.Year, sixWeek.Month) == 31) isSixWeek = true; else isSixWeek = false; _isSixWeekInMonth = isSixWeek; if (isSixWeek) { var sixthW = from item in _weeklist.AsEnumerable() where item.Date.Month == monthIndex + 1 select item; if (sixthW.ToArray().Length != 0) _weeksInMonth[5] = sixthW.ToArray()[0].Pnl.ToString("n", Nfi); } else _weeksInMonth[5] = ""; for (int i = 0; i < result1.ToArray().Length; i++) { var item = result1.ElementAt(i); var dtt = item.Date; int weeknumber = GetWeekOfMonth(dtt); switch (weeknumber) { case 1: _weeksInMonth[0] = item.Pnl.ToString("n", Nfi); break; case 2: _weeksInMonth[1] = item.Pnl.ToString("n", Nfi); break; case 3: _weeksInMonth[2] = item.Pnl.ToString("n", Nfi); break; case 4: _weeksInMonth[3] = item.Pnl.ToString("n", Nfi); break; case 5: _weeksInMonth[4] = item.Pnl.ToString("n", Nfi); break; } } }
private void GetCalendarWeeksValue(int monthIndex) { NumberFormatInfo Nfi = new CultureInfo("en-US", false).NumberFormat; var result1 = from item in _weekData.WeekDataTable.AsEnumerable() where DateTime.ParseExact(item.Start_Date, DateFormatsManager.CurrentShortDateFormat + " HH:mm:ss", CultureInfo.InvariantCulture).Month == monthIndex select item; double monthly; DateTimeFormatInfo mfi = new DateTimeFormatInfo(); _currentMonthName = mfi.GetMonthName(monthIndex); monthly = MonthProfit[monthIndex - 1]; _monthlyTotal = monthly.ToString("n", Nfi); string emptyString = ""; for (int i = 0; i < 6;i++ ) _weeksInMonth.SetValue(emptyString, i); bool isSixWeek; var tempWeek = DateTime.ParseExact(result1.ToArray()[0].Start_Date, DateFormatsManager.CurrentShortDateFormat + " HH:mm:ss", CultureInfo.InvariantCulture); var sixWeek = new DateTime(tempWeek.Year, tempWeek.Month, 1); if (sixWeek.DayOfWeek == DayOfWeek.Saturday) isSixWeek = true; else if (sixWeek.DayOfWeek == DayOfWeek.Friday && DateTime.DaysInMonth(sixWeek.Year, sixWeek.Month) == 31) isSixWeek = true; else isSixWeek = false; _isSixWeekInMonth = isSixWeek; if (isSixWeek) { var sixthW = from item in _weekData.WeekDataTable.AsEnumerable() where DateTime.ParseExact(item.Start_Date, DateFormatsManager.CurrentShortDateFormat + " HH:mm:ss", CultureInfo.InvariantCulture).Month == monthIndex + 1 select item; if (sixthW.ToArray().Length != 0) _weeksInMonth[5] = sixthW.ToArray()[0].PNL.ToString("n", Nfi); } else _weeksInMonth[5] = ""; for (int i = 0; i < result1.ToArray().Count(); i++) { WeeklyData.tableWeekRow wRow = result1.ToArray()[i]; var dtt = DateTime.ParseExact(wRow.Start_Date, DateFormatsManager.CurrentShortDateFormat + " HH:mm:ss", CultureInfo.InvariantCulture); int weeknumber = GetWeekOfMonth(new DateTime(dtt.Year, dtt.Month, dtt.Day)); switch (weeknumber) { case 1: _weeksInMonth[0] = wRow.PNL.ToString("n", Nfi); break; case 2: _weeksInMonth[1] = wRow.PNL.ToString("n", Nfi); break; case 3: _weeksInMonth[2] = wRow.PNL.ToString("n", Nfi); break; case 4: _weeksInMonth[3] = wRow.PNL.ToString("n", Nfi); break; case 5: _weeksInMonth[4] = wRow.PNL.ToString("n", Nfi); break; } } }
/*=================================MatchMonthName================================== **Action: Parse the month name from string starting at str.Index. **Returns: A value from 1 to 12 indicating the first month to the twelveth month. **Arguments: str: a __DTString. The parsing will start from the ** next character after str.Index. **Exceptions: FormatException if a month name can not be found. ==============================================================================*/ private static bool MatchMonthName(ref __DTString str, DateTimeFormatInfo dtfi, ref int result) { int maxMatchStrLen = 0; result = -1; if (str.GetNext()) { // // Scan the month names (note that some calendars has 13 months) and find // the matching month name which has the max string length. // We need to do this because some cultures (e.g. "vi-VN") which have // month names with the same prefix. // int monthsInYear = (dtfi.GetMonthName(13).Length == 0 ? 12: 13); for (int i = 1; i <= monthsInYear; i++) { String searchStr = dtfi.GetMonthName(i); int matchStrLen = searchStr.Length; if ( dtfi.HasSpacesInMonthNames ? str.MatchSpecifiedWords(searchStr, false, ref matchStrLen) : str.MatchSpecifiedWord(searchStr)) { if (matchStrLen > maxMatchStrLen) { maxMatchStrLen = matchStrLen; result = i; } } } // Search genitive form. if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0) { int tempResult = str.MatchLongestWords(dtfi.MonthGenitiveNames, ref maxMatchStrLen); // We found a longer match in the genitive month name. Use this as the result. // The result from MatchLongestWords is 0 ~ length of word array. // So we increment the result by one to become the month value. if (tempResult >= 0) { result = tempResult + 1; } } // Search leap year form. if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0) { int tempResult = str.MatchLongestWords(dtfi.internalGetLeapYearMonthNames(), ref maxMatchStrLen); // We found a longer match in the leap year month name. Use this as the result. // The result from MatchLongestWords is 0 ~ length of word array. // So we increment the result by one to become the month value. if (tempResult >= 0) { result = tempResult + 1; } } } if (result > 0) { str.Index += (maxMatchStrLen - 1); return (true); } return false; }
public void CreateSixMonthTrendChart() { List <double> newData = new List <double>(); List <double> closedData = new List <double>(); List <double> openData = new List <double>(); SixMonthTrendChart.Series["New"].Points.Clear(); SixMonthTrendChart.Series["Closed"].Points.Clear(); SixMonthTrendChart.Series["Open"].Points.Clear(); SixMonthTrendChart.Titles[0].Text = "6 Month Trending"; SixMonthTrendChart.ChartAreas["caScoreCard"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 11); closedData = ScoreCardReports.GetSixMonthTrendClosed(); openData = ScoreCardReports.GetSixMonthTrendOpen(); newData = ScoreCardReports.GetSixMonthTrendNew(); foreach (int value in openData) { SixMonthTrendChart.Series["Open"].Points.Add(value); } SixMonthTrendChart.Series["Open"].LegendText = "Open"; foreach (int value in newData) { SixMonthTrendChart.Series["New"].Points.Add(value); } SixMonthTrendChart.Series["New"].LegendText = "New"; foreach (int value in closedData) { SixMonthTrendChart.Series["Closed"].Points.Add(value); } SixMonthTrendChart.Series["Closed"].LegendText = "Closed"; CustomLabel customLabel = new CustomLabel(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); DateTime d = new DateTime(2013, 01, 01); int selectedYear; int selectedMonth = DateTime.Today.Month; int currentMonth = DateTime.Parse(DateTime.Today.AddMonths(-6).ToString()).Month; if (selectedMonth == 12) { selectedYear = DateTime.Today.Year; } else { selectedYear = DateTime.Parse(DateTime.Today.AddMonths(-6).ToString()).Year; } double postion = 0.5; int postionModifier = 1; do { customLabel.Text = mfi.GetMonthName(currentMonth) + @"-" + selectedYear.ToString(); customLabel.FromPosition = postion; customLabel.ToPosition = postion + postionModifier; postion += postionModifier; currentMonth++; if (currentMonth == 13) // Roll over the month { currentMonth = 1; //Jan selectedYear = selectedYear + 1; // Increase the year we are now in the previous year. } SixMonthTrendChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); customLabel = new CustomLabel(); } while (currentMonth != selectedMonth); }
public VMCustomer(Customer customer) { if (customer != null) { //initialize main module service IMainModuleService mainModuleService = ProxyLocator.GetMainModuleService(); this.Customer = mainModuleService.GetCustomerByCode(customer.CustomerCode); //load orders for this client using (BackgroundWorker worker = new BackgroundWorker()) { worker.DoWork += delegate(object sender, DoWorkEventArgs e) { try { e.Result = mainModuleService.GetOrdersByOrderInformation(new OrderInformation() { CustomerId = customer.CustomerId, DateTimeFrom = DateTime.MinValue, DateTimeTo = DateTime.Now }); } catch { e.Cancel = true; } }; worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled && e.Error == null) { List<Order> orders = e.Result as List<Order>; if (orders != null) { DateTimeFormatInfo dtformatInfo = new DateTimeFormatInfo(); this.CustomerOrders = orders; this.CurrentCustomerOrdersPie = (from co in this.CustomerOrders where co.OrderDate.Value.Year == this.Today.Year group co by co.OrderDate.Value.Month into g select new { id = g.Key, Month = dtformatInfo.GetMonthName(g.Key), Count = g.Count() } ).OrderByDescending(o => o.id) .ToList<object>(); } } }; worker.WorkerSupportsCancellation = true; worker.RunWorkerAsync(); } } }
public ActionResult Index(SearchViewModel model) { var ci = new CultureInfo("es-CO"); model.Specialties = new SpecialtyAppService().GetAllSpecialty(); model.Medics = new EmployeeAppService().GetAllMedics(); List<TimeSlot> lst = new TimeSlotAppService().GetAllTimeSlotWithoutAppoitment(); if (model.EmployeeId != -1) { lst = ApplyFilterEmployee(lst, model.EmployeeId); } if (model.SpecialtyId != -1) { lst = ApplyFilterSpecialty(lst, model.SpecialtyId); } if (!String.IsNullOrEmpty(model.GeoCityId) || model.GeoCityId!= "-1") { lst = ApplyFilterCity(lst, model.GeoCityId); } if (!String.IsNullOrEmpty(model.FromDate) && !String.IsNullOrEmpty(model.ToDate)) { var fromDate = DateTime.ParseExact(model.FromDate, "dd/MM/yyyy", ci); var toDate = DateTime.ParseExact(model.ToDate, "dd/MM/yyyy", ci); lst = ApplyFilterDate(lst, fromDate,toDate); } model.AvailableSlot = new List<TimeSlotViewModel>(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); foreach (var itm in lst) { var emp = new EmployeeAppService().GetEmployee(itm.Schedule.EmployeeId); var itmVm = new TimeSlotViewModel { ScheduleId = itm.ScheduleId, MonthName = itm.Schedule.Month, TimeSlotId = itm.TimeSlotId, OfficeId = itm.OfficeId, Day = itm.Day, StartTime = itm.StartTime, EndTime = itm.EndTime, StartTimeText = itm.StartTime.ToShortTimeString(), EndTimeText = itm.EndTime.ToShortTimeString(), OfficeAddress = string.Format("Medico:{0}({1}) {2},{3}", emp.FullName, itm.Office.Address, itm.Office.Number, itm.Office.GeoCity.Name), DayName = string.Format("{0},{1} de {2} de {3}", new DateTime(itm.Schedule.Year, itm.Schedule.Month, itm.Day).DayOfWeek.ToString(ci), itm.Day,mfi.GetMonthName(itm.Schedule.Month).ToString(),itm.Schedule.Year) }; model.AvailableSlot.Add(itmVm); } Session["AvailableSchedule"] = model.AvailableSlot; return View(model); }
// PAC Form protected void btnDownloadPACAgreement_Click(object server, EventArgs e) { var METHOD_NAME = "btnDownloadPACAgreement_Click"; var qs = new NameValueCollection(); if (lblAddressType.Text == "Corporation") { pacMessages.InnerText = ""; string searchTerm = txtSHID.Text.Trim(); int searchType = 1; int cropYear = Convert.ToInt16(ddlCropYear.Text); List<ListAddressItem> addrList = BeetDataAddress.AddressFindByTerm(searchTerm, cropYear, searchType); var address = new StringBuilder(); address.AppendFormat("{0}, {1}, {2}, {3}", addrList[0].AdrLine1, addrList[0].AdrLine2, addrList[0].CityName, addrList[0].StateName); var phone = addrList[0].PhoneNo ?? ""; var pac = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text)); var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null); var i = new Individual(); var signerFirstName = inds[0].FullName.Split(" ".ToCharArray())[0]; var signerLastName = inds[0].FullName.Split(" ".ToCharArray())[1]; var date = DateTime.Now; var mfi = new DateTimeFormatInfo(); var strMonthName = mfi.GetMonthName(date.Month).ToString(); qs.Add("Filename", "PACDuesCorp"); qs.Add("CORPORATION NAME", Server.UrlEncode(lblBusName.Text)); qs.Add("CorporationName", Server.UrlEncode(lblBusName.Text)); qs.Add("LastNameFirstName", signerLastName + ", " + signerFirstName); //qs.Add("Dated", DateTime.Now.ToString("MM/dd/yyyy")); qs.Add("CentsPerTonDevlivered", pACContibution.Text); qs.Add("TwoDigitCents", (pACContibution.Text.Length == 1) ? "0" + pACContibution.Text : pACContibution.Text); qs.Add("Address", address.ToString()); qs.Add("PHONE", phone); qs.Add("Text1", DateTime.Now.Year.ToString()); qs.Add("Year2", DateTime.Now.Year.ToString()); try { qs.Add("Individual1", (PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage1", pac.Individuals[0].Percentage.ToString()); qs.Add("Individual2", (PACData.GetPACIndividuals(pac.Individuals[1].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage2", pac.Individuals[1].Percentage.ToString()); qs.Add("Individual3", (PACData.GetPACIndividuals(pac.Individuals[2].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage3", pac.Individuals[2].Percentage.ToString()); qs.Add("Individual4", (PACData.GetPACIndividuals(pac.Individuals[3].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage4", pac.Individuals[3].Percentage.ToString()); } catch(Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex, "Unable to load page correctly at this time.", indWarning); } } else { var pac = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text)); var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null); var i = new Individual(); var date = DateTime.Now; var mfi = new DateTimeFormatInfo(); var strMonthName = mfi.GetMonthName(date.Month).ToString(); var ds = WSCContract.GetContracts(txtSHID.Text, 2014, ConfigurationManager.ConnectionStrings["BeetConn"].ToString()); var strContractIds = ""; foreach (DataRow dr in ds.Tables[0].Rows) strContractIds += dr[0] + ", "; if (strContractIds.Length > 2) strContractIds = strContractIds.Substring(0, strContractIds.Length - 2); qs.Add("Filename", "PACDuesNonCorp"); qs.Add("CurrentTwoDigitYear", date.ToString("yy")); qs.Add("CurrentDayMonth", mfi.GetMonthName(date.Month).ToString() + " " + date.Day); qs.Add("SumOfMoneyPerTon", pACContibution.Text); qs.Add("CropYear1", DateTime.Now.Year.ToString()); qs.Add("SomeBullshit", DateTime.Now.Year.ToString()); qs.Add("PrintShareholderName", ((Individual)inds[0]).FullName); qs.Add("ContractNumber1", strContractIds); } Response.Redirect("~/Downloads/Downloader.aspx" + qs.ToQueryString()); }
public void CreateTicketHealthTrendChart() { List <double> averageOpenData = new List <double>(); List <double> averageCloseData = new List <double>(); TicketHealthChart.Series["AverageOpen"].Points.Clear(); TicketHealthChart.Series["AvergToClose"].Points.Clear(); TicketHealthChart.Titles[0].Text = "Ticket Health"; TicketHealthChart.ChartAreas["caScoreCard"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 11); averageCloseData = ScoreCardReports.GetAverageCloseTime(); averageOpenData = ScoreCardReports.GetAverageOpenTime(); foreach (int value in averageOpenData) { TicketHealthChart.Series["AverageOpen"].Points.Add(value); } TicketHealthChart.Series["AverageOpen"].LegendText = "Average Day's Open"; foreach (int value in averageCloseData) { TicketHealthChart.Series["AvergToClose"].Points.Add(value); } TicketHealthChart.Series["AvergToClose"].LegendText = "Average Day's To Close"; CustomLabel customLabel = new CustomLabel(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); int selectedYear; int selectedMonth = DateTime.Today.Month - 1; if (selectedMonth < 1) { selectedMonth = 12; } int currentMonth = 0; if (selectedMonth == 12) { selectedYear = DateTime.Today.Year - 1; currentMonth = 1; } else { selectedYear = DateTime.Today.Year - 1; currentMonth = selectedMonth + 1; } double postion = 0.5; int postionModifier = 1; do { customLabel.Text = mfi.GetMonthName(currentMonth).ToString() + @"-" + selectedYear.ToString(); customLabel.FromPosition = postion; customLabel.ToPosition = postion + postionModifier; postion += postionModifier; currentMonth++; if (currentMonth == 13) // Roll over the month { currentMonth = 1; //Jan selectedYear = selectedYear + 1; // Increase the year we are now in the previous year. } TicketHealthChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); customLabel = new CustomLabel(); } while (currentMonth != selectedMonth); customLabel.Text = mfi.GetMonthName(currentMonth).ToString() + @"-" + selectedYear.ToString(); customLabel.FromPosition = postion; customLabel.ToPosition = postion + postionModifier; TicketHealthChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); customLabel = new CustomLabel(); }
private static string FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi) { if (dtfi.Calendar.IsLeapYear(dtfi.Calendar.GetYear(time))) { return dtfi.internalGetMonthName(month, MonthNameStyles.LeapYear, repeatCount == 3); } if (month >= 7) { month++; } if (repeatCount == 3) { return dtfi.GetAbbreviatedMonthName(month); } return dtfi.GetMonthName(month); }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { Session["DASHBOARD"] = "true"; } if (Convert.ToString(Session["EMP_ID"]) == "") { Response.Redirect("Login.aspx", false); } if (!Page.IsPostBack) { lbl_Birthday.Text = "BIRTHDAY REMINDERS - " + DateTime.Now.ToLongDateString().ToUpper(); getBirthday(); string str_Loginid = Convert.ToString(Session["USER_ID"]); _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); //CODE FOR FETCHING EMPLOYEE NAME _obj_smhr_Dashboard.OPERATION = operation.Select; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(str_Loginid); DataTable dt_getEMP_NAME = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_getEMP_NAME.Rows.Count != 0) { lbl_EmpName.Text = Convert.ToString(dt_getEMP_NAME.Rows[0][0]); lbl_EmpBloodGroup.Text = Convert.ToString(dt_getEMP_NAME.Rows[0][1]); } else { BLL.ShowMessage(this, "No employee name exists for this login id"); //Response.Redirect("~/Login.aspx"); } //CODE FOR FETCHING EMPLOYEE ID _obj_smhr_Dashboard.OPERATION = operation.Select_Emp; _obj_smhr_Dashboard.SMHR_DASHBOARD_LOGIN_ID = Convert.ToInt32(str_Loginid); DataTable dt_getEMP_ID = BLL.get_EMP_ID(_obj_smhr_Dashboard); string STR_EMP_ID = Convert.ToString(dt_getEMP_ID.Rows[0][0]); lbl_EmpId.Text = STR_EMP_ID; //CODE FOR FETCHING EMPLOYEE DESIGNATION _obj_smhr_Dashboard.OPERATION = operation.Select_Pos; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_getEMP_DESG = BLL.get_EMP_ID(_obj_smhr_Dashboard); lbl_EmpDesignation.Text = Convert.ToString(dt_getEMP_DESG.Rows[0][0]); //CODE FOR FETCHING EMPLOYEE DEPARTMENT _obj_smhr_Dashboard.OPERATION = operation.Select_Dept; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_getEMP_DEPT = BLL.get_EMP_ID(_obj_smhr_Dashboard); lbl_EmpDepartment.Text = Convert.ToString(dt_getEMP_DEPT.Rows[0][0]); //NO of Pending Leave Applications _obj_smhr_Leaveapp = new SMHR_LEAVEAPP(); _obj_smhr_Leaveapp.OPERATION = operation.Check_New; _obj_smhr_Leaveapp.LEAVEAPP_STATUS = Convert.ToInt32(0); _obj_smhr_Leaveapp.LEAVEAPP_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingLeave = BLL.get_LeaveApp(_obj_smhr_Leaveapp); lbl_pendingleave.Text = Convert.ToString(dt_NoOfPendingLeave.Rows[0][0]); //No of Pending Comp-Off Application _obj_smhr_Compoff = new SMHR_EMPCOMOFF(); _obj_smhr_Compoff.OPERATION = operation.Check_New; _obj_smhr_Compoff.EMPCOMPOFF_STATUS = Convert.ToInt32(0); _obj_smhr_Compoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingCOMPOFF = BLL.get_empcompffs(_obj_smhr_Compoff); lbl_pendingcompoff.Text = Convert.ToString(dt_NoOfPendingCOMPOFF.Rows[0][0]); //No of Pending Expense Applications _obj_smhr_Expense = new SMHR_EXPENSE(); _obj_smhr_Expense.OPERATION = operation.Check_New; _obj_smhr_Expense.EXPENSE_STATUS = Convert.ToInt32(0); _obj_smhr_Expense.EXPENSE_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingExpense = BLL.get_Expense(_obj_smhr_Expense); lbl_pendingexpense.Text = Convert.ToString(dt_NoOfPendingExpense.Rows[0][0]); //No of Pending Loan Applications //EMPLOYEE LEAVE APPLICATION STATUS _obj_smhr_Leaveapp = new SMHR_LEAVEAPP(); _obj_smhr_Leaveapp.OPERATION = operation.Select_New; _obj_smhr_Leaveapp.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_leavestatus = BLL.get_LeaveApp(_obj_smhr_Leaveapp); int int_NoOfLeaves = dt_leavestatus.Rows.Count; if (int_NoOfLeaves == 0) { lbl_MgrLeaveAppStatus.Text = "No leave application status available"; //BLL.ShowMessage(this, "No data available"); } else { int lastLeaveStatus = Convert.ToInt32(dt_leavestatus.Rows[int_NoOfLeaves - 1][0]); if (lastLeaveStatus == 0) { lbl_MgrLeaveAppStatus.Text = "Leave Application Pending"; } else if (lastLeaveStatus == 1) { lbl_MgrLeaveAppStatus.Text = "Leave Application Approved"; } else if (lastLeaveStatus == 2) { lbl_MgrLeaveAppStatus.Text = "Leave Application Rejected"; } else if (lastLeaveStatus == 3) { lbl_MgrLeaveAppStatus.Text = "Leave Application Cancelled"; } else { lbl_MgrLeaveAppStatus.Text = "Leave Application Not Found"; } } //EMPLOYEE COMP-OFF APPLICATION STATUS _obj_smhr_Compoff = new SMHR_EMPCOMOFF(); _obj_smhr_Compoff.OPERATION = operation.Select_New; _obj_smhr_Compoff.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_compoff = BLL.get_empcompffs(_obj_smhr_Compoff); int int_NoOfCompOff = dt_compoff.Rows.Count; if (int_NoOfCompOff == 0) { lbl_MgrCompOffAppStatus.Text = "No comp-off application status available"; // BLL.ShowMessage(this, "No data available"); } else { int lastCompOffStatus = Convert.ToInt32(dt_compoff.Rows[(int_NoOfCompOff) - 1][0]); if (lastCompOffStatus == 0) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Pending"; } else if (lastCompOffStatus == 1) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Approved"; } else if (lastCompOffStatus == 2) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Applicaiton Rejected"; } else if (lastCompOffStatus == 3) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Cancelled"; } else { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Not Found"; } } //EMPLOYEE EXPENSE APPLICATION STATUS _obj_smhr_Expense = new SMHR_EXPENSE(); _obj_smhr_Expense.OPERATION = operation.Select_New; _obj_smhr_Expense.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_expense = BLL.get_Expense(_obj_smhr_Expense); int int_NoOfExpense = dt_compoff.Rows.Count; if (int_NoOfExpense == 0) { lbl_MgrExpenseAppStatus.Text = "No expense application status available"; } else { int lastExpenseStatus = Convert.ToInt32(dt_compoff.Rows[(int_NoOfExpense) - 1][0]); if (lastExpenseStatus == 0) { lbl_MgrExpenseAppStatus.Text = "Expense Application Pending"; } else if (lastExpenseStatus == 1) { lbl_MgrExpenseAppStatus.Text = "Expense Application Approved"; } else if (lastExpenseStatus == 2) { lbl_MgrExpenseAppStatus.Text = "Expense Application Rejected"; } else if (lastExpenseStatus == 3) { lbl_MgrExpenseAppStatus.Text = "Expense Application Cancelled"; } else { lbl_MgrExpenseAppStatus.Text = "Expense Application Not Found"; } } //Modified #region Pie-Chart for Ytd Balances _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); string str_MonthNo = DateTime.Now.Month.ToString(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string str_Period_Month = mfi.GetMonthName(Convert.ToInt32(str_MonthNo)); string str_Period_Year = DateTime.Now.Year.ToString(); string str_PeriodName = str_Period_Month.ToUpper() + " " + str_Period_Year; _obj_smhr_Dashboard.OPERATION = operation.Check_New; _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_PeriodName; DataTable dt_PeriodID = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_PeriodID.Rows.Count == 0) { //DataTable dt_ZeroYtdBalance = new DataTable(); //BLL.ShowMessage(this, "No data available"); } string str_PeriodId = Convert.ToString(dt_PeriodID.Rows[0][0]); _obj_smhr_Dashboard.OPERATION = operation.Check1; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODID = Convert.ToInt32(str_PeriodId); DataTable dt_YtdBalance = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_YtdBalance.Rows.Count == 0) { DataTable dt_ZeroYtdBalance = new DataTable(); DataRow dr_ZeroYtdBalance = dt_ZeroYtdBalance.NewRow(); DataColumn dc_ZeroYtdBalance = new DataColumn(); DataColumn dc_ZeroPayItem_PayDesc = new DataColumn(); dc_ZeroYtdBalance.ColumnName = "YtdBalance"; dc_ZeroPayItem_PayDesc.ColumnName = "payitem_paydesc"; dt_ZeroYtdBalance.Columns.Add(dc_ZeroYtdBalance); dt_ZeroYtdBalance.Columns.Add(dc_ZeroPayItem_PayDesc); dr_ZeroYtdBalance["YtdBalance"] = "0.00"; dr_ZeroYtdBalance["payitem_paydesc"] = "Ytd Balances"; dt_ZeroYtdBalance.Rows.Add(dr_ZeroYtdBalance); RadChart_YtdBalances.DataSource = dt_ZeroYtdBalance; RadChart_YtdBalances.DataBind(); //RadChart_YtdBalances.Visible = false; //BLL.ShowMessage(this, "No data available for ytd balances"); } else { RadChart_YtdBalances.DataSource = dt_YtdBalance; RadChart_YtdBalances.DataBind(); } #endregion //Pie-chart #region Pie-Chart for Leave Balance bool status = false; _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); string str_Current_Year = DateTime.Now.Year.ToString(); _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_Current_Year; _obj_smhr_Dashboard.OPERATION = operation.Select_Period; DataTable dt_Period_ID = BLL.get_EMP_ID(_obj_smhr_Dashboard); string str_Period_Name = Convert.ToString(dt_Period_ID.Rows[0][0]); _obj_smhr_Dashboard.OPERATION = operation.Select_New; _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_Period_Name; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_LeaveBalance = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_LeaveBalance.Rows.Count != 0) { for (int int_rowcount = 0; int_rowcount < dt_LeaveBalance.Rows.Count; int_rowcount++) { if (Convert.ToDouble(dt_LeaveBalance.Rows[int_rowcount]["LT_CURRENTBALANCE"]) == 0.00) { //BLL.ShowMessage(this, "No leaves to have fun"); lbl_zeroleave.Visible = true; lbl_zeroleave.Text = "No leaves available"; status = true; } } if (status == false) { RadChart2.Visible = true; RadChart2.DataSource = dt_LeaveBalance; RadChart2.DataBind(); } } else { lbl_zeroleave.Visible = true; lbl_zeroleave.Text = "No leaves available"; //BLL.ShowMessage(this, "No data available for leave balances"); } #endregion #region Pie-Chart for Performance Hikes _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); _obj_smhr_Dashboard.OPERATION = operation.Select_Hike; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_Hike = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_Hike.Rows.Count != 0) { for (int int_rowcount = 0; int_rowcount < dt_Hike.Rows.Count; int_rowcount++) { if (Convert.ToDouble(dt_Hike.Rows[int_rowcount]["Hike"]) == 0.00) { //BLL.ShowMessage(this, "No leaves to have fun"); lbl_zerohike.Visible = true; lbl_zerohike.Text = "No leaves available"; status = true; } } if (status == false) { RadChart_Performance.Visible = true; RadChart_Performance.DataSource = dt_Hike; RadChart_Performance.DataBind(); } } else { lbl_zerohike.Visible = true; lbl_zerohike.Text = "No leaves to have fun"; //BLL.ShowMessage(this, "No data available for leave balances"); } #endregion //Code For scrolling text //_obj_smhr_Recruitmentupdates = new SMHR_RECRUITMENTUPDATES(); //_obj_smhr_Recruitmentupdates.OPERATION = operation.Select_New; //_obj_smhr_Recruitmentupdates.SMHR_CURRENTDATE = DateTime.Now; //DataTable dt_RecruitmentUpdates = BLL.get_RecruitmentUpdates(_obj_smhr_Recruitmentupdates); //if (dt_RecruitmentUpdates.Rows.Count != 0) //{ // //string str_ReqName = dt_RecruitmentUpdates.Rows[0]["JOBREQ_REQNAME"].ToString(); // Radticker1.DataSource = dt_RecruitmentUpdates;// dt_RecruitmentUpdates; // Radticker1.DataTextField = "JOBREQ_UPDATE"; // //Radticker1.DataMember = str_ReqName; // Radticker1.DataBind(); //} //else //{ // BLL.ShowMessage(this, "Recruitment are closed now"); //} } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Dashboard1", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
/// <summary> /// /// </summary> /// <param name="archiveList"></param> /// <returns></returns> /// <remarks> /// 2013 /// Jan x 3 /// 2012 /// 2011 /// 2010 /// 2000s (2000 - 2009) /// 2009 x 30 /// 1990s (1990 - 1999) /// /// - only clicking on the child node will show posts /// - clicking on parent node will simply expand /// - only inner node has post count /// - only active parent is highlighted /// - active child is bolded /// - parent that ends with "s", e.g. 2000s, covers 10 years /// </remarks> public static List<Timeline> GetTimeline(Nav nav) { string key = BlogHelper.GetCacheKey_Timeline(nav.Slug); List<Timeline> timeList = SiteCache.Get(key) as List<Timeline>; if (timeList != null) return timeList; // get List<Archive> archiveList = BlogApp.GetArchives(nav); // transform archive list to timeline timeList = new List<Timeline>(); DateTimeFormatInfo dtInfo = new DateTimeFormatInfo(); foreach (var archive in archiveList) { if (archive.Year < 2020 && archive.Year > 2010) { Timeline time = timeList.Find(t => t.Label == archive.Year.ToString()); if (time == null) { time = new Timeline(archive.Nav) { Label = archive.Year.ToString(), Year = archive.Year, Month = archive.Month, Children = new List<Timeline>() }; time.Children.Add(new Timeline(archive.Nav) { Label = dtInfo.GetMonthName(archive.Month), Count = archive.MonthlyPostCount, Year = archive.Year, Month = archive.Month }); timeList.Add(time); } else { time.Children.Add(new Timeline(archive.Nav) { Label = dtInfo.GetMonthName(archive.Month), Count = archive.MonthlyPostCount, Year = archive.Year, Month = archive.Month }); } } else if (archive.Year < 2010 && archive.Year > 2000) { Timeline time = timeList.Find(t => t.Label == "2010s"); if (time == null) { time = new Timeline(archive.Nav) { Label = "2010s", Children = new List<Timeline>() }; time.Children.Add(new Timeline(archive.Nav) { Label = archive.Year.ToString(), Count = archive.YearlyPostCount, Year = archive.Year }); // only show year for decades timeList.Add(time); } else { if (time.Children.Find(t => t.Label == archive.Year.ToString()) == null) time.Children.Add(new Timeline(archive.Nav) { Label = archive.Year.ToString(), Count = archive.YearlyPostCount, Year = archive.Year }); } } } SiteCache.Add(key, timeList, new TimeSpan(0, 2, 0)); return timeList; }
protected void Page_Load(object sender, EventArgs e) { //string userRole = objCommonClass.GetRolesForUser(Membership.GetUser().UserName.ToString()); objCommonMIS.EmpId = Membership.GetUser().UserName; if (!Page.IsPostBack) { // Bind Year and month for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--) { Ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString())); } ddlMonth.Items.Insert(0, new ListItem("Select", "0")); taxableAmt = 0.00; if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS")))) { objCommonMIS.BusinessLine_Sno = "2"; objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion); if (ddlRegion.Items.Count > 0) { ddlRegion.SelectedIndex = 0; } //if (ddlRegion.Items.FindByValue("8").Value.Equals("8")) //{ // ListItem lstRegion = ddlRegion.Items.FindByValue("8"); // ddlRegion.Items.Remove(lstRegion); //} objCommonMIS.RegionSno = ddlRegion.SelectedValue; objCommonMIS.GetUserBranchs(ddlBranch); objCommonMIS.BranchSno = ddlBranch.SelectedValue; objCommonMIS.GetUserSCs(ddlSerContractor); if (ddlSerContractor.Items.Count == 2) { ddlSerContractor.SelectedIndex = 1; } //ddlSerContractor.Visible = false; // Added by Mukesh as on 24 Jun 2015 //lblASCShowHide.Visible = false; TrInvoiceHideShow.Visible = false; chkServicetaxoption.Visible = false; lblServiceChargesBracks.Visible = false; ShowHideInvoiceDate.Visible = false; } else { UserMaster objUserMaster = new UserMaster(); objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME"); trRB.Visible = false; ddlSerContractor.Items.Clear(); ddlSerContractor.Items.Add(new ListItem(objUserMaster.Name.ToString())); ddlSerContractor.SelectedIndex = 0; ddlSerContractor.Enabled = false; ddlSerContractor.Visible = true; // Added by Mukesh as on 24 Jun 2015 lblASCShowHide.Visible = true; TrInvoiceHideShow.Visible = true; //InvoiceDetails(); } ddlMonth.SelectedIndex = 6; // imglogo.Visible = false; } }
private void CategorizeBarChart() { // Make master list MasterNodesBarChart = new ObservableCollection<Node>(); MasterNodesBarChart.Add(new Node("All", profile.GetAllPosts())); foreach (Account a in profile.Accounts) MasterNodesBarChart.Add(new Node(a.Name, a.Posts)); // Add year subnodes foreach (Node master_node in MasterNodesBarChart) { var year_nodes = from p in master_node.Posts group p by p.Date.Year into g select new Node(g.Key.ToString(), g); foreach (Node year_node in year_nodes) master_node.Subnodes.Add(year_node); // Add month subnodes foreach (Node year_node in master_node.Subnodes) { DateTimeFormatInfo fi = new DateTimeFormatInfo(); var month_nodes = from p in year_node.Posts group p by p.Date.Month into g select new Node(fi.GetMonthName(g.Key), g); foreach (Node month_node in month_nodes) year_node.Subnodes.Add(month_node); } } // Categorize nodes recursively foreach (var node in MasterNodesBarChart) Node.GroupByCategoryRecursively(node); }
public void TestInvalidDayOfWeek() { DateTimeFormatInfo info1 = new DateTimeFormatInfo(); Assert.Throws<ArgumentOutOfRangeException>(() => { info1.GetMonthName(c_MIN_MONTH_VALUE - 1); }); DateTimeFormatInfo info2 = new DateTimeFormatInfo(); Assert.Throws<ArgumentOutOfRangeException>(() => { info2.GetMonthName(c_MAX_MONTH_VALUE + 1); }); }
private void CategorizeLineChart() { Stopwatch stop_watch = new Stopwatch(); stop_watch.Start(); // Make master list MasterNodesLineChart = new ObservableCollection<Node>(); MasterNodesLineChart.Add(new Node("All", profile.GetAllPosts())); foreach (Account a in profile.Accounts) MasterNodesLineChart.Add(new Node(a.Name, a.Posts)); // Add category subnodes foreach (Node master_node in MasterNodesLineChart) { var category_nodes = from p in master_node.Posts orderby p.Match.Name group p by p.Match into g select new Node(g.Key.Name, g); foreach (Node category_node in category_nodes) master_node.Subnodes.Add(category_node); foreach (Node category_node in master_node.Subnodes) { DateTimeFormatInfo fi = new DateTimeFormatInfo(); var data = from p in category_node.Posts orderby p.Date group p by string.Format("{0}, {1}", p.Date.Year, fi.GetMonthName(p.Date.Month)) into g select new PlotData(g.Key, g.Sum(p => p.Value)); category_node.Data = new ObservableCollection<PlotData>(data); } } stop_watch.Stop(); StatusText = "Categorization took: " + stop_watch.ElapsedMilliseconds + " milliseconds"; }
private void InitializedMonthList() { DateTime now = DateTime.Now; for (int i = 1; i <= 12; i++) { DateTimeFormatInfo mfi = new DateTimeFormatInfo(); ddListMonth.Items.Add(new ListItem(mfi.GetMonthName(i), i.ToString())); } }
private List<SelectListItem> GenerateMonthList() { List<SelectListItem> months = new List<SelectListItem>(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); for (int i = 1; i <= 12; i++) { months.Add(new SelectListItem() { Text = mfi.GetMonthName(i).ToString(), Value = i.ToString() }); } return months; }
public ActionResult CreateGroupMeeting(GroupMeetingDto objmeeting, FormCollection form) { SelectList Reason = GetDropDownListByMasterCode(Enums.RefMasterCodes.REASON); ViewBag.Reason = Reason; if (form["TransactionDate"].Trim() != string.Empty) { objmeeting.TransactionDate = Convert.ToDateTime(form["TransactionDate"]); } string MeetingDate = form["MeetingYearMonth"] + "-" + form["MeetingDay"]; objmeeting.MeetingDate = Convert.ToDateTime(MeetingDate); objmeeting.IsConducted = !objmeeting.IsConducted; objmeeting.GroupID = GroupInfo.GroupID; objmeeting.UserId = UserInfo.UserID; int maxIndex = Convert.ToInt32(form["hdnIndex"]); objmeeting.lstgroupMembersDto = new List <GroupMeetingMembersDto>(); GroupMeetingMembersDto members = null; for (int i = 1; objmeeting.IsConducted && i <= maxIndex; i++) { if (form["hdnMemberID_" + i] == null) { continue; } members = new GroupMeetingMembersDto(); members.MemberID = Convert.ToInt32(form["hdnMemberID_" + i]); members.MemberName = form["hdnMember_" + i]; if (form["Checkmember_" + i] == "on") { members.IsAttended = true; } objmeeting.lstgroupMembersDto.Add(members); } var resultDto = new ResultDto(); objmeeting.GroupMeetingID = Convert.ToInt32(form["GroupMeetingID"]); if (objmeeting.GroupMeetingID == 0) { resultDto = _groupmeetingService.Insert(objmeeting); } else { resultDto = _groupmeetingService.Update(objmeeting); } UpdateGroupInfoSessionbyGroupId(GroupInfo.GroupID); TempData["Result"] = resultDto; GroupMeetingDto MeetngDateGroupMeetingDto = dal.GetDate(GroupInfo.GroupID); if (MeetngDateGroupMeetingDto != null) { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(MeetngDateGroupMeetingDto.Month).ToString(); objmeeting.Month = MeetngDateGroupMeetingDto.Month; objmeeting.Year = MeetngDateGroupMeetingDto.Year; objmeeting.GroupMeetingDay = MeetngDateGroupMeetingDto.GroupMeetingDay; objmeeting.MonthName = strMonthName; int NoOfDays = DateTime.DaysInMonth(objmeeting.Year, objmeeting.Month); List <SelectListDto> lstDates = new List <SelectListDto>(); SelectListDto dateSelectListDto = null; for (int i = 1; i <= NoOfDays; i++) { dateSelectListDto = new SelectListDto(); dateSelectListDto.ID = i; dateSelectListDto.Text = i.ToString(); lstDates.Add(dateSelectListDto); } SelectList slDates = new SelectList(lstDates, "ID", "Text", objmeeting.GroupMeetingDay); ViewBag.Dates = slDates; List <GroupMeetingDto> lstGroupMeeting = dal.GetMeetingInfoByGroupID(GroupInfo.GroupID); ViewBag.lstGroupInfo = lstGroupMeeting; } return(RedirectToAction("GroupMeetingLookup")); }
protected void btnDownloadPACAgreement_Click(object server, EventArgs e) { var qs = new NameValueCollection(); if (lblAddressType.Text == "Corporation") { pacMessages.InnerText = ""; string searchTerm = txtSHID.Text.Trim(); int searchType = 1; int cropYear = Convert.ToInt16(ddlCropYear.Text); List<ListAddressItem> addrList = BeetDataAddress.AddressFindByTerm(searchTerm, cropYear, searchType); var address = new StringBuilder(); address.AppendFormat("{0}, {1}, {2}, {3}", addrList[0].AdrLine1, addrList[0].AdrLine2, addrList[0].CityName, addrList[0].StateName); var phone = addrList[0].PhoneNo ?? ""; var pac = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text)); var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null); var i = new Individual(); var signerFirstName = inds[0].FullName.Split(" ".ToCharArray())[0]; var signerLastName = inds[0].FullName.Split(" ".ToCharArray())[1]; var date = DateTime.Now; var mfi = new DateTimeFormatInfo(); var strMonthName = mfi.GetMonthName(date.Month).ToString(); qs.Add("Filename", "PACDuesCorp"); qs.Add("CORPORATION NAME", Server.UrlEncode(lblBusName.Text)); qs.Add("CorporationName", Server.UrlEncode(lblBusName.Text)); qs.Add("LastNameFirstName", signerLastName + ", " + signerFirstName); qs.Add("Dated", DateTime.Now.ToString("MM/dd/yyyy")); qs.Add("CentsPerTonDevlivered", pACContibution.Text); qs.Add("TwoDigitCents", (pACContibution.Text.Length == 1) ? "0" + pACContibution.Text : pACContibution.Text); qs.Add("Address", address.ToString()); qs.Add("PHONE", phone); qs.Add("Text1", DateTime.Now.Year.ToString()); qs.Add("Year2", DateTime.Now.Year.ToString()); try { qs.Add("Individual1", (PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage1", pac.Individuals[0].Percentage.ToString()); qs.Add("Individual2", (PACData.GetPACIndividuals(pac.Individuals[1].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage2", pac.Individuals[1].Percentage.ToString()); qs.Add("Individual3", (PACData.GetPACIndividuals(pac.Individuals[2].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage3", pac.Individuals[2].Percentage.ToString()); qs.Add("Individual4", (PACData.GetPACIndividuals(pac.Individuals[3].IndividualID, null)[0].FullName)); qs.Add("IndividualPercentage4", pac.Individuals[3].Percentage.ToString()); } catch { } } else { var pac = PACData.GetPACAgreement(txtSHID.Text, Convert.ToInt16(ddlCropYear.Text)); var inds = PACData.GetPACIndividuals(pac.Individuals[0].IndividualID, null); var i = new Individual(); var date = DateTime.Now; var mfi = new DateTimeFormatInfo(); var strMonthName = mfi.GetMonthName(date.Month).ToString(); qs.Add("CurrentTwoDigitYear", date.ToString("yy")); qs.Add("CurrentDayMonth", mfi.GetMonthName(date.Month).ToString() + " " + date.Day); qs.Add("SumOfMoneyPerTon", pACContibution.Text); qs.Add("CropYear1", DateTime.Now.Year.ToString()); qs.Add("SomeBullshit", DateTime.Now.Year.ToString()); qs.Add("PrintShareholderName", ((Individual)inds[0]).FullName); qs.Add("Filename", "PACDuesNonCorp"); } Response.Redirect("~/Downloads/Downloader.aspx" + qs.ToQueryString()); }
public static String getMonthName(int monthNum) { System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); return(mfi.GetMonthName(monthNum).ToString()); }
public static string ToString (DateTime dt, TimeSpan? utc_offset, string format, DateTimeFormatInfo dfi) { // the length of the format is usually a good guess of the number // of chars in the result. Might save us a few bytes sometimes // Add + 10 for cases like mmmm dddd StringBuilder result = new StringBuilder (format.Length + 10); // For some cases, the output should not use culture dependent calendar DateTimeFormatInfo inv = DateTimeFormatInfo.InvariantInfo; if (format == inv.RFC1123Pattern) dfi = inv; else if (format == inv.UniversalSortableDateTimePattern) dfi = inv; int i = 0; while (i < format.Length) { int tokLen; bool omitZeros = false; char ch = format [i]; switch (ch) { // // Time Formats // case 'h': // hour, [1, 12] tokLen = DateTimeUtils.CountRepeat (format, i, ch); int hr = dt.Hour % 12; if (hr == 0) hr = 12; DateTimeUtils.ZeroPad (result, hr, tokLen == 1 ? 1 : 2); break; case 'H': // hour, [0, 23] tokLen = DateTimeUtils.CountRepeat (format, i, ch); DateTimeUtils.ZeroPad (result, dt.Hour, tokLen == 1 ? 1 : 2); break; case 'm': // minute, [0, 59] tokLen = DateTimeUtils.CountRepeat (format, i, ch); DateTimeUtils.ZeroPad (result, dt.Minute, tokLen == 1 ? 1 : 2); break; case 's': // second [0, 29] tokLen = DateTimeUtils.CountRepeat (format, i, ch); DateTimeUtils.ZeroPad (result, dt.Second, tokLen == 1 ? 1 : 2); break; case 'F': omitZeros = true; goto case 'f'; case 'f': // fraction of second, to same number of // digits as there are f's tokLen = DateTimeUtils.CountRepeat (format, i, ch); if (tokLen > 7) throw new FormatException ("Invalid Format String"); int dec = (int)((long)(dt.Ticks % TimeSpan.TicksPerSecond) / (long) Math.Pow (10, 7 - tokLen)); int startLen = result.Length; DateTimeUtils.ZeroPad (result, dec, tokLen); if (omitZeros) { while (result.Length > startLen && result [result.Length - 1] == '0') result.Length--; // when the value was 0, then trim even preceding '.' (!) It is fixed character. if (dec == 0 && startLen > 0 && result [startLen - 1] == '.') result.Length--; } break; case 't': // AM/PM. t == first char, tt+ == full tokLen = DateTimeUtils.CountRepeat (format, i, ch); string desig = dt.Hour < 12 ? dfi.AMDesignator : dfi.PMDesignator; if (tokLen == 1) { if (desig.Length >= 1) result.Append (desig [0]); } else result.Append (desig); break; case 'z': // timezone. t = +/-h; tt = +/-hh; ttt+=+/-hh:mm tokLen = DateTimeUtils.CountRepeat (format, i, ch); TimeSpan offset = utc_offset ?? TimeZone.CurrentTimeZone.GetUtcOffset (dt); if (offset.Ticks >= 0) result.Append ('+'); else result.Append ('-'); switch (tokLen) { case 1: result.Append (Math.Abs (offset.Hours)); break; case 2: result.Append (Math.Abs (offset.Hours).ToString ("00")); break; default: result.Append (Math.Abs (offset.Hours).ToString ("00")); result.Append (':'); result.Append (Math.Abs (offset.Minutes).ToString ("00")); break; } break; case 'K': // 'Z' (UTC) or zzz (Local) tokLen = 1; if (utc_offset != null || dt.Kind == DateTimeKind.Local) { offset = utc_offset ?? TimeZone.CurrentTimeZone.GetUtcOffset (dt); if (offset.Ticks >= 0) result.Append ('+'); else result.Append ('-'); result.Append (Math.Abs (offset.Hours).ToString ("00")); result.Append (':'); result.Append (Math.Abs (offset.Minutes).ToString ("00")); } else if (dt.Kind == DateTimeKind.Utc) result.Append ('Z'); break; // // Date tokens // case 'd': // day. d(d?) = day of month (leading 0 if two d's) // ddd = three leter day of week // dddd+ full day-of-week tokLen = DateTimeUtils.CountRepeat (format, i, ch); if (tokLen <= 2) DateTimeUtils.ZeroPad (result, dfi.Calendar.GetDayOfMonth (dt), tokLen == 1 ? 1 : 2); else if (tokLen == 3) result.Append (dfi.GetAbbreviatedDayName (dfi.Calendar.GetDayOfWeek (dt))); else result.Append (dfi.GetDayName (dfi.Calendar.GetDayOfWeek (dt))); break; case 'M': // Month.m(m?) = month # (with leading 0 if two mm) // mmm = 3 letter name // mmmm+ = full name tokLen = DateTimeUtils.CountRepeat (format, i, ch); int month = dfi.Calendar.GetMonth(dt); if (tokLen <= 2) DateTimeUtils.ZeroPad (result, month, tokLen); else if (tokLen == 3) result.Append (dfi.GetAbbreviatedMonthName (month)); else result.Append (dfi.GetMonthName (month)); break; case 'y': // Year. y(y?) = two digit year, with leading 0 if yy // yyy+ full year with leading zeros if needed. tokLen = DateTimeUtils.CountRepeat (format, i, ch); if (tokLen <= 2) DateTimeUtils.ZeroPad (result, dfi.Calendar.GetYear (dt) % 100, tokLen); else DateTimeUtils.ZeroPad (result, dfi.Calendar.GetYear (dt), tokLen); break; case 'g': // Era name tokLen = DateTimeUtils.CountRepeat (format, i, ch); result.Append (dfi.GetEraName (dfi.Calendar.GetEra (dt))); break; // // Other // case ':': result.Append (dfi.TimeSeparator); tokLen = 1; break; case '/': result.Append (dfi.DateSeparator); tokLen = 1; break; case '\'': case '"': tokLen = DateTimeUtils.ParseQuotedString (format, i, result); break; case '%': if (i >= format.Length - 1) throw new FormatException ("% at end of date time string"); if (format [i + 1] == '%') throw new FormatException ("%% in date string"); // Look for the next char tokLen = 1; break; case '\\': // C-Style escape if (i >= format.Length - 1) throw new FormatException ("\\ at end of date time string"); result.Append (format [i + 1]); tokLen = 2; break; default: // catch all result.Append (ch); tokLen = 1; break; } i += tokLen; } return result.ToString (); }
// // FormatHebrewMonthName // // Action: Return the Hebrew month name for the specified DateTime. // Returns: The month name string for the specified DateTime. // Arguments: // time the time to format // month The month is the value of HebrewCalendar.GetMonth(time). // repeat Return abbreviated month name if repeat=3, or full month name if repeat=4 // dtfi The DateTimeFormatInfo which uses the Hebrew calendars as its calendar. // Exceptions: None. // /* Note: If DTFI is using Hebrew calendar, GetMonthName()/GetAbbreviatedMonthName() will return month names like this: 1 Hebrew 1st Month 2 Hebrew 2nd Month .. ... 6 Hebrew 6th Month 7 Hebrew 6th Month II (used only in a leap year) 8 Hebrew 7th Month 9 Hebrew 8th Month 10 Hebrew 9th Month 11 Hebrew 10th Month 12 Hebrew 11th Month 13 Hebrew 12th Month Therefore, if we are in a regular year, we have to increment the month name if moth is greater or eqaul to 7. */ private static String FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi) { Contract.Assert(repeatCount != 3 || repeatCount != 4, "repeateCount should be 3 or 4"); if (dtfi.Calendar.IsLeapYear(dtfi.Calendar.GetYear(time))) { // This month is in a leap year return (dtfi.internalGetMonthName(month, MonthNameStyles.LeapYear, (repeatCount == 3))); } // This is in a regular year. if (month >= 7) { month++; } if (repeatCount == 3) { return (dtfi.GetAbbreviatedMonthName(month)); } return (dtfi.GetMonthName(month)); }
public void updatetime() { pdt = DateTime.Today; mdt = DateTime.Today; day = pc.GetDayOfMonth(pdt); switch (pc.GetDayOfWeek(pdt).ToString()) { case "Saturday": dayname = "شنبه"; break; case "Sunday": dayname = "یکشنبه"; break; case "Monday": dayname = "دوشنبه"; break; case "Tuesday": dayname = "سه شنبه"; break; case "Wednesday": dayname = "چهارشنبه"; break; case "Thursday": dayname = "پنجشنبه"; break; case "Friday": dayname = "جمعه"; break; } switch (pc.GetMonth(pdt).ToString()) { case "1": monthname = "فروردین"; break; case "2": monthname = "اردیبهشت"; break; case "3": monthname = "خرداد"; break; case "4": monthname = "تیر"; break; case "5": monthname = "مرداد"; break; case "6": monthname = "شهریور"; break; case "7": monthname = "مهر"; break; case "8": monthname = "آبان"; break; case "9": monthname = "آذر"; break; case "10": monthname = "دی"; break; case "11": monthname = "بهمن"; break; case "12": monthname = "اسفند"; break; } year = pc.GetYear(pdt); lbl_date.Text = dayname + "، " + ToPersianNumber(day) + " " + monthname + " " + ToPersianNumber(year); lbl_mdate.Text = mpc.GetDayOfWeek(mdt).ToString().Substring(0, 3) + ". " + mpc.GetDayOfMonth(mdt) + " / " + mmname.GetMonthName(mdt.Month).Substring(0, 3) + "(" + mdt.Month + ") / " + mdt.Year; txt_month.Text = ToPersianNumber(day); }
private static bool MatchMonthName(ref __DTString str, DateTimeFormatInfo dtfi, ref int result) { int num = 0; result = -1; if (str.GetNext()) { int num2 = (dtfi.GetMonthName(13).Length == 0) ? 12 : 13; for (int i = 1; i <= num2; i++) { string monthName = dtfi.GetMonthName(i); int length = monthName.Length; if ((dtfi.HasSpacesInMonthNames ? str.MatchSpecifiedWords(monthName, false, ref length) : str.MatchSpecifiedWord(monthName)) && length > num) { num = length; result = i; } } if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != DateTimeFormatFlags.None) { int num3 = str.MatchLongestWords(dtfi.MonthGenitiveNames, ref num); if (num3 >= 0) { result = num3 + 1; } } if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != DateTimeFormatFlags.None) { int num4 = str.MatchLongestWords(dtfi.internalGetLeapYearMonthNames(), ref num); if (num4 >= 0) { result = num4 + 1; } } } if (result > 0) { str.Index += num - 1; return true; } return false; }
public void CreateComparisonChart() { List <int> newData = new List <int>(); List <int> closedData = new List <int>(); List <int> openData = new List <int>(); comparisonChart.Series["New"].Points.Clear(); comparisonChart.Series["Closed"].Points.Clear(); comparisonChart.Series["Open"].Points.Clear(); comparisonChart.Titles[0].Text = "12 Months Statistics (" + GetYearString(DateTime.Now.AddMonths(-1), 12) + ")"; comparisonChart.ChartAreas["caScoreCard"].AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 11); closedData = ScoreCardReports.GetNumberOfClosedTickets(); openData = ScoreCardReports.GetNumberOfOpenTickets(); newData = ScoreCardReports.GetNumberOfNewTickets(); foreach (int value in openData) { comparisonChart.Series["Open"].Points.Add(value); } comparisonChart.Series["Open"].LegendText = "Open"; int newTotal = 0; foreach (int value in newData) { comparisonChart.Series["New"].Points.Add(value); newTotal += value; } comparisonChart.Series["New"].LegendText = "New"; int closedTotal = 0; foreach (int value in closedData) { comparisonChart.Series["Closed"].Points.Add(value); closedTotal += value; } comparisonChart.Series["Closed"].LegendText = "Closed"; CustomLabel customLabel = new CustomLabel(); string[] months = new string[] { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); int selectedYear; int selectedMonth = DateTime.Today.Month - 1; if (selectedMonth < 1) { selectedMonth = 12; } int currentMonth = 0; if (selectedMonth == 12) { selectedYear = DateTime.Today.Year - 1; currentMonth = 1; } else { selectedYear = DateTime.Today.Year - 1; currentMonth = selectedMonth + 1; } double postion = 0.5; int postionModifier = 1; do { customLabel.Text = mfi.GetMonthName(currentMonth).ToString() + @"-" + selectedYear.ToString(); customLabel.FromPosition = postion; customLabel.ToPosition = postion + postionModifier; postion += postionModifier; currentMonth++; if (currentMonth == 13) // Roll over the month { currentMonth = 1; //Jan selectedYear = selectedYear + 1; // Increase the year we are now in the previous year. } comparisonChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); customLabel = new CustomLabel(); } while (currentMonth != selectedMonth); customLabel.Text = mfi.GetMonthName(currentMonth).ToString() + @"-" + selectedYear.ToString(); customLabel.FromPosition = postion; customLabel.ToPosition = postion + postionModifier; comparisonChart.ChartAreas[0].AxisX.CustomLabels.Add(customLabel); customLabel = new CustomLabel(); }