private void But_OptionANCRevision_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; var Option = MainProgram.Self.adminTableView.optionsView; var Table = MainProgram.Self.adminTableView.ReturnDataGridView(); if (Option.GetMonth() != 0 && Option.GetRevision() != "") { Table.DataSource = ANCRevisionQuantity.LoadByYear_Month_Revision( Convert.ToInt32(Option.GetYear()), Convert.ToInt32(Option.GetMonth()), Option.GetRevision() ); } else if (Option.GetMonth() != 0) { Table.DataSource = ANCRevisionQuantity.LoadByYear_Month( Convert.ToInt32(Option.GetYear()), Convert.ToInt32(Option.GetMonth()) ); } else if (Option.GetRevision() != "") { Table.DataSource = ANCRevisionQuantity.LoadByYear_Revision( Convert.ToInt32(Option.GetYear()), Option.GetRevision() ); } else { Table.DataSource = ANCRevisionQuantity.LoadByYear( Convert.ToInt32(Option.GetYear())); } Cursor.Current = Cursors.Default; }
public ANCRevisionQuantityAdd(string Revision, int AddYear, string[] DataToAdd) { var ANCList = ANCRevisionQuantity.LoadByYear_Revision(AddYear, Revision); int StartMonth = 0; if (Revision == "BU") { StartMonth = 1; } else if (Revision == "EA1") { StartMonth = 3; } else if (Revision == "EA2") { StartMonth = 6; } else if (Revision == "EA3") { StartMonth = 9; } if (StartMonth == 0) { return; } if (ANCList != null) { ANCRevisionQuantity.RemoveList(ANCList); } List <ANCRevisionDB> ListANC = new List <ANCRevisionDB>(); foreach (string Data in DataToAdd) { string[] AddData = Data.Split('\t'); if (AddData.Length != 1) { int StringCount = 1; for (int counter = StartMonth; counter < 13; counter++) { var NewRow = new ANCRevisionDB { ANC = AddData[0].ToString(), Year = AddYear, Month = counter, Revision = Revision, Value = Convert.ToDouble(AddData[StringCount]), }; StringCount++; ListANC.Add(NewRow); } } } if (ListANC != null) { ANCRevisionQuantity.AddList(ListANC); } }