public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return(true); } var other = obj as FormatGeneratorOptions; if (other == null) { throw new PSInvalidOperationException("Object to be compared is of different type " + obj.GetType().Name); } if (((Properties == null) != (other.Properties == null)) || ((GroupBy == null) != (other.GroupBy == null)) ) { return(false); } return( Expand.Equals(other.Expand) && Force.Equals(other.Force) && ((GroupBy == null && other.GroupBy == null) || GroupBy.Equals(other.GroupBy)) && DisplayError.Equals(other.DisplayError) && ShowError.Equals(other.ShowError) && String.Equals(View, other.View) && ((Properties == null && other.Properties == null) || Properties.Equals(other.Properties)) ); }
private void button1_Click(object sender, EventArgs e) { // test for validity if (string.IsNullOrEmpty(GroupBy) || string.IsNullOrEmpty(HorizontalDim) || string.IsNullOrEmpty(VerticalDim)) { MessageBox.Show("Please choose a value for each field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = System.Windows.Forms.DialogResult.None; } else if (GroupBy.Equals(HorizontalDim) || GroupBy.Equals(VerticalDim) || HorizontalDim.Equals(VerticalDim)) { MessageBox.Show("Please use different values for each field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = System.Windows.Forms.DialogResult.None; } }
protected override DataTable GetData() { var dt = ScheduleDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile); if (GroupBy.Equals("WorkDate–Day") || SubGroupBy.Equals("WorkDate–Day")) { dt.Columns.Add("WorkDate–Day", typeof(Int32)); foreach (DataRow dr in dt.Rows) { var workdate = (DateTime)dr[ScheduleDataModel.DataColumns.WorkDate]; dr["WorkDate–Day"] = workdate.Day; } } else if (GroupBy.Equals("WorkDate–Month") || SubGroupBy.Equals("WorkDate–Month")) { dt.Columns.Add("WorkDate–Month", typeof(String)); foreach (DataRow dr in dt.Rows) { var workdate = (DateTime)dr[ScheduleDataModel.DataColumns.WorkDate]; var mfi = new DateTimeFormatInfo(); var strMonthName = mfi.GetAbbreviatedMonthName(workdate.Month).ToString(); dr["WorkDate–Month"] = strMonthName; } } else if (GroupBy.Equals("WorkDate–Year") || SubGroupBy.Equals("WorkDate–Year")) { dt.Columns.Add("WorkDate–Year", typeof(Int32)); foreach (DataRow dr in dt.Rows) { var workdate = (DateTime)dr[ScheduleDataModel.DataColumns.WorkDate]; dr["WorkDate–Year"] = workdate.Year; } } else if (GroupBy.Equals("WorkDate–Week") || SubGroupBy.Equals("WorkDate–Week")) { dt.Columns.Add("WorkDate–Week", typeof(Int32)); foreach (DataRow dr in dt.Rows) { var workdate = (DateTime)dr[ScheduleDataModel.DataColumns.WorkDate]; dr["WorkDate–Week"] = workdate.DayOfWeek; } } else if (GroupBy.Equals("WorkDate–Quarter") || SubGroupBy.Equals("WorkDate–Quarter")) { dt.Columns.Add("WorkDate–Quarter", typeof(String)); foreach (DataRow dr in dt.Rows) { var workdate = (DateTime)dr[ScheduleDataModel.DataColumns.WorkDate]; var quarter = ((workdate.Month - 3) % 12) / 4; switch (quarter) { case 1: dr["WorkDate–Quarter"] = "Q1"; break; case 2: dr["WorkDate–Quarter"] = "Q2"; break; case 3: dr["WorkDate–Quarter"] = "Q3"; break; case 4: dr["WorkDate–Quarter"] = "Q4"; break; } } } dt.AcceptChanges(); return(dt); }