public static Process GetOneProcess(RequestorInfo requestorInfo) { Process tempProcess = new Process(); using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities()) { tempProcess = ctx.Process.Include("DataToProcess").Include("DataToResult").Include("Model").Include("ConfigApp").Include("Output").FirstOrDefault(p => p.status_id == 1); // || p.status_id == 3 || p.status_id == 4); try { if (tempProcess != null) { //TRATATIVA de INTEGRIDADE dos DADOS ParseIntegration(ref tempProcess); //SETA STATUS, se possÃvel SetStatus(ref tempProcess, ref requestorInfo); } return(tempProcess); } catch (Exception ex) { GICO.WriteLine(String.Format("{0}> {1} ({2} {3})", tempProcess.guid.ToString(), DateTime.Now, "Exception:", ex.Message.ToString())); BasicEnums.State newstatus = BasicEnums.State.Error; SetOneProcess(tempProcess.guid, newstatus, requestorInfo); return(null); } } }
private static void SetStatus(ref Process tempProcess, ref RequestorInfo requestorInfo) { if (tempProcess != null) { BasicEnums.State newstatus = NewStatus(tempProcess.Status); if (newstatus != BasicEnums.State.NoChangeStatus) { SetOneProcess(tempProcess.guid, newstatus, requestorInfo); } } }
public static byte SetOneProcess(Guid guid, BasicEnums.State state, RequestorInfo requestorInfo) { using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities()) { Process temp = ctx.Process.FirstOrDefault(p => p.guid == guid); temp.status_id = Convert.ToByte(state); temp.macAddr = requestorInfo.macAddr; temp.machineName = requestorInfo.machineName; ctx.SaveChanges(); Condicional(guid, ctx, temp, ref state, ref requestorInfo); } return(GetStatus(guid)); }
public static bool Autentication(RequestorInfo requestorInfo, ref string message) { using (GridProteinFoldingEntities ctx = new GridProteinFoldingEntities()) { ClientCurrentVersion clientCurrentVersion = ctx.ClientCurrentVersion.FirstOrDefault(); if (clientCurrentVersion.currentVersion.Equals(requestorInfo.clientVersion)) { return(true); } else { message = "ERROR: Client version is not valid. You must make the update through the version available at http://efolding.fcfrp.usp.br/App/"; return(false); } } }
private static void Condicional(Guid guid, GridProteinFoldingEntities ctx, Process temp, ref BasicEnums.State state, ref RequestorInfo requestorInfo) { aspnet_Users user = new GridProteinFolding_MemberShipEntities().aspnet_Users.FirstOrDefault(u => u.UserId == temp.userId); if (state == BasicEnums.State.Processing) { GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "Processing", temp.macAddr, temp.machineName)); string message = " was started!"; if (temp.emailNotification == Convert.ToByte(BasicEnums.EmailNotification.Enviar)) { SendMail(ctx, guid, message, user); } Expurg(guid, ctx); } if (state == BasicEnums.State.BULK) { #region BULK GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "BULK", temp.macAddr, temp.machineName)); //ExtendedDirectoryInfo dirBaseServer = new ExtendedDirectoryInfo(ConfigurationManager.AppSettings["dirBaseServer"].ToString()); //object[] parameters = new object[2]; //parameters[0] = dirBaseServer + @"\" + guid + @"\Seed"; //parameters[1] = guid.ToString(); //ctx.ExecuteStoreCommand("EXEC dbo.BunkFiles {0},{1}", parameters); state = BasicEnums.State.ClearTempClient; temp.status_id = Convert.ToByte(state); ctx.SaveChanges(); #endregion #region ClearTempServer GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "ClearTempServer", temp.macAddr, temp.machineName)); DeleteFileServer_temp(guid); state = BasicEnums.State.Finalized; temp.status_id = Convert.ToByte(state); ctx.SaveChanges(); #endregion } //if (state == Enums.BasicEnums.State.Excel) //{ // Applications objApplications = new Applications(); // GICO.Write("Excel.."); // objApplications.Excel(param); // GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!"); // objApplications = null; // state = Enums.BasicEnums.State.Origin; // temp.status_id = Convert.ToByte(state); // ctx.SaveChanges(); //} //if (state == Enums.BasicEnums.State.Origin) //{ // ProcessData(param.dataToProcess.Guid); // Applications objApplications = new Applications(); // GICO.Write("Origin.."); // objApplications.Origin(param.dataToProcess.Guid); // GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!"); // objApplications = null; // state = Enums.BasicEnums.State.ClearTempClient; // temp.status_id = Convert.ToByte(state); // ctx.SaveChanges(); //} //if (state == BasicEnums.State.ClearTempServer) //{ // GICO.WriteLine(guid, String.Format("{0} {1}:", DateTime.Now, "ClearTempServer..")); // DeleteFileServer_temp(guid); // state = BasicEnums.State.Finalized; // temp.status_id = Convert.ToByte(state); // ctx.SaveChanges(); //} //if (state == Enums.BasicEnums.State.Decrypt) //{ // Applications objApplications = new Applications(); // GICO.Write("Decrypt.."); // objApplications.Decrypt(param); // GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!"); // objApplications = null; // state = Enums.BasicEnums.State.Web; // temp.status_id = Convert.ToByte(state); // ctx.SaveChanges(); //} //if (state == Enums.BasicEnums.State.Web) //{ // Applications objApplications = new Applications(); // GICO.Write("Web.."); // objApplications.Web(param); // GICO.WriteLine("{0}:{1}", param.dataToProcess.Guid.ToString(), "DONE!"); // objApplications = null; // state = Enums.BasicEnums.State.Finalized; // temp.status_id = Convert.ToByte(state); // ctx.SaveChanges(); //} if (state == BasicEnums.State.Finalized) { GICO.WriteLine(guid, String.Format("{0} {1} @ {2}({3})", DateTime.Now, "Finalized", temp.macAddr, temp.machineName)); if (temp.emailNotification == Convert.ToByte(BasicEnums.EmailNotification.Enviar)) { string message = "was completed!"; SendMail(ctx, guid, message, user); } } }