public int ImportLoca(ImportLocation il) { string sql = "INSERT INTO NetBarInfo (NETBAR_WACODE,PLACE_NAME,SITE_ADDRESS,LONGITUDE,LATITUDE,NETSITE_TYPE,BUSINESS_NATURE,LAW_PRINCIPAL_NAME,RELATIONSHIP_ACCOUNT,CODE_ALLOCATION_ORGANIZATION,Statis,Valid,Createtime,Verified,Service_code,ProID,CityID,Aid,Pid,[Sid],APNum,SecId)VALUES(@NETBAR_WACODE,@PLACE_NAME,@SITE_ADDRESS,@LONGITUDE,@LATITUDE,@NETSITE_TYPE,1,@LAW_PRINCIPAL_NAME,@RELATIONSHIP_ACCOUNT,'" + il.SECURITY_SOFTWARE_ORGCODE + "',1,1,GETDATE(),1,@Service_code,@ProID,@CityID,@Aid,@Pid,@Sid,@APNum,@SecId); SELECT SCOPE_IDENTITY();"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@NETBAR_WACODE", il.NETBAR_WACODE), new SqlParameter("@PLACE_NAME", il.LocaName), new SqlParameter("@SITE_ADDRESS", il.Address), new SqlParameter("@NETSITE_TYPE", il.LocaType), new SqlParameter("@LONGITUDE", (il.ApType == 1 ? il.LONGITUDE : null)), new SqlParameter("@LATITUDE", (il.ApType == 1 ? il.LATITUDE : null)), new SqlParameter("@LAW_PRINCIPAL_NAME", il.UserName), new SqlParameter("@RELATIONSHIP_ACCOUNT", il.Mobile), new SqlParameter("@Service_code", il.Service_code), new SqlParameter("@ProID", il.ProId), new SqlParameter("@CityID", il.CityId), new SqlParameter("@Aid", il.Aid), new SqlParameter("@Pid", il.Pid), new SqlParameter("@Sid", il.Sid), new SqlParameter("@APNum", 0), new SqlParameter("@SecId", (il.QecurityName.Contains("舜游")?8:1)) }; return(Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.DBConnStr, CommandType.Text, sql, param))); }
/// <summary> /// 修改场所信息 /// </summary> /// <param name="il"></param> /// <returns></returns> public int UpdateLocaById(ImportLocation il) { string sql = "UPDATE NetBarInfo SET PLACE_NAME = @LocaName,SITE_ADDRESS = @Address,LAW_PRINCIPAL_NAME = @UserName,RELATIONSHIP_ACCOUNT = @Mobile"; sql += (!string.IsNullOrEmpty(il.LONGITUDE) ? ",LONGITUDE = @Longitude" : ""); sql += (!string.IsNullOrEmpty(il.LATITUDE) ? ",LATITUDE = @Latitude" : ""); sql += (il.verify != 0 ? ",Verified = @IsVerify" : ""); sql += ",IsUpdate_NETBAR_WACODE=(SELECT CASE WHEN nbi.NETBAR_WACODE ='' OR nbi.NETBAR_WACODE IS NULL THEN 1 ELSE 0 END FROM NetBarInfo nbi WHERE nbi.ID=@Id)"; sql += (il.LocaType != 0 ? ",NETSITE_TYPE = @LocaType" : ""); sql += (il.Sid != 0 ? ",ProID = @ProID,CityID = @CityID,Aid = @Aid,Pid = @Pid,[Sid] = @Sid" : ""); sql += " WHERE ID=@Id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@LocaName", il.LocaName), new SqlParameter("@Address", il.Address), new SqlParameter("@UserName", il.UserName), new SqlParameter("@Mobile", il.Mobile), new SqlParameter("@Longitude", il.LONGITUDE), new SqlParameter("@Latitude", il.LATITUDE), new SqlParameter("@LocaType", il.LocaType), new SqlParameter("@IsVerify", il.verify), new SqlParameter("@ProID", il.ProId), new SqlParameter("@CityID", il.CityId), new SqlParameter("@Aid", il.Aid), new SqlParameter("@Pid", il.Pid), new SqlParameter("@Sid", il.Sid), new SqlParameter("@Id", il.NetBarId) }; return(SqlHelper.ExecuteNonQuery(SqlHelper.DBConnStr, CommandType.Text, sql, param)); }
public void Init_SidAndTextUnknown() { var location = new ImportLocation(); Assert.AreEqual(null, location.ImportName); Assert.AreEqual(0, location.Sid); }
public void Bool_NotEqualsOperator(string text1, int sid1, string text2, int sid2) { var location1 = new ImportLocation(text1, sid1); var location2 = new ImportLocation(text2, sid2); Assert.IsTrue(location1 != location2); }
public static void AddImport ( this MSBuildProject project, string importedProjectFile, ImportLocation importLocation, string condition) { MSBuildObject before = GetInsertBeforeObject (project, importLocation); project.AddNewImport (importedProjectFile, condition, before); }
private void ProcessLocation(IUnitOfWork db, ImportLocation location, string ourStyleId) { int firstIsle = GetInts(location.Isle).First(); int firstSection = GetInts(location.Section).First(); int firstShelf = GetInts(location.Shelf).First(); var dbStyle = db.Styles.GetAll().FirstOrDefault(s => s.StyleID == ourStyleId && !s.Deleted); if (dbStyle == null) { throw new ArgumentOutOfRangeException("can't found style: " + ourStyleId); } var dbExistLocations = db.StyleLocations.GetByStyleId(dbStyle.Id); var dbExistLocation = dbExistLocations.FirstOrDefault(l => l.Isle == location.Isle && l.Section == location.Section && l.Shelf == location.Shelf); if (dbExistLocation == null) { var existIsDefault = dbExistLocations.Any(s => s.IsDefault); db.StyleLocations.Add(new StyleLocation() { StyleId = dbStyle.Id, Isle = location.Isle, Section = location.Section, Shelf = location.Shelf, SortIsle = firstIsle, SortSection = firstSection, SortShelf = firstShelf, IsDefault = location.IsDefault && !existIsDefault, CreateDate = DateTime.UtcNow, UpdateDate = DateTime.UtcNow }); db.Commit(); Console.WriteLine("Added: styleId=" + dbStyle.StyleID + ", isle=" + location.Isle + ", section=" + location.Section + ", shelf=" + location.Shelf); } else { if (dbExistLocation.IsDefault != location.IsDefault) { dbExistLocation.IsDefault = location.IsDefault; db.Commit(); } } if (dbExistLocations.Count(s => s.IsDefault) > 1) { var dbExistDefaultLocations = dbExistLocations.Where(l => l.IsDefault).ToList(); for (int i = 1; i < dbExistDefaultLocations.Count; i++) { dbExistDefaultLocations[i].IsDefault = false; } db.Commit(); } }
public virtual void AddImport(string targetFullPath, ImportLocation location) { if (targetFullPath == null) { throw new ArgumentNullException("targetFullPath"); } MsBuildProject.AddImport(targetFullPath, location == ImportLocation.Top ? true : false); }
public void EqualsMethod() { var location = CreateSampleToken(); var equalLocation = new ImportLocation("yo", 30); var unEqualLocation = new ImportLocation("yo", 31); Assert.IsTrue(location.Equals(equalLocation)); Assert.IsFalse(location.Equals(unEqualLocation)); }
public static void AddImport( this MSBuildProject project, string importedProjectFile, ImportLocation importLocation, string condition) { MSBuildObject before = GetInsertBeforeObject(project, importLocation); project.AddNewImport(importedProjectFile, condition, before); }
public static void AddImport( this MSBuildProject project, string importedProjectFile, ImportLocation importLocation, string condition) { var before = importLocation == ImportLocation.Top ? project.GetAllObjects().FirstOrDefault() : null; project.AddNewImport(importedProjectFile, condition, before); }
private void AddImportStatementForVS2013(ImportLocation location, string relativeTargetPath) { NuGetVS.ProjectHelper.DoWorkInWriterLock( EnvDTEProject, VsHierarchyUtility.ToVsHierarchy(EnvDTEProject), buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location)); // notify the project system of the change UpdateImportStamp(EnvDTEProject, true); }
private void AddImportStatementForVS2013(ImportLocation location, string relativeTargetPath) { NuGetVS.ProjectHelper.DoWorkInWriterLock( EnvDTEProject, VsHierarchyUtility.ToVsHierarchy(EnvDTEProject), buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location)); // notify the project system of the change UpdateImportStamp(EnvDTEProject, true); }
static MSBuildObject GetInsertBeforeObject (MSBuildProject project, ImportLocation importLocation) { if (importLocation == ImportLocation.Top) { return project.GetAllObjects ().FirstOrDefault (); } // Return an unknown MSBuildItem instead of null so the MSBuildProject adds the import as the last // child in the project. return new MSBuildItem (); }
public static void AddImportIfMissing ( this MSBuildProject project, string importedProjectFile, ImportLocation importLocation, string condition) { if (project.ImportExists (importedProjectFile)) return; project.AddImport (importedProjectFile, importLocation, condition); }
public void AddImport(string targetFullPath, ImportLocation location) { GuiSyncDispatch(async() => { string relativeTargetPath = GetRelativePath(targetFullPath); string condition = GetCondition(relativeTargetPath); using (var handler = CreateNewImportsHandler()) { handler.AddImportIfMissing(relativeTargetPath, condition, location); await project.SaveAsync(); } }); }
static MSBuildObject GetInsertBeforeObject(MSBuildProject project, ImportLocation importLocation) { if (importLocation == ImportLocation.Top) { return(project.GetAllObjects().FirstOrDefault()); } // Return an unknown MSBuildItem instead of null so the MSBuildProject adds the import as the last // child in the project. return(new MSBuildItem()); }
/// <summary> /// 修改AP信息 /// </summary> /// <param name="il"></param> /// <returns></returns> public int UpdateDevById(ImportLocation il) { string sql = "UPDATE devinfo SET APName = @APName WHERE ID=@Id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@APName", il.ApName), new SqlParameter("@Id", il.DveId) }; return(SqlHelper.ExecuteNonQuery(SqlHelper.DBConnStr, CommandType.Text, sql, param)); }
private async Task AddImportStatementForVS2013Async(ImportLocation location, string relativeTargetPath) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); await NuGetVS.ProjectHelper.DoWorkInWriterLockAsync( EnvDTEProject, VsHierarchyUtility.ToVsHierarchy(EnvDTEProject), buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location)); // notify the project system of the change UpdateImportStamp(EnvDTEProject); }
public static void AddImportIfMissing( this MSBuildProject project, string importedProjectFile, ImportLocation importLocation, string condition) { if (project.ImportExists(importedProjectFile)) { return; } project.AddImport(importedProjectFile, importLocation, condition); }
public override void AddImport(string targetFullPath, ImportLocation location) { // For VS 2012 or above, the operation has to be done inside the Writer lock if (string.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(nameof(targetFullPath)); } NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate { var root = await VsProjectAdapter.GetProjectDirectoryAsync(); var relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetFullPath); await AddImportStatementAsync(location, relativeTargetPath); }); }
public virtual void AddImport(string targetFullPath, ImportLocation location) { if (String.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(EnvDTEProjectUtility.GetFullPath(EnvDTEProject)), targetFullPath); EnvDTEProjectUtility.AddImportStatement(EnvDTEProject, relativeTargetPath, location); EnvDTEProjectUtility.Save(EnvDTEProject); // notify the project system of the change UpdateImportStamp(EnvDTEProject); }
public virtual void AddImport(string targetFullPath, ImportLocation location) { Assumes.NotNullOrEmpty(targetFullPath); NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(ProjectFullPath), targetFullPath); AddImportStatement(relativeTargetPath, location); await SaveProjectAsync(); // notify the project system of the change UpdateImportStamp(VsProjectAdapter); }); }
public override void AddImport(string targetFullPath, ImportLocation location) { // For VS 2012 or above, the operation has to be done inside the Writer lock if (String.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(nameof(targetFullPath)); } ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var root = EnvDTEProjectUtility.GetFullPath(EnvDTEProject); string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetFullPath); await AddImportStatementForVS2013Async(location, relativeTargetPath); }); }
public void AddImport(string targetFullPath, ImportLocation location) { if (targetFullPath == null) { throw new ArgumentNullException(nameof(targetFullPath)); } var targetRelativePath = NuGet.PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(_projectDirectory), targetFullPath); var imports = Project.Xml.Imports; bool notImported = true; if (imports != null) { foreach (dynamic import in imports) { if (targetRelativePath.Equals(import.Project, StringComparison.OrdinalIgnoreCase)) { notImported = false; break; } } } else { notImported = true; } if (notImported) { var pie = Project.Xml.AddImport(targetRelativePath); pie.Condition = "Exists('" + targetRelativePath + "')"; if (location == ImportLocation.Top) { // There's no public constructor to create a ProjectImportElement directly. // So we have to cheat by adding Import at the end, then remove it and insert at the beginning pie.Parent.RemoveChild(pie); Project.Xml.InsertBeforeChild(pie, Project.Xml.FirstChild); } AddEnsureImportedTarget(targetRelativePath); Project.ReevaluateIfNecessary(); } Project.Save(); }
/// <summary> /// 修改设备 /// </summary> /// <param name="il"></param> /// <returns></returns> public int updateImportDev(ImportLocation il) { string sql = "UPDATE DevInfo SET NETBAR_WACODE = @NETBAR_WACODE,NETBAR_ID = @NETBAR_ID,APType = @APType,ProjectType = @ProjectType,CasesType = @CasesType,APName = @APName,LONGITUDE=@LONGITUDE,LATITUDE=@LATITUDE,Verified=1 WHERE ID=@devId"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@NETBAR_WACODE", il.NETBAR_WACODE), new SqlParameter("@LONGITUDE", (il.ApType == 1 ? il.LONGITUDE : null)), new SqlParameter("@LATITUDE", (il.ApType == 1 ? il.LATITUDE : null)), new SqlParameter("@devId", il.DveId), new SqlParameter("@NETBAR_ID", il.NetBarId), new SqlParameter("@APType", il.ApType), new SqlParameter("@ProjectType", il.ProjectType), new SqlParameter("@CasesType", il.CasesType), new SqlParameter("@APName", il.ApName) }; return(SqlHelper.ExecuteNonQuery(SqlHelper.DBConnStr, CommandType.Text, sql, param)); }
/// <summary> /// 添加设备 /// </summary> /// <param name="il"></param> /// <returns></returns> public int ImportDev(ImportLocation il) { string sql = "INSERT INTO DevInfo (COLLECTION_EQUIPMENT_ID,AP_MAC,NETBAR_WACODE,LONGITUDE,LATITUDE,NETBAR_ID,APType,Verified,CreateTime,DevStatis,Lguid,IsTrial,ProjectType,CasesType,ModeType,LogCapture,APName,Channel,IsReboot,ForcedOfflineTime,FenceOffTime,isopen,PastTime) VALUES(@COLLECTION_EQUIPMENT_ID,@AP_MAC,@NETBAR_WACODE,@LONGITUDE,@LATITUDE,@NETBAR_ID,@APType,1,GETDATE(),2,NEWID(),0,@ProjectType,@CasesType,1,7,@APName,11,0,30,0,1,999) "; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@COLLECTION_EQUIPMENT_ID", il.SECURITY_SOFTWARE_ORGCODE + il.Mac.Replace("-", "")), new SqlParameter("@AP_MAC", il.Mac), new SqlParameter("@NETBAR_WACODE", il.NETBAR_WACODE), new SqlParameter("@LONGITUDE", (il.ApType == 1 ? il.LONGITUDE : null)), new SqlParameter("@LATITUDE", (il.ApType == 1 ? il.LATITUDE : null)), new SqlParameter("@NETBAR_ID", il.NetBarId), new SqlParameter("@APType", il.ApType), new SqlParameter("@ProjectType", il.ProjectType), new SqlParameter("@CasesType", il.CasesType), new SqlParameter("@APName", il.ApName) }; return(SqlHelper.ExecuteNonQuery(SqlHelper.DBConnStr, CommandType.Text, sql, param)); }
public virtual void AddImport(string targetFullPath, ImportLocation location) { if (String.IsNullOrEmpty(targetFullPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(ProjectFullPath), targetFullPath); EnvDTEProjectUtility.AddImportStatement(EnvDTEProject, relativeTargetPath, location); EnvDTEProjectUtility.Save(EnvDTEProject); // notify the project system of the change UpdateImportStamp(EnvDTEProject); }); }
public override void AddImport(string targetPath, ImportLocation location) { // For VS 2012 or above, the operation has to be done inside the Writer lock if (String.IsNullOrEmpty(targetPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } var root = EnvDTEProjectUtility.GetFullPath(EnvDTEProject); string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetPath); if (VSVersionHelper.IsVisualStudio2012) { EnvDTEProjectUtility.DoWorkInWriterLock(EnvDTEProject, buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location)); EnvDTEProjectUtility.Save(EnvDTEProject); } else { AddImportStatementForVS2013(location, relativeTargetPath); } }
internal static void AddImportStatement(MicrosoftBuildEvaluationProject msBuildProject, string targetsPath, ImportLocation location) { if (msBuildProject.Xml.Imports == null || msBuildProject.Xml.Imports.All(import => !targetsPath.Equals(import.Project, StringComparison.OrdinalIgnoreCase))) { ProjectImportElement pie = msBuildProject.Xml.AddImport(targetsPath); pie.Condition = "Exists('" + targetsPath + "')"; if (location == ImportLocation.Top) { // There's no public constructor to create a ProjectImportElement directly. // So we have to cheat by adding Import at the end, then remove it and insert at the beginning pie.Parent.RemoveChild(pie); msBuildProject.Xml.InsertBeforeChild(pie, msBuildProject.Xml.FirstChild); } AddEnsureImportedTarget(msBuildProject, targetsPath); msBuildProject.ReevaluateIfNecessary(); } }
public override void AddImport(string targetPath, ImportLocation location) { // For VS 2012 or above, the operation has to be done inside the Writer lock if (String.IsNullOrEmpty(targetPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } var root = EnvDTEProjectUtility.GetFullPath(EnvDTEProject); string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(root), targetPath); if (VSVersionHelper.IsVisualStudio2012) { EnvDTEProjectUtility.DoWorkInWriterLock(EnvDTEProject, buildProject => MicrosoftBuildEvaluationProjectUtility.AddImportStatement(buildProject, relativeTargetPath, location)); EnvDTEProjectUtility.Save(EnvDTEProject); } else { AddImportStatementForVS2013(location, relativeTargetPath); } }
public void AddImportIfMissing (string name, string condition, ImportLocation location) { ImportsAdded.Add (new ImportAndCondition (name, condition, location)); }
private void AddImportStatement(string targetsPath, ImportLocation location) { // Need NOT be on the UI Thread MicrosoftBuildEvaluationProjectUtility.AddImportStatement( EnvDTEProjectUtility.AsMSBuildEvaluationProject(VsProjectAdapter.FullName), targetsPath, location); }
public void AddImportIfMissing (string name, string condition, ImportLocation location) { this.name = name; this.condition = condition; this.location = location; }
void AssertFirstImportHasImportLocation (ImportLocation expectedLocation) { ImportAndCondition import = projectSystem.NewImportsHandler.ImportsAdded.First (); Assert.AreEqual (expectedLocation, import.Location); }
internal static void AddImportStatement(EnvDTE.Project project, string targetsPath, ImportLocation location) { // Need NOT be on the UI Thread MicrosoftBuildEvaluationProjectUtility.AddImportStatement(AsMSBuildProject(project), targetsPath, location); }
public IonSymbol(SymbolToken symbolToken) : base(symbolToken.Text, symbolToken == default) { _sid = symbolToken.Sid; _importLocation = symbolToken.ImportLocation; }
public ImportAndCondition (string name, string condition, ImportLocation location) { Name = name; Condition = condition; Location = location; }
public void AddImport(string targetFullPath, ImportLocation location) { }
public void AddImport(string targetFullPath, ImportLocation location) { Imports.Add(targetFullPath); }
public static void AddImportStatement(EnvDTEProject project, string targetsPath, ImportLocation location) { MicrosoftBuildEvaluationProjectUtility.AddImportStatement(AsMSBuildProject(project), targetsPath, location); }
internal static void AddImportStatement(MicrosoftBuildEvaluationProject msBuildProject, string targetsPath, ImportLocation location) { if (msBuildProject.Xml.Imports == null || msBuildProject.Xml.Imports.All(import => !targetsPath.Equals(import.Project, StringComparison.OrdinalIgnoreCase))) { ProjectImportElement pie = msBuildProject.Xml.AddImport(targetsPath); pie.Condition = "Exists('" + targetsPath + "')"; if (location == ImportLocation.Top) { // There's no public constructor to create a ProjectImportElement directly. // So we have to cheat by adding Import at the end, then remove it and insert at the beginning pie.Parent.RemoveChild(pie); msBuildProject.Xml.InsertBeforeChild(pie, msBuildProject.Xml.FirstChild); } AddEnsureImportedTarget(msBuildProject, targetsPath); msBuildProject.ReevaluateIfNecessary(); } }
public override void AddImport(string targetPath, ImportLocation location) { // Web sites are not msbuild based and do not support imports. }