private void Txt_Publicador_TextChanged(object sender, EventArgs e) { Publicador aux_pub = new Publicador { Nombre = Txt_Publicador.Text }; int index = All_Pub_List.FindIndex(x => x.Nombre.Contains(aux_pub.Nombre)); if (index >= 0) { Show_Pub_Data_List.Clear(); Show_Pub_Data_List.Add(All_Pub_List[index]); pending_grid_refresh = true; } }
public async void Get_History_Data(string Name) { await Task.Delay(50); Pub_History_List.Clear(); for (int it = 0; it < Sheet_List.Count; it++) { Excel_Range = Sheet_List[it].get_Range("A1", "H200"); cellValue_1 = (object[, ])Excel_Range.get_Value(); int i = 2; Publicador aux_pub; while (i < 200) { if (cellValue_1[i, 1] != null) { if (cellValue_1[i, 1].ToString().Equals(Name)) { aux_pub = new Publicador(); aux_pub.Nombre = Sheet_List[it].Name; aux_pub.Publicaciones = Convert.ToInt16(cellValue_1[i, 2].ToString()); aux_pub.Videos = Convert.ToInt16(cellValue_1[i, 3].ToString()); aux_pub.Horas = Convert.ToInt16(cellValue_1[i, 4].ToString()); aux_pub.Revisitas = Convert.ToInt16(cellValue_1[i, 5].ToString()); aux_pub.Estudios = Convert.ToInt16(cellValue_1[i, 6].ToString()); aux_pub.Grupo = Convert.ToInt16(cellValue_1[i, 7].ToString()); switch (cellValue_1[i, 8].ToString()) { case "Publicador": { aux_pub.Categoria = Categoria.Publicador; break; } case "Auxiliar": { aux_pub.Categoria = Categoria.Auxiliar; break; } case "Regular": { aux_pub.Categoria = Categoria.Regular; break; } case "Null": { aux_pub.Categoria = Categoria.Null; break; } } Pub_History_List.Add(aux_pub); break; } i++; } else { break; } } } Compose_Charts(); pending_grid_refresh = true; }
public async void Calculate_Totals() { Total_Pub.Clear(); Total_Aux.Clear(); Total_Reg.Clear(); Grand_Total.Clear(); Prom_Pub.Clear(); Prom_Aux.Clear(); Prom_Reg.Clear(); Prom_Total.Clear(); for (int i = 0; i < Show_Pub_Data_List.Count; i++) { Publicador aux_pub = Show_Pub_Data_List[i]; switch (Show_Pub_Data_List[i].Categoria) { case Categoria.Publicador: { Total_Pub.Informan++; Total_Pub.Videos += aux_pub.Videos; Total_Pub.Publicaciones += aux_pub.Publicaciones; Total_Pub.Horas += aux_pub.Horas; Total_Pub.Revisitas += aux_pub.Revisitas; Total_Pub.Estudios += aux_pub.Estudios; Total_Pub.Categoria = Categoria.Publicador; break; } case Categoria.Auxiliar: { Total_Aux.Informan++; Total_Aux.Videos += aux_pub.Videos; Total_Aux.Publicaciones += aux_pub.Publicaciones; Total_Aux.Horas += aux_pub.Horas; Total_Aux.Revisitas += aux_pub.Revisitas; Total_Aux.Estudios += aux_pub.Estudios; Total_Aux.Categoria = Categoria.Auxiliar; break; } case Categoria.Regular: { Total_Reg.Informan++; Total_Reg.Videos += aux_pub.Videos; Total_Reg.Publicaciones += aux_pub.Publicaciones; Total_Reg.Horas += aux_pub.Horas; Total_Reg.Revisitas += aux_pub.Revisitas; Total_Reg.Estudios += aux_pub.Estudios; Total_Reg.Categoria = Categoria.Regular; break; } } } Total_Pub.Nombre = "Publicador"; Total_Aux.Nombre = "Auxiliar"; Total_Reg.Nombre = "Regular"; Grand_Total.Nombre = "Totales"; Prom_Pub.Nombre = "Publicador"; Prom_Aux.Nombre = "Auxiliar"; Prom_Reg.Nombre = "Regular"; Prom_Total.Nombre = "Totales"; Grand_Total.Publicaciones = Total_Pub.Publicaciones + Total_Aux.Publicaciones + Total_Reg.Publicaciones; Grand_Total.Videos = Total_Pub.Videos + Total_Aux.Videos + Total_Reg.Videos; Grand_Total.Horas = Total_Pub.Horas + Total_Aux.Horas + Total_Reg.Horas; Grand_Total.Revisitas = Total_Pub.Revisitas + Total_Aux.Revisitas + Total_Reg.Revisitas; Grand_Total.Estudios = Total_Pub.Estudios + Total_Aux.Estudios + Total_Reg.Estudios; Grand_Total.Informan = Total_Pub.Informan + Total_Aux.Informan + Total_Reg.Informan; await Task.Delay(50); Set_Prom_Totals(); pending_grid_refresh = true; }
private void Data_gridview_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string name = ""; DataGridViewCell cell = Main_Data_gridview.CurrentCell; name = Main_Data_gridview[0, cell.RowIndex].Value.ToString(); Publicador aux_pub = new Publicador { Nombre = name }; int index = All_Pub_List.FindIndex(x => x.Nombre.Contains(aux_pub.Nombre)); int value = 0; DataGridViewRow row = Main_Data_gridview.CurrentRow; int.TryParse(row.Cells[1].Value.ToString(), out value); aux_pub.Publicaciones = value; int.TryParse(row.Cells[2].Value.ToString(), out value); aux_pub.Videos = value; int.TryParse(row.Cells[3].Value.ToString(), out value); aux_pub.Horas = value; int.TryParse(row.Cells[4].Value.ToString(), out value); aux_pub.Revisitas = value; int.TryParse(row.Cells[5].Value.ToString(), out value); aux_pub.Estudios = value; int.TryParse(row.Cells[6].Value.ToString(), out value); aux_pub.Grupo = value; switch (row.Cells[7].Value.ToString()) { case "Null": { aux_pub.Categoria = Categoria.Null; break; } case "Publicador": { aux_pub.Categoria = Categoria.Publicador; break; } case "Auxiliar": { aux_pub.Categoria = Categoria.Auxiliar; break; } case "Regular": { aux_pub.Categoria = Categoria.Regular; break; } } if (aux_pub.Horas == 0) { aux_pub.Categoria = Categoria.Null; } All_Pub_List[index] = aux_pub; foreach (DataGridViewCell aux_Cell in row.Cells) { Set_Color_Result_DataGrid(aux_Cell); } Calculate_Totals(); }
public void Read_Data_Worksheet() { All_Pub_List.Clear(); Excel_Range = Sheet_List[Selected_Month].get_Range("A1", "H200"); cellValue_1 = (object[, ])Excel_Range.get_Value(); int i = 2; Publicador aux_pub; while (i < 200) { aux_pub = new Publicador(); if (cellValue_1[i, 1] != null) { aux_pub.Nombre = cellValue_1[i, 1].ToString(); aux_pub.Publicaciones = Convert.ToInt16(cellValue_1[i, 2].ToString()); aux_pub.Videos = Convert.ToInt16(cellValue_1[i, 3].ToString()); aux_pub.Horas = Convert.ToInt16(cellValue_1[i, 4].ToString()); aux_pub.Revisitas = Convert.ToInt16(cellValue_1[i, 5].ToString()); aux_pub.Estudios = Convert.ToInt16(cellValue_1[i, 6].ToString()); aux_pub.Grupo = Convert.ToInt16(cellValue_1[i, 7].ToString()); switch (cellValue_1[i, 8].ToString()) { case "Publicador": { aux_pub.Categoria = Categoria.Publicador; break; } case "Auxiliar": { aux_pub.Categoria = Categoria.Auxiliar; break; } case "Regular": { aux_pub.Categoria = Categoria.Regular; break; } case "Null": { aux_pub.Categoria = Categoria.Null; break; } } All_Pub_List.Add(aux_pub); i++; } else { break; } } Max_Number_Groups = (short)All_Pub_List[All_Pub_List.Count - 1].Grupo; for (short it = 1; it <= Max_Number_Groups; it++) { Filter_Values.Add("Grupo " + it.ToString()); } pending_grid_refresh = true; }