public static string LoadProcessDetail(string ddlCooperative_Key, string Type, string SeedsKeyProcess) { int CooperativeKey = ddlCooperative_Key.ToInt(); int SeedsKey = SeedsKeyProcess.ToInt(); if (CooperativeKey != 0) { CooperativeKey = HttpContext.Current.Session["CooperativeKey"].ToInt(); } if (Type == "2") { SeedProces_Info info = new SeedProces_Info(SeedsKeyProcess.ToInt()); SeedsKey = info.SeedsKey.ToInt(); } DataTable nTable = All_Data.LoadProcessDetail(CooperativeKey, SeedsKey, Type.ToInt()); string cities = ""; for (int i = 0; i < nTable.Rows.Count; i++) { if (i + 1 < nTable.Rows.Count) { cities += "{\"Key\":\"" + nTable.Rows[i]["ProcessPlantKey"].ToString() + "\",\"Name\":\"" + nTable.Rows[i]["ProcessPlantName"].ToString() + "\"},"; } else { cities += "{\"Key\":\"" + nTable.Rows[i]["ProcessPlantKey"].ToString() + "\",\"Name\":\"" + nTable.Rows[i]["ProcessPlantName"].ToString() + "\"}"; } } cities = "[" + cities + "]"; return(cities); }
public static bool SaveExportProcess(string Key, string Type, string SeedKey, string day, string Area, string AreaUnit, string Quantity, string QuantityUnit) { int memberID = HttpContext.Current.Session["MemberID"].ToInt(); try { All_Data.SaveExportProcessSeed(Key.ToInt(), Type.ToInt(), SeedKey.ToInt(), DateTime.ParseExact(day, "d/M/yyyy", CultureInfo.InvariantCulture), memberID, Area.ToInt(), AreaUnit.ToInt(), Quantity.ToInt(), QuantityUnit.ToInt()); return(true); } catch { return(false); } }
//OLD // void Start() { // levels = new Levels_Data (); // // Levels_Data data = Load2 (); // //// // x = data.x; // for (int i = 0; i < buildCount; i++) { // levels.levels [i] = new Level_Data (); // levels.levels [i].total_Points = data.levels [i].total_Points; // // } //// print (levels.levels [0].total_Points); // } public void LoadFunction() { levels = new Levels_Data(); player = new Player_Data(); player.settings = new Settings(); player.skins = new bool[7]; questions = new Questions_Data(); for (int i = 0; i < buildCount; i++) { levels.levels [i] = new Level_Data(); } All_Data data = Load2(); if (data != null) { player = data.player; player.currency = player.total_points - player.boughtPrice; for (int i = 0; i < data.player.skins.Length; i++) { player.skins [i] = data.player.skins [i]; } for (int i = 0; i < buildCount; i++) { levels.levels [i] = data.levels.levels [i]; // } // print (data.custom_Questions); if (data.custom_Questions != null && data.custom_Questions.questions != null) { if (data.custom_Questions.questions.Count > 0) { questions.questions = new List <Question_Data> (data.custom_Questions.questions); } // print ("Playing with new questions: "); } else { if (CreateCustomQuestions.static_questions != null) { List <QuestionObject> x = new List <QuestionObject> (CreateCustomQuestions.static_questions.CustomQuestions); questions.questions = new List <Question_Data> (); for (int i = 0; i < x.Count; i++) { Question_Data temp = x [i].CreateData(x [i]); questions.questions.Add(temp); } } // print ("Reset back to old questions: "); } } }
public All_Data Load2() { if (File.Exists(Application.persistentDataPath + "/allData1111.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/allData1111.dat", FileMode.Open); All_Data data = bf.Deserialize(file) as All_Data; file.Close(); return(data); // } else { Debug.LogError("Cant find file in " + Application.persistentDataPath + "/allData1111.dat"); return(null); } }
// public void Save(){ // BinaryFormatter bf = new BinaryFormatter (); // FileStream file = File.Create (Application.persistentDataPath + "/levelsInfo.dat"); // Level_Data[] levels_Data = new Level_Data[buildCount]; // CalculateExperience (); // for (int i = 0; i < SceneManager.sceneCountInBuildSettings - 1; i++) { // levels_Data [i] = new Level_Data (); // levels_Data [i].total_Points = levels [i].total_Points; // levels_Data [i].experience = levels [i].experience; // } // bf.Serialize (file, levels_Data); // file.Close (); // } // // public void Load(){ // if (File.Exists (Application.persistentDataPath + "/levelsInfo.dat")) { // BinaryFormatter bf = new BinaryFormatter (); // FileStream file = File.Open (Application.persistentDataPath + "/levelsInfo.dat", FileMode.Open); // Level_Data[] levels_Data = bf.Deserialize (file) as Level_Data[]; // file.Close (); // for (int i = 0; i < SceneManager.sceneCountInBuildSettings - 1; i++) { // levels [i] = new Level_Data (); //// levels_Data [currentSceneIndex] = new Level_Data (); // levels [i].total_Points = levels_Data [i].total_Points; // levels [i].experience = levels_Data [i].experience; // } // } // } // public void Save2(){ // BinaryFormatter bf = new BinaryFormatter (); // FileStream file = File.Create (Application.persistentDataPath + "/test.dat"); // Levels_Data levels_Data = new Levels_Data(); // // CalculateExperience (); // levels_Data.x = x + 40; // // levels_Data.levels = new Level_Data[buildCount]; // // for (int i = 0; i < buildCount; i++) { // // levels_Data.levels [i] = new Level_Data (); // levels_Data.levels [i].total_Points = levels.levels [i].total_Points; // // levels_Data.levels [i].experience = levels.levels [i].experience; // // } // bf.Serialize (file, levels_Data); // // file.Close (); // } // // public Levels_Data Load2(){ // if (File.Exists (Application.persistentDataPath + "/test.dat")) { // BinaryFormatter bf = new BinaryFormatter (); // FileStream file = File.Open (Application.persistentDataPath + "/test.dat", FileMode.Open); // Levels_Data levels_Data = bf.Deserialize (file) as Levels_Data; // // file.Close (); // return levels_Data; // //// levels = new Levels_Data (); //// levels.levels = new Level_Data[buildCount]; //// levels.levels [0].total_Points = levels_Data.levels [0].total_Points; //// levels.levels [0].experience = levels_Data.levels [0].experience; // } else { // Debug.LogError ("Cant find file in " + Application.persistentDataPath + "/test.dat"); // return null; // } // } public void Save2() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/allData1111.dat"); All_Data data = new All_Data(); data.levels = new Levels_Data(); data.player = new Player_Data(); data.player.settings = new Settings(); data.player.skins = new bool[7]; data.player = player; //Saves current questions by adding them all to a new list // print(CustomQuiz.custom_controller); if (CustomQuiz.custom_controller != null) { data.custom_Questions = new Questions_Data(); data.custom_Questions.questions = new List <Question_Data> (); List <QuestionObject> x = new List <QuestionObject> (CustomQuiz.custom_controller.CustomQuestions); // List<QuestionObject> x = CustomQuiz.custom_controller.CustomQuestions; for (int i = 0; i < x.Count; i++) { Question_Data temp = x [i].CreateData(x [i]); data.custom_Questions.questions.Add(temp); } } else { data.custom_Questions = questions; } data.levels.levels = new Level_Data[buildCount]; // for (int i = 0; i < buildCount; i++) // { data.levels.levels [i] = new Level_Data(); data.levels.levels [i] = levels.levels [i]; // } CalculateExperience(); bf.Serialize(file, data); // file.Close(); LoadFunction(); }
//Acá obtengo los valores para llenar la grafica de pie protected void s() { //System.Diagnostics.Debug.WriteLine("Agencia seleccionada: " + cmbAgency.SelectedIndex.ToString()); //fill_cets(cmbAgency.SelectedValue); All_Data.DataSourceID = null; All_Data.DataSource = null; All_Data.DataBind(); try { obtieneRutas(cets); show_all(); for (int i = 0; i < All_Data.Rows.Count; i++) { string status = All_Data.Rows[i].Cells[3].Text; string cod = All_Data.Rows[i].Cells[2].Text; if (status.Equals("0")) { cero += 1; Session["NLiq"] = cod; } else if (status.Equals("1")) { uno += 1; Session["Liq"] = cod; } else { vacio += 1; Session["Pend"] = cod; } } fill_pie(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("<-- seleccionarAgencia Error: " + ex.Message + " -->"); } }
public static string LoadSeedsProcessPlant(string ddlCooperative_Key, string Type, string SeedsKeyProcess) { DataTable nTable = All_Data.GetListSeedProcess(Type.ToInt(), HttpContext.Current.Session["CooperativeKey"].ToInt(), HttpContext.Current.Session["MemberID"].ToInt(), DateTime.Now); string cities = ""; for (int i = 0; i < nTable.Rows.Count; i++) { string tday = ""; if (nTable.Rows[i]["Datetime"].ToString() != "0") { tday = "-" + Utils.DateTostring((DateTime)(nTable.Rows[i]["Datetime"])); } if (i + 1 < nTable.Rows.Count) { cities += "{\"Key\":\"" + nTable.Rows[i]["SeedsKey"].ToString() + "\",\"Name\":\"" + nTable.Rows[i]["SeedsName"].ToString() + tday + "\"},"; } else { cities += "{\"Key\":\"" + nTable.Rows[i]["SeedsKey"].ToString() + "\",\"Name\":\"" + nTable.Rows[i]["SeedsName"].ToString() + tday + "\"}"; } } cities = "[" + cities + "]"; return(cities); }
//muestra todos los datos public void show_all() { DataSet ds = new DataSet(); string name_function = "Zdsd_Funciones_Asp_Net"; var fecha = DateTime.Now.ToString("yyyyMMdd"); string nSVent = null; string nCets = null; try { IRfcFunction rfcFunction_Company = rfcRepository.CreateFunction(name_function.ToUpper()); rfcFunction_Company.SetValue("I_Proceso", "REFRESH"); IRfcTable i_tbl_refresh = rfcFunction_Company.GetTable("I_Tbl_Refresh"); foreach (DatosPermitidos dp in datos) { i_tbl_refresh.Append(); i_tbl_refresh.SetValue("SALA_VENTA", dp.sala_venta); i_tbl_refresh.SetValue("CET", dp.cet); i_tbl_refresh.SetValue("RUTA", dp.ruta); i_tbl_refresh.SetValue("FECHA_LIQUIDA", fecha); } rfcFunction_Company.Invoke(rfcDestination); //ds.Tables.Add(convert.toGridView(rfcFunction_Company.GetTable("O_Tbl_Refresh"), prueba_Dataso)); DataTable dtDatos = convert.toDataTable(rfcFunction_Company.GetTable("O_Tbl_Refresh")); DataTable dtFinal = new DataTable(); dtFinal.Columns.Add("COD_SALA_VENTA", typeof(string)); dtFinal.Columns.Add("SALA_VENTA", typeof(string)); dtFinal.Columns.Add("COD_CET", typeof(string)); dtFinal.Columns.Add("CET", typeof(string)); dtFinal.Columns.Add("RUTA", typeof(string)); dtFinal.Columns.Add("FECHA_LIQUIDA", typeof(DateTime)); dtFinal.Columns.Add("LISTA_VISITA", typeof(string)); dtFinal.Columns.Add("MENSAJE", typeof(string)); dtFinal.Columns.Add("STATUS", typeof(string)); dtFinal.Columns.Add("REPORT1", typeof(string)); dtFinal.Columns.Add("LIQUIDA", typeof(string)); dtFinal.Columns.Add("REPORT2", typeof(string)); dtFinal.Columns.Add("STATUSF", typeof(string)); for (int x = 0; x < dtDatos.Rows.Count; x++) { //System.Diagnostics.Debug.WriteLine(CSVENT.Rows[0].Cells[0].Text); for (int y = 0; y < CSVENT.Rows.Count; y++) { if (CSVENT.Rows[y].Cells[0].Text == dtDatos.Rows[x][0].ToString()) { nSVent = CSVENT.Rows[y].Cells[1].Text; break; } } for (int zx = 0; zx < CCETS.Rows.Count; zx++) { if (CCETS.Rows[zx].Cells[0].Text == dtDatos.Rows[x][1].ToString()) { nCets = CCETS.Rows[zx].Cells[1].Text; break; } } //System.Diagnostics.Debug.WriteLine(CSVENT.Rows[0].Cells[0].Text +" -- "+dtDatos.Rows[x][0].ToString()); //System.Diagnostics.Debug.WriteLine("prueba: -- " + nSVent); DataRow data = dtFinal.NewRow(); data[0] = nSVent; data[1] = dtDatos.Rows[x][0].ToString(); data[2] = nCets; data[3] = dtDatos.Rows[x][1].ToString(); data[4] = dtDatos.Rows[x][2].ToString(); data[5] = dtDatos.Rows[x][3].ToString(); data[6] = dtDatos.Rows[x][4].ToString(); data[7] = dtDatos.Rows[x][5].ToString(); data[8] = dtDatos.Rows[x][6].ToString(); data[9] = dtDatos.Rows[x][7].ToString(); data[10] = dtDatos.Rows[x][8].ToString(); data[11] = dtDatos.Rows[x][9].ToString(); data[12] = dtDatos.Rows[x][10].ToString(); dtFinal.Rows.Add(data); } All_Data.DataSource = dtFinal; All_Data.DataBind(); Semaforo(); //All_Data.Columns[0].ControlStyle.CssClass = "Column0"; //All_Data.Columns[1].ControlStyle.CssClass = "Column1"; //All_Data.Columns[2].ControlStyle.CssClass = "Column2"; //All_Data.Columns[3].ControlStyle.CssClass = "Column3"; //All_Data.Columns[4].ControlStyle.CssClass = "Column4"; //All_Data.Columns[5].ControlStyle.CssClass = "Column5"; //All_Data.Columns[6].ControlStyle.CssClass = "Column6"; //All_Data.Columns[7].ControlStyle.CssClass = "Column7"; //All_Data.Columns[8].ControlStyle.CssClass = "Column8"; //All_Data.Columns[9].ControlStyle.CssClass = "Column9"; //All_Data.Columns[10].ControlStyle.CssClass = "Column10"; //All_Data.Columns[11].ControlStyle.CssClass = "Column11"; //All_Data.Columns[12].ControlStyle.CssClass = "Column12"; //All_Data.Columns[13].ControlStyle.CssClass = "Column13"; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("<-- show_all Error: " + ex.Message + " -->"); } }