public static int AddDowntimeTreatment(string myDowntimeTreatmentName, string myMachineHaltReasonID, string myPhenomenon, string myTreatment, string myCreator, string myRemarks) { string myDowntimeTreatmentItemId = Guid.NewGuid().ToString(); string m_Sql = @"Insert into experience_DowntimeTreatment ( DowntimeTreatmentItemId, DowntimeTreatmentName, MachineHaltReasonID, Creator, CreateTime, Phenomenon, Treatment, Remarks) values ( @DowntimeTreatmentItemId, @DowntimeTreatmentName, @MachineHaltReasonID, @Creator, @CreateTime, @Phenomenon, @Treatment, @Remarks)"; SqlParameter[] m_Parameters = { new SqlParameter("@DowntimeTreatmentItemId", myDowntimeTreatmentItemId), new SqlParameter("@DowntimeTreatmentName", myDowntimeTreatmentName), new SqlParameter("@MachineHaltReasonID", myMachineHaltReasonID), new SqlParameter("@Creator", myCreator), new SqlParameter("@CreateTime", DateTime.Now), new SqlParameter("@Phenomenon", myPhenomenon), new SqlParameter("@Treatment", myTreatment), new SqlParameter("@Remarks", myRemarks) }; try { int result = _dataFactory.ExecuteSQL(m_Sql, m_Parameters); return(result); } catch (Exception e) { return(-1); } }
public static int AddCaseAnalysis(string myCaseAnalysisName, string myKeyword, string myCaseAnalysisType, string myCaseAnalysisLevel, string myCaseAnalysisNature, string myCaseAnalysisText, string myCaseAnalysisParticipants, string myCaseAnalysisTime, string myCreator) { string m_Sql = @"Insert into experience_CaseAnalysis ( CaseAnalysisName, Keyword, CaseAnalysisType, CaseAnalysisLevel, CaseAnalysisNature, CaseAnalysisText, CaseAnalysisParticipants, CaseAnalysisTime, Creator, CreateTime ) values ( @CaseAnalysisName, @Keyword, @CaseAnalysisType, @CaseAnalysisLevel, @CaseAnalysisNature, @CaseAnalysisText, @CaseAnalysisParticipants, @CaseAnalysisTime, @Creator, @CreateTime ) "; SqlParameter[] m_Parameters = { new SqlParameter("@CaseAnalysisName", myCaseAnalysisName), new SqlParameter("@Keyword", myKeyword), new SqlParameter("@CaseAnalysisType", myCaseAnalysisType), new SqlParameter("@CaseAnalysisLevel", myCaseAnalysisLevel), new SqlParameter("@CaseAnalysisNature", myCaseAnalysisNature), new SqlParameter("@CaseAnalysisText", myCaseAnalysisText), new SqlParameter("@CaseAnalysisParticipants", myCaseAnalysisParticipants), new SqlParameter("@CaseAnalysisTime", myCaseAnalysisTime), new SqlParameter("@Creator", myCreator), new SqlParameter("@CreateTime", DateTime.Now) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { return(-1); } }
public static int AddOperationGuide(string myPostOperationKnowledgeId, string myPostOperationKnowledgeName, string myKeyword, string myPostName, string myPostOperationKnowledgeType, string myPostOperationKnowledgeGroup, string myPostOperationKnowledgeText, string myPropounder, string myProposedTime, string myCreator, string myRemarks) { string m_OrganizationID = ExperienceInformation.Infrastructure.Configuration.WebConfigurations.StationId; string m_Sql = @"Insert into experience_PostOperationKnowledge ( PostOperationKnowledgeId, Keyword, OrganizationID, PostName, PostOperationKnowledgeName, PostOperationKnowledgeType, PostOperationKnowledgeGroup, PostOperationKnowledgeText, Propounder, ProposedTime, Creator,CreateTime,Remarks,ModifyFlag) values ( @PostOperationKnowledgeId, @Keyword, @OrganizationID, @PostName, @PostOperationKnowledgeName, @PostOperationKnowledgeType, @PostOperationKnowledgeGroup, @PostOperationKnowledgeText, @Propounder, @ProposedTime, @Creator, @CreateTime, @Remarks, @ModifyFlag)"; SqlParameter[] m_Parameters = { new SqlParameter("@PostOperationKnowledgeId", myPostOperationKnowledgeId), new SqlParameter("@Keyword", myKeyword), new SqlParameter("@OrganizationID", m_OrganizationID), new SqlParameter("@PostName", myPostName), new SqlParameter("@PostOperationKnowledgeName", myPostOperationKnowledgeName), new SqlParameter("@PostOperationKnowledgeType", myPostOperationKnowledgeType), new SqlParameter("@PostOperationKnowledgeGroup", myPostOperationKnowledgeGroup), new SqlParameter("@PostOperationKnowledgeText", myPostOperationKnowledgeText), new SqlParameter("@Propounder", myPropounder), new SqlParameter("@ProposedTime", myProposedTime), new SqlParameter("@Creator", myCreator), new SqlParameter("@CreateTime", DateTime.Now), new SqlParameter("@Remarks", myRemarks), new SqlParameter("@ModifyFlag", "123") }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { return(-1); } }
public static int AddEnergySavingSuggestions(string mySuggestionsName, string myKeyword, string myPostName, string myOrganizationID, string mySuggestionsType, string mySuggestionsGroup, string mySuggestionsText, string myPropounder, string myProposedTime, string myCreator, string myRemarks) { string m_Sql = @"Insert into experience_EnergySavingSuggestions ( Keyword, OrganizationID, PostName, SuggestionsName, SuggestionsType, SuggestionsGroup, SuggestionsText, Propounder, ProposedTime, Creator,CreateTime,Remarks) values ( @Keyword, @OrganizationID, @PostName, @SuggestionsName, @SuggestionsType, @SuggestionsGroup, @SuggestionsText, @Propounder, @ProposedTime, @Creator, @CreateTime, @Remarks)"; SqlParameter[] m_Parameters = { new SqlParameter("@Keyword", myKeyword), new SqlParameter("@OrganizationID", myOrganizationID), new SqlParameter("@PostName", myPostName), new SqlParameter("@SuggestionsName", mySuggestionsName), new SqlParameter("@SuggestionsType", mySuggestionsType), new SqlParameter("@SuggestionsGroup", mySuggestionsGroup), new SqlParameter("@SuggestionsText", mySuggestionsText), new SqlParameter("@Propounder", myPropounder), new SqlParameter("@ProposedTime", myProposedTime), new SqlParameter("@Creator", myCreator), new SqlParameter("@CreateTime", DateTime.Now), new SqlParameter("@Remarks", myRemarks) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { return(-1); } }
public static int AddEnergyProcessRecord(string myRecordItemId, string myRecordName, string myDepartmentName, string myOrganizationID, string myRecordType, string myRecordTypeGroup, string myRecorder, string myRecordTime, string myRecordText, string myCreator, string myRemarks) { string m_Sql = @"Insert into experience_EnergyProcessRecord ( RecordItemId, RecordName, OrganizationID, Department, RecordType, RecordTypeGroup, Recorder, RecordTime, RecordText, Creator, CreateTime, Remarks) values ( @RecordItemId, @RecordName, @OrganizationID, @Department, @RecordType, @RecordTypeGroup, @Recorder, @RecordTime, @RecordText, @Creator, @CreateTime, @Remarks)"; SqlParameter[] m_Parameters = { new SqlParameter("@RecordItemId", myRecordItemId), new SqlParameter("@RecordName", myRecordName), new SqlParameter("@OrganizationID", myOrganizationID), new SqlParameter("@Department", myDepartmentName), new SqlParameter("@RecordType", myRecordType), new SqlParameter("@RecordTypeGroup", myRecordTypeGroup), new SqlParameter("@Recorder", myRecorder), new SqlParameter("@RecordTime", myRecordTime), new SqlParameter("@RecordText", myRecordText), new SqlParameter("@Creator", myCreator), new SqlParameter("@CreateTime", DateTime.Now), new SqlParameter("@Remarks", myRemarks) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { return(-1); } }
/// <summary> /// 根据KeyId删除能源计划信息 /// </summary> /// <param name="myKeyId">KeyId</param> /// <returns>是否删除成功</returns> public static int DeleteProductionPlanInfo(string myKeyId, string myProductionPlanType) { string m_Sql = @"DELETE FROM plan_ProductionYearlyPlan where KeyId=@KeyId and QuotasID in (Select A.QuotasID as QuotasID from plan_ProductionPlan_Template A where Type = @Type)"; SqlParameter[] m_Parameters = { new SqlParameter("@KeyId", myKeyId), new SqlParameter("@Type", myProductionPlanType) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception) { return(-1); } }
/// <summary> /// 根据KeyId删除能源计划信息 /// </summary> /// <param name="myKeyId">KeyId</param> /// <returns>是否删除成功</returns> public static int DeleteEnergyConsumptionInfo(string myKeyId) { string m_Sql = @"DELETE FROM plan_EnergyConsumptionYearlyPlan where KeyId=@KeyId"; SqlParameter[] m_Parameters = { new SqlParameter("@KeyId", myKeyId) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception) { return(-1); } }
public static int AddMasterMachineInfo(string myOrganizationId, string myEquipmentId, string myVariableId, string myOutputFormula, string myVariableName, string myVariableDescription, string myDataBaseName, string myTableName, string myRecord, string myValidValues, string myRemarks) { string m_Sql = @" Insert into system_MasterMachineDescription ( ID, OrganizationID, VariableId, OutputField, VariableName, VariableDescription, DataBaseName, TableName, Record, ValidValues, Remarks, KeyID) values (@EquipmentId,@OrganizationID,@VariableId,@OutputFormula,@VariableName,@VariableDescription,@DataBaseName,@TableName,@Record,@ValidValues,@Remarks,@EquipmentId)"; SqlParameter[] m_Parameters = { new SqlParameter("@EquipmentId", myEquipmentId), new SqlParameter("@OrganizationID", myOrganizationId), new SqlParameter("@VariableId", myVariableId), new SqlParameter("@OutputFormula", myOutputFormula), new SqlParameter("@VariableName", myVariableName), new SqlParameter("@VariableDescription", myVariableDescription), new SqlParameter("@DataBaseName", myDataBaseName), new SqlParameter("@TableName", myTableName), new SqlParameter("@Record", myRecord), new SqlParameter("@ValidValues", myValidValues), new SqlParameter("@Remarks", myRemarks) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { var m_e = e; return(-1); } }
public static int AddEnergyDataManualInputContrast(string addData) { int result = 0; string testSql = @"select * from system_EnergyDataManualInputContrast where VariableId=@variableId"; SqlParameter[] testParameters = { new SqlParameter("@variableId", addData.JsonPick("variableId")) }; DataTable testTable = _dataFactory.Query(testSql, testParameters); if (testTable.Rows.Count == 0) { string insertSql = @"insert into system_EnergyDataManualInputContrast (VariableId,VariableName,Type,Enabled,Creator,CreateTime,Remark,GroupId) values (@variableId,@variableName,@type,@enabled,@creator,@createTime,@remark,@role)"; IList <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@variableId", addData.JsonPick("variableId"))); parameters.Add(new SqlParameter("@variableName", addData.JsonPick("variableName"))); parameters.Add(new SqlParameter("@type", addData.JsonPick("type"))); parameters.Add(new SqlParameter("@enabled", addData.JsonPick("enabled"))); parameters.Add(new SqlParameter("@creator", addData.JsonPick("creator"))); parameters.Add(new SqlParameter("@createTime", addData.JsonPick("createTime"))); parameters.Add(new SqlParameter("@remark", addData.JsonPick("remark"))); parameters.Add(new SqlParameter("@role", addData.JsonPick("role"))); result = _dataFactory.ExecuteSQL(insertSql, parameters.ToArray()); } else { result = -2; //ID重复 } return(result); }
public static int DeletePVFData(string keyId) { int result; string deletePVF = @"DELETE FROM system_PVF WHERE KeyID=@keyId"; string deleteDetail = @"DELETE FROM system_PVF_Detail WHERE KeyID=@keyId"; using (TransactionScope scope = new TransactionScope()) { try { _dataFactory.ExecuteSQL(deletePVF, new SqlParameter("@keyId", keyId)); _dataFactory.ExecuteSQL(deleteDetail, new SqlParameter("@keyId", keyId)); scope.Complete(); result = 1; } catch { result = -1; } } return result; }
public static int AddFileInfo(string myFileName, string myFileGroupId, string myFileClassify, string myFilePath, string myFileType, string myUserId) { string m_Sql = @"Insert into system_UserFiles ( FileName, FileGroupId, FileClassify, FilePath, FileType,UserId, CreateTime) values ( @FileName, @FileGroupId, @FileClassify, @FilePath, @FileType, @UserId, @CreateTime)"; SqlParameter[] m_Parameters = { new SqlParameter("@FileName", myFileName), new SqlParameter("@FileGroupId", myFileGroupId), new SqlParameter("@FileClassify", myFileClassify), new SqlParameter("@FilePath", myFilePath), new SqlParameter("@FileType", myFileType), new SqlParameter("@UserId", myUserId), new SqlParameter("@CreateTime", DateTime.Now) }; try { return(_dataFactory.ExecuteSQL(m_Sql, m_Parameters)); } catch (Exception e) { return(-1); } }
public static int SaveShiftInfo(string organizationId, string[] json) { int result; string deleteStr = @"DELETE FROM system_ShiftDescription WHERE OrganizationID=@organizationId"; DataTable dt = _dataHelper.CreateTableStructure("system_ShiftDescription"); DataTable sourceDt = EasyUIJsonParser.DataGridJsonParser.JsonToDataTable(json, dt); DateTime time = System.DateTime.Now; foreach (DataRow dr in sourceDt.Rows) { dr["OrganizationID"] = organizationId; dr["CreatedDate"] = time; dr["ShiftDescriptionID"] = System.Guid.NewGuid().ToString(); } try { _dataFactory.ExecuteSQL(deleteStr, new SqlParameter("@organizationId", organizationId)); int affected = _dataFactory.Save("system_ShiftDescription", sourceDt); if (affected != -1) { result = 1; } else { result = -1; } } catch { result = -1; } return(result); }
public int Update(string organizationId, Name name, TypeModify typeModify) { int result = 0; string updateSql = @"update system_Flag_Data_Modified set flag_modified=@flagModified, DateModified=@dateModified,TypeModify=@typeModified where OrganizationID=@organizationId and Name=@name"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@organizationId", organizationId)); parameters.Add(new SqlParameter("@name", GetNameByEnum(name))); parameters.Add(new SqlParameter("@typeModified", typeModify)); parameters.Add(new SqlParameter("@dateModified", DateTime.Now)); parameters.Add(new SqlParameter("@flagModified", 1)); _dataFactory.ExecuteSQL(updateSql, parameters.ToArray()); return(result); }