protected override void ExecuteInternal(JobExecutionContext context) { string connStr = ConfigurationManager.AppSettings["mergeData"].ToString(); SqlConnection conn = new SqlConnection(connStr); conn.Open(); SqlTransaction tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted); var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; var strInfo = new StringBuilder(); strInfo.AppendFormat("ChinaJci data Sync begin at {0}\n", DateTime.UtcNow.ToGmt8String()); var lastSyncTime = new DateTime(1900, 1, 1); using (var cneEntities = new CnEEntities()) { var date = cneEntities.SCHEDULERLOGs.Where(x => x.STATUS == 0 && x.JOBTYPE == JobType).Select( x => (DateTime?)x.STARTTIME).Max(); if (date != null) { //ToGMT8 lastSyncTime = date.Value.AddHours(8); } } try { #region 执行数据同步程序 MergeData merge = new MergeData(); //merge.Execute(conn, tran); tran.Commit(); #endregion var endTime = DateTime.UtcNow; strInfo.AppendFormat("Synchronization completed at {0}.\n", endTime.ToGmt8String()); logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } finally { conn.Close(); } }
public void IsFreeDomainIsCharged(string hostingType) { try { PageInitHelper <PageNavigationHelper> .PageInit.NavigationTo(UiConstantHelper.Hosting, hostingType); //UiConstantHelper.DomainNameSearch Assert.IsTrue(PageInitHelper <PageValidationHelper> .PageInit.TitleIsAt(hostingType.Trim()), "The Page Redirect to some other page - " + BrowserInit.Driver.Title + " instead of " + hostingType); var dicHostingProduct = PageInitHelper <HostingPage> .PageInit.SelectHostingProduct(hostingType); //Select domain var listDicHostingProduct = PageInitHelper <DomainSelectionPage> .PageInit.DomainNamesForHosting(hostingType, dicHostingProduct[0], null, UiConstantHelper.FreeDomain); AMerge mergeTWoListOfDic = new MergeData(); var mergedListDic = mergeTWoListOfDic.MergingTwoListOfDic(dicHostingProduct, listDicHostingProduct); //ICartValidation cartValidation = new ProductListCartValidation(); //var dicWidgetValidation = cartValidation.CartWidgetValidation(mergedListDic); //Remove Hosting from Cart Items PageInitHelper <HostingPage> .PageInit.ValidateFreeDomainIsCharged(mergedListDic); } catch (Exception ex) { PageInitHelper <LoggerHelper> .PageInit.CaptureException(ex); var exceptionType = ex.GetType().ToString(); var namespaceName = GetType().Namespace; PageInitHelper <TestFinalizerHelper> .PageInit.Testclosure(namespaceName, ex); PageInitHelper <ExceptionType> .PageInit.ThrowException(exceptionType, ex); } }
private string MergeWorkingFiles(MergeData mergeData, string fileInstructionsKey, Language language) { var workingPath = ParameterUtils.GetParameter <string>(mergeData.WorkingFilePathKey) + "/" + GetWorkingPathLanguageString(language); Log.Info("MergeWorkingFiles working path: " + workingPath); var fileList = Directory.EnumerateFiles(workingPath); fileList = fileList.OrderBy(fileName => fileName, FileNameComparerObject); string languageString = GetLanguageString(language); var outputPath = OutputFolderPath + "/" + ParameterUtils.GetParameter <string>(mergeData.OutputFileBaseNameKey) + "_" + fileInstructionsKey + "_" + languageString + DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; using (var writer = new StreamWriter(outputPath)) { writer.WriteLine(mergeData.FeedTypeFileHeader); foreach (string filePath in fileList) { using (var reader = new StreamReader(filePath)) { string line; while ((line = reader.ReadLine()) != null) { writer.WriteLine(line); } } } } return(outputPath); }
private void CalculateMergeData(ref MergeData data) { var mergeBlockDefinition = this.BlockDefinition as MyMergeBlockDefinition; float maxStrength = mergeBlockDefinition != null ? mergeBlockDefinition.Strength : 0.1f; data.Distance = (float)(WorldMatrix.Translation - m_other.WorldMatrix.Translation).Length() - CubeGrid.GridSize; data.StrengthFactor = (float)Math.Exp(-data.Distance / CubeGrid.GridSize); // Debug.Assert(x <= 1.0f); // This is not so important, but testers kept reporting it, so let's leave it commented out :-) float strength = MathHelper.Lerp(0.0f, maxStrength * (CubeGrid.GridSizeEnum == MyCubeSize.Large ? 0.005f : 0.1f), data.StrengthFactor); // 0.005 for large grid, 0.1 for small grid!? Vector3 thisVelocity = CubeGrid.Physics.GetVelocityAtPoint(PositionComp.GetPosition()); Vector3 otherVelocity = m_other.CubeGrid.Physics.GetVelocityAtPoint(m_other.PositionComp.GetPosition()); data.RelativeVelocity = otherVelocity - thisVelocity; float velocityFactor = 1.0f; // The quicker the ships move towards each other, the weaker the constraint strength float rvLength = data.RelativeVelocity.Length(); velocityFactor = Math.Max(3.6f / (rvLength > 0.1f ? rvLength : 0.1f), 1.0f); data.ConstraintStrength = strength / velocityFactor; Vector3 toOther = m_other.PositionComp.GetPosition() - PositionComp.GetPosition(); Vector3 forward = WorldMatrix.GetDirectionVector(m_forward); data.Distance = (toOther).Length(); data.PositionOk = data.Distance < CubeGrid.GridSize + 0.17f; // 17 cm is tested working value. 15 cm was too few data.AxisDelta = (float)(forward + m_other.WorldMatrix.GetDirectionVector(m_forward)).Length(); data.AxisOk = data.AxisDelta < 0.1f; data.RotationDelta = (float)(WorldMatrix.GetDirectionVector(m_right) - m_other.WorldMatrix.GetDirectionVector(m_other.m_otherRight)).Length(); data.RotationOk = data.RotationDelta < 0.08f; }
public List <SortedDictionary <string, string> > ValidateInPurchaseSumarypage(List <SortedDictionary <string, string> > mergedScAndCartWidgetList) { APurchaseSummaryPageValidation ordersummary = new ValidatePurchaseSummary(); var purcasedOrderNumber = ordersummary.PurchaseSummaryPage(); AMerge mergeTWoListOfDic = new MergeData(); var mergedPurchaseSummaryItemsAndScItemsList = mergeTWoListOfDic.MergingTwoListOfDic(purcasedOrderNumber, mergedScAndCartWidgetList); return(mergedPurchaseSummaryItemsAndScItemsList); }
/// <summary> Runs the merge protocol as a leader</summary> public virtual void Run() { MergeData combined_merge_data = null; if (Enclosing_Instance.merging == true) { Enclosing_Instance.gms.Stack.NCacheLog.Warn("CoordGmsImpl.Run()", "merge is already in progress, terminating"); return; } Enclosing_Instance.gms.Stack.NCacheLog.Debug("CoordGmsImpl.Run()", "merge task started"); try { /* 1. Generate a merge_id that uniquely identifies the merge in progress */ Enclosing_Instance.merge_id = Enclosing_Instance.generateMergeId(); /* 2. Fetch the current Views/Digests from all subgroup coordinators */ Enclosing_Instance.getMergeDataFromSubgroupCoordinators(coords, Enclosing_Instance.gms.merge_timeout); /* 3. Remove rejected MergeData elements from merge_rsp and coords (so we'll send the new view only * to members who accepted the merge request) */ Enclosing_Instance.removeRejectedMergeRequests(coords); if (Enclosing_Instance.merge_rsps.Count <= 1) { Enclosing_Instance.gms.Stack.NCacheLog.Warn("CoordGmsImpl.Run()", "merge responses from subgroup coordinators <= 1 (" + Global.CollectionToString(Enclosing_Instance.merge_rsps) + "). Cancelling merge"); Enclosing_Instance.sendMergeCancelledMessage(coords, Enclosing_Instance.merge_id); return; } /* 4. Combine all views and digests into 1 View/1 Digest */ combined_merge_data = Enclosing_Instance.consolidateMergeData(Enclosing_Instance.merge_rsps); if (combined_merge_data == null) { Enclosing_Instance.gms.Stack.NCacheLog.Error("CoordGmsImpl.Run()", "combined_merge_data == null"); Enclosing_Instance.sendMergeCancelledMessage(coords, Enclosing_Instance.merge_id); return; } /* 5. Send the new View/Digest to all coordinators (including myself). On reception, they will * install the digest and view in all of their subgroup members */ Enclosing_Instance.sendMergeView(coords, combined_merge_data); } catch (System.Exception ex) { Enclosing_Instance.gms.Stack.NCacheLog.Error("MergeTask.Run()", ex.ToString()); } finally { Enclosing_Instance.merging = false; Enclosing_Instance.gms.Stack.NCacheLog.Debug("CoordGmsImpl.Run()", "merge task terminated"); t = null; } }
private void btnStart_Click(object sender, EventArgs e) { if (thread == null || thread.ThreadState == ThreadState.Stopped) { lblStatus.Text = "Chuẩn bị nhập dữ liệu..."; Memory.Instance.SetMemory("UserAbort", false); EnableControl(false); progressBar1.Value = 0; string path = txtDB.Text; if (path != "" && path.EndsWith(".zip")) { FastZip zip = new FastZip(); string exPath = Memory.GetTempPath(""); zip.ExtractZip(path, exPath, "mdb"); path = exPath + "\\" + "giaoxu.mdb"; } ProcessVersion(path); import = new MergeData(path, "Admin", GxConstants.DB_PASSWORD); //For giao dan import.OverrideGiaoDan = radOverrideGiaoDan.Checked; import.ForceOverrideGiaoDan = radForceOverrideGiaoDan.Checked; //For gia dinh import.OverrideGiaDinh = radOverrideGiaDinh.Checked; import.ForceOverrideGiaDinh = radForceOverrideGiaDinh.Checked; //For hon phoi import.OverrideHonPhoi = radOverrideHonPhoi.Checked; import.ForceOverrideHonPhoi = radForceOverrideHonPhoi.Checked; //For giao ho import.OverrideGiaoHo = radOverrideGiaoHo.Checked; import.OnStart += new EventHandler(import_OnStart); import.OnExecuting += new EventHandler(import_OnImporting); import.OnError += new CancelEventHandler(import_OnError); import.OnFinished += new EventHandler(import_OnFinished); ThreadStart threadStart = new ThreadStart(import.Execute); thread = new Thread(threadStart); thread.Start(); } else if (thread.ThreadState == ThreadState.Suspended) { thread.Resume(); btnStart.Text = "Tạm &dừng"; } else if (thread.ThreadState == ThreadState.Running) { thread.Suspend(); btnStart.Text = "Tiếp &tục"; } }
private void btnStart_Click(object sender, EventArgs e) { if (thread == null || thread.ThreadState == ThreadState.Stopped) { lblStatus.Text = "Chuẩn bị nhập dữ liệu..."; if (!ProcessVersion(filePath)) { return; } Memory.Instance.SetMemory("UserAbort", false); EnableControl(false); progressBar1.Value = 0; import = new MergeData(filePath, "Admin", GxConstants.DB_PASSWORD); //For giao dan import.OverrideGiaoDan = radOverrideGiaoDan.Checked; import.ForceOverrideGiaoDan = radForceOverrideGiaoDan.Checked; //For gia dinh import.OverrideGiaDinh = radOverrideGiaDinh.Checked; import.ForceOverrideGiaDinh = radForceOverrideGiaDinh.Checked; import.MaGiaoHoGiaDinh = cbGiaoHoGiaDinh.MaGiaoHo; //For hon phoi import.OverrideHonPhoi = radOverrideHonPhoi.Checked; import.ForceOverrideHonPhoi = radForceOverrideHonPhoi.Checked; //For giao ho import.OverrideGiaoHo = radOverrideGiaoHo.Checked; //For Dot Bi Tich import.OverrideBiTich = radOverrideDotBiTich.Checked; import.OnStart += new EventHandler(import_OnStart); import.OnExecuting += new EventHandler(import_OnImporting); import.OnError += new CancelEventHandler(import_OnError); import.OnFinished += new EventHandler(import_OnFinished); ThreadStart threadStart = new ThreadStart(import.Execute); thread = new Thread(threadStart); thread.Start(); } else if (thread.ThreadState == ThreadState.Suspended) { thread.Resume(); btnStart.Text = "Tạm &dừng"; } else if (thread.ThreadState == ThreadState.Running) { thread.Suspend(); btnStart.Text = "Tiếp &tục"; } }
protected override void ExecuteInternal(JobExecutionContext context) { var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; var strInfo = new StringBuilder(); string connStr = ConfigurationManager.AppSettings["mergeData"]; strInfo.AppendFormat("Source [Type: {0} Address: {1}]\n", "CusteelService", "http://db.custeel.com/services/dataCenterMTOMVerifyService"); strInfo.AppendFormat("Destination [Type: {0} Address: {1}]\n", "Oracle", connStr); var conn = new OracleConnection(connStr); conn.Open(); var tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); try { #region 执行数据同步程序 var ch = new CusteelData(); ch.SyncCusteelData(strInfo); #endregion var merge = new MergeData(); merge.ExecuteMetals(conn, tran); tran.Commit(); var endTime = DateTime.UtcNow; logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } finally { conn.Close(); } }
public List <SortedDictionary <string, string> > AddShoppingCartItemsToDic(List <SortedDictionary <string, string> > cartWidgetList, string whois, string premiumDns) { // PageInitHelper<AddProductShoppingCartItems>.PageInit.MessageAndAlertVerification(); var shoppingcartItemList = PageInitHelper <AddProductShoppingCartItems> .PageInit.AddShoppingCartItemsToDictionaries(cartWidgetList, whois, premiumDns); AVerify verifingTwoListOfDic = new VerifyData(); verifingTwoListOfDic.VerifyTwoListOfDic(shoppingcartItemList, cartWidgetList); AMerge mergeTWoListOfDic = new MergeData(); var mergedScAndCartWidgetDic = mergeTWoListOfDic.MergingTwoListOfDic(shoppingcartItemList, cartWidgetList); PageInitHelper <ShoppingCartPageFactory> .PageInit.ConfirmOrderBtn.Click(); return(mergedScAndCartWidgetDic); }
/// <summary> /// Returns SocketLabs SDK save MergeData object. /// </summary> /// <returns></returns> public MergeData GetMergeData() { //Needed to convert the inner list in to an array. var tempPerMessage = new List <MergeRow[]>(); foreach (var row in RecipientRow) { tempPerMessage.Add(row.ToArray()); } var mergeData = new MergeData { Global = GlobalMessageMergeData.ToArray(), PerMessage = tempPerMessage.ToArray() }; return(mergeData); }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; order.ShipAddress = address; order.ShipMobile = mobile; order.ShipName = shipName; order.ShipEmail = email; try { var id = new OrderDao().Insert(order); var cart = (List <CartItem>)Session[CommonConstants.CartSession]; var detailDao = new OrderDetailDao(); decimal total = 0; foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductID = item.Product.ID; orderDetail.OrderID = id; orderDetail.Price = item.Product.Price; orderDetail.Quatity = item.Quatity; detailDao.Insert(orderDetail); total += (item.Product.Price.GetValueOrDefault(0) * item.Quatity); } string content = MergeData.MergeTemplate("~/Assets/Client/template/neworder.html", shipName, mobile, email, address, total.ToString("N0")); var toEmail = ConfigurationManager.ConnectionStrings["ToEmailAddress"].ToString(); new MailHelper().SenMail(email, "Đơn hàng mới từ OnlineShop", content); new MailHelper().SenMail(toEmail, "Đơn hàng mới từ OnlineShop", content); } catch (Exception ex) { //ghi log return(Redirect("loi-thanh-toan")); } Session[CommonConstants.CartSession] = null; return(Redirect("hoan-thanh")); }
private void DebugDrawInfo(Vector2 offset) { MergeData data = new MergeData(); CalculateMergeData(ref data); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 75.0f) + offset, "x = " + data.StrengthFactor.ToString(), Color.Green, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f) + offset, "Merge block strength: " + data.ConstraintStrength.ToString(), Color.Green, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 15.0f) + offset, "Merge block dist: " + (data.Distance - CubeGrid.GridSize).ToString(), data.PositionOk ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 30.0f) + offset, "Frame counter: " + m_frameCounter.ToString(), m_frameCounter >= 6 ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 45.0f) + offset, "Rotation difference: " + data.RotationDelta.ToString(), data.RotationOk ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 60.0f) + offset, "Axis difference: " + data.AxisDelta.ToString(), data.AxisOk ? Color.Green : Color.Red, 0.8f); // The quicker the ships move towards each other, the weaker the constraint strength float rvLength = data.RelativeVelocity.Length(); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 90.0f) + offset, rvLength > 0.5f ? "Quick" : "Slow", rvLength > 0.5f ? Color.Red : Color.Green, 0.8f); }
private void modify(Node child, int qty) { pb1ProgressDbl.Report(itemIdx); Debug.WriteLine("adjusting| " + child.Name + " (" + child.Number + ")" + " (" + itemIdx + ")"); object loc = lockList[child.ExtData.LockIdx]; lock (loc) { for (int i = 0; i < qty; i++) { MergeData md = new MergeData("MergeData"); child.ExtData.MergeInfo.Add(md); Thread.Sleep(10); } } child.ExtData.UpdateProperties(); }
protected override void ExecuteInternal(JobExecutionContext context) { string attFetcherSavingPath = ConfigurationManager.AppSettings["CusteelExcelSavingPath"]; string senderFilter = ConfigurationManager.AppSettings["CusteelExcelSenderFilter"]; var titleFilter = ConfigurationManager.AppSettings["CusteelExcelTitleFilter"]; CommMailBiz.ExcuteMailSync(JobType, DateTime.Now, attFetcherSavingPath, senderFilter, titleFilter, ConfigurationManager.AppSettings["CnEUserName"], ConfigurationManager.AppSettings["CnEPassWord"], o => WriteLogEntity(o), (a, b) => { for (int i = a.Count - 1; i >= 0; i--) { var tempattachname = a[i]; if (tempattachname.Contains("重点企业营销分品种")) { b.AppendFormat(" [read excel : zhongdianqiyeyingxiaofenpinzhong] "); CusteelMarketingExcelManager manager = new CusteelMarketingExcelManager(); manager.GetCellsBy(tempattachname, b); } else if (tempattachname.Contains("重点企业流向") || tempattachname.Contains("重点钢企流向")) { CompanyFlowManager manager = new CompanyFlowManager(); manager.GetCellsByFirstSheet(tempattachname, b); } else if (tempattachname.Contains("路透数据")) { var processor = new CusteelReutersUnnormalizedData(); processor.ProcessData(tempattachname, b); } } } , (a, b) => { //merge data,from temp to permanent MergeData merge = new MergeData(); merge.ExecuteCusteelExcel(a, b); }); }
protected override void ExecuteInternal(JobExecutionContext context) { string attFetcherSavingPath = ConfigurationManager.AppSettings["TROilInventoryExcelSavingPath"]; string senderFilter = ConfigurationManager.AppSettings["TROilInventoryExcelSenderFilter"]; var titleFilter = ConfigurationManager.AppSettings["TROilInventoryExcelTitleFilter"]; CommMailBiz.ExcuteMailSync(JobType, DateTime.Now, attFetcherSavingPath, senderFilter, titleFilter, ConfigurationManager.AppSettings["CnEUserName"], ConfigurationManager.AppSettings["CnEPassWord"], o => WriteLogEntity(o), (a, b) => { for (int i = a.Count - 1; i >= 0; i--) { var tempattachname = a[i]; TROilInventoryManager processor = new TROilInventoryManager(); processor.ProcessData(tempattachname, b); } } , (a, b) => { //merge data,from temp to permanent MergeData merge = new MergeData(); merge.ExecuteOilInventoryMax(a, b); }); }
private List <string> MergeWorkingFiles(string fileInstructionsKey, Language language) { var outputFileList = new List <string>(); var mergeDataArray = new MergeData[] { new MergeData { WorkingFilePathKey = "ProductFilesPath", OutputFileBaseNameKey = "ProductFileBaseName", FeedTypeFileHeader = "product_id|name|product_parent_id|price|recommendable|image_url|link_url|rating|num_reviews|brand|sale_price_min|sale_price_max|list_price_min|list_price_max" }, new MergeData { WorkingFilePathKey = "AttributeFilesPath", OutputFileBaseNameKey = "AttributeFileBaseName", FeedTypeFileHeader = "product_id|attr_name|attr_value" }, new MergeData { WorkingFilePathKey = "ProductCategoryFilesPath", OutputFileBaseNameKey = "CategoryFileBaseName", FeedTypeFileHeader = "category_id|product_id" } }; foreach (var mergeData in mergeDataArray) { outputFileList.Add(MergeWorkingFiles(mergeData, fileInstructionsKey, language)); } return(outputFileList); }
protected override void Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) { IHttpRequest request = context.Request; IHttpResponse response = context.Response; MergeData data = Helper.DeserializeXml <MergeData>(request.InputStream); string activityId = PathParser.GetActivityId(data.Source.Href); response.AppendHeader("Cache-Control", "no-cache"); try { MergeActivityResponse mergeResponse = sourceControlProvider.MergeActivity(activityId); SetResponseSettings(response, "text/xml", Encoding.UTF8, 200); response.SendChunked = true; using (StreamWriter output = new StreamWriter(response.OutputStream)) { WriteMergeResponse(request, mergeResponse, output); } } catch (ConflictException ex) { SetResponseSettings(response, "text/xml; charset=\"utf-8\"", Encoding.UTF8, 409); string responseContent = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<D:error xmlns:D=\"DAV:\" xmlns:m=\"http://apache.org/dav/xmlns\" xmlns:C=\"svn:\">\n" + "<C:error/>\n" + "<m:human-readable errcode=\"160024\">\n" + ex.Message + "\n" + "</m:human-readable>\n" + "</D:error>\n"; WriteToResponse(response, responseContent); } }
protected override void ExecuteInternal(JobExecutionContext context) { var strInfo = new StringBuilder(); #region 执行数据同步程序 if (DateTime.Now.Hour <= 15 || DateTime.Now.Hour >= 22) { strInfo.Append("Only this time(15:00Am-10:00Pm) point synchronous;"); return; } #endregion string connStr = ConfigurationManager.AppSettings["mergeData"].ToString(); OracleConnection conn = new OracleConnection(connStr); conn.Open(); OracleTransaction tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; strInfo.AppendFormat("Destination [Type: Oracle DB, Address: {0}]\n" + "\r\n", connStr); var lastSyncTime = new DateTime(2016, 9, 02); using (var cneEntities = new CnEEntities()) { var date = cneEntities.SCHEDULERLOGs.Where(x => x.STATUS == 0 && x.JOBTYPE == JobType).Select( x => (DateTime?)x.STARTTIME).Max(); if (date != null) { //ToGMT8 lastSyncTime = date.Value.AddHours(8); } } try { #region 执行数据同步程序 var ch = new ChinaJci(); var sbSync = new StringBuilder(); ch.SyncChinaJciData(ref sbSync, lastSyncTime.ToString("yyyy-MM-dd")); strInfo.AppendFormat(sbSync.ToString()); #endregion MergeData merge = new MergeData(); merge.Execute(conn, tran); tran.Commit(); var endTime = DateTime.UtcNow; logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } finally { conn.Close(); } }
public override void UpdateBeforeSimulation10() { base.UpdateBeforeSimulation10(); if (!CheckUnobstructed()) { if (SafeConstraint != null) { RemoveConstraintInBoth(); } return; } if (SafeConstraint != null) { bool staticOk = this.CubeGrid.IsStatic || !m_other.CubeGrid.IsStatic; if (!staticOk || !IsWorking || !m_other.IsWorking || !IsWithinWorldLimits) return; Debug.Assert(!m_other.CubeGrid.MarkedForClose && !CubeGrid.MarkedForClose); var mergeBlockDefinition = this.BlockDefinition as MyMergeBlockDefinition; float maxStrength = mergeBlockDefinition != null ? mergeBlockDefinition.Strength : 0.1f; float dist = (float)(WorldMatrix.Translation - m_other.WorldMatrix.Translation).Length() - CubeGrid.GridSize; if (dist > CubeGrid.GridSize * 3) { RemoveConstraintInBoth(); return; } MergeData data = new MergeData(); CalculateMergeData(ref data); (m_constraint.ConstraintData as HkMalleableConstraintData).Strength = data.ConstraintStrength; if (data.PositionOk && data.AxisOk && data.RotationOk) { if (m_frameCounter++ >= 3) { Vector3I gridOffset = CalculateOtherGridOffset(); Vector3I otherGridOffset = m_other.CalculateOtherGridOffset(); bool canMerge = this.CubeGrid.CanMergeCubes(m_other.CubeGrid, gridOffset); if (!canMerge) { if (this.CubeGrid.GridSystems.ControlSystem.IsLocallyControlled || m_other.CubeGrid.GridSystems.ControlSystem.IsLocallyControlled) MyHud.Notifications.Add(MyNotificationSingletons.ObstructingBlockDuringMerge); return; } var handle = BeforeMerge; if (handle != null) BeforeMerge(); if (Sync.IsServer) { foreach (var block in CubeGrid.GetBlocks()) { var mergeBlock = block.FatBlock as MyShipMergeBlock; if (mergeBlock != null && mergeBlock != this && mergeBlock.InConstraint) (block.FatBlock as MyShipMergeBlock).RemoveConstraintInBoth(); } MyCubeGrid mergedGrid = this.CubeGrid.MergeGrid_MergeBlock(m_other.CubeGrid, gridOffset); if (mergedGrid == null) { mergedGrid = m_other.CubeGrid.MergeGrid_MergeBlock(this.CubeGrid, otherGridOffset); } Debug.Assert(mergedGrid != null); RemoveConstraintInBoth(); } } } else { m_frameCounter = 0; } return; } foreach (var other in m_gridList) { if (other.MarkedForClose) continue; Vector3I pos = Vector3I.Zero; double dist = double.MaxValue; LineD l = new LineD(Physics.ClusterToWorld(Physics.RigidBody.Position), Physics.ClusterToWorld(Physics.RigidBody.Position) + GetMergeNormalWorld()); if (other.GetLineIntersectionExactGrid(ref l, ref pos, ref dist)) { var block = other.GetCubeBlock(pos).FatBlock as MyShipMergeBlock; if(block == null) { continue; } if (block.InConstraint || !block.IsWorking || !block.CheckUnobstructed() || block.GetMergeNormalWorld().Dot(GetMergeNormalWorld()) > 0.0f) return; if (!block.FriendlyWithBlock(this)) return; CreateConstraint(other, block); NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; m_updateBeforeFlags |= UpdateBeforeFlags.EnableConstraint; break; } } }
protected override void ExecuteInternal(JobExecutionContext context) { var connStr = ConfigurationManager.AppSettings["mergeData"]; var conn = new OracleConnection(connStr); conn.Open(); OracleTransaction tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; var strInfo = new StringBuilder(); strInfo.AppendFormat("Source [Email:{0}]\n", ConfigurationManager.AppSettings["CoffedSenderFilter"]); strInfo.AppendFormat("Destination [Type: Oracle DB, Address: {0}]\n", connStr); strInfo.AppendFormat("Destination Table:Cofeed\n" + "\r\n"); var lastSyncTime = Convert.ToDateTime("2016-09-03"); using (var cneEntities = new CnEEntities()) { var date = cneEntities.SCHEDULERLOGs.Where(x => x.STATUS == 0 && x.JOBTYPE == JobType).Select( x => (DateTime?)x.STARTTIME).Max(); if (date != null) { //ToGMT8 lastSyncTime = date.Value.AddHours(8); } } try { StringBuilder sb = new StringBuilder(); #region 执行数据同步程序 var attFetcherSever = ConfigurationManager.AppSettings["CnEServer"]; int attFetcherPort = int.Parse(ConfigurationManager.AppSettings["CnEPort"]); bool attFetcherUsingSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["CnEUsingSsl"]); string attFetcherUserName = ConfigurationManager.AppSettings["CnEUserName"]; string attFetcherPassWord = ConfigurationManager.AppSettings["CnEPassWord"]; string attFetcherSavingPath = ConfigurationManager.AppSettings["CoffedSavingPath"]; var attFetcher = new IMAP4AttFetcher(attFetcherSever, attFetcherPort, attFetcherUsingSsl, attFetcherUserName, attFetcherPassWord, attFetcherSavingPath); var attFetcherSenderFilter = new SenderFilter(); string[] senders = ConfigurationManager.AppSettings["CoffedSenderFilter"].Split(';'); foreach (var sender in senders) { var senderRegex = new Regex(sender, RegexOptions.Compiled); attFetcherSenderFilter.SetRule(senderRegex); } attFetcher.AppendFilter(attFetcherSenderFilter); var attFetcherTitleFilter = new TitleFilter(); var titleRegex = new Regex(ConfigurationManager.AppSettings["CoffedTitleFilter"], RegexOptions.Compiled); attFetcherTitleFilter.SetRule(titleRegex); attFetcher.AppendFilter(attFetcherTitleFilter); attFetcher.Execute(lastSyncTime); var attachmentFileNames = attFetcher.GetAttachmentFileNames(); foreach (var tempattachname in attachmentFileNames) { CofeedManager manager = new CofeedManager(); manager.GetCellsByFirstSheet(tempattachname, sb); } strInfo.Append(sb); var fold = new DirectoryInfo(attFetcherSavingPath); if (fold.Exists) { FileInfo[] files = fold.GetFiles(); foreach (FileInfo f in files)//删除目录下所有文件 { f.Delete(); } } #endregion if (attachmentFileNames.Count > 0) { MergeData merge = new MergeData(); merge.Execute(conn, tran); tran.Commit(); strInfo.Append("Execute Procedure : createMaxAgricultrueTable \r\n"); strInfo.Append("Insert Into Table : GDT_AgricultureMax \r\n"); } else { strInfo.Append("No files found\r\n"); } var settingFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\Ftp-Cofeed-data-sync.xml"); var settingManager = new FtpSyncXmlManager(File.ReadAllText(settingFilePath), lastSyncTime, startTime.AddHours(8)); settingManager.Init(); var ftpSync = new FtpSyncLoad(settingManager, strInfo); ftpSync.Excute(); var endTime = DateTime.UtcNow; logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } finally { conn.Close(); } }
public List <SortedDictionary <string, string> > CartWidgetValidation(List <SortedDictionary <string, string> > searchResultDomainsList) { var subTotal = 0.00M; var icannfees = 0.00M; var domainValidity = string.Empty; var domainPrice = 0.00M; var domainName = string.Empty; var moreclass = BrowserInit.Driver.FindElement( By.XPath( "((.//*[contains(@class,'cart spacer-bottom')]//ul/li[@class='subtotal'] | //ul/li[@class='transfer'] | .//*[@class='cart-widget']/ul/li)/preceding-sibling::li)[last()]")) .GetAttribute(UiConstantHelper.AttributeClass); if (moreclass.Contains("more")) { var moretext = Regex.Replace(BrowserInit.Driver.FindElement(By.XPath(".//*[(contains(@class,'more'))]/a")).Text, "[^0-9.]", string.Empty).Trim(); if (!moretext.Equals(string.Empty)) { BrowserInit.Driver.FindElement(By.XPath(".//*[(contains(@class,'more'))]/a")).Click(); } } var cartWidgetList = new List <SortedDictionary <string, string> >(); var cartWidgetWindowItems = PageInitHelper <CartWidgetPageFactory> .PageInit.ProductListCount; SortedDictionary <string, string> cartWidgetDic; for (var itemIndex = cartWidgetWindowItems.Count + 1; itemIndex-- > 1;) { var xpath = "((.//*[contains(@class,'cart spacer-bottom')]//ul/li[@class='register'] | //ul/li[@class='transfer'] | .//*[@class='cart-widget']/ul/li)[not(contains(@class,'subtotal'))][not(contains(@class,'more'))])[" + itemIndex + "]"; var ele = BrowserInit.Driver.FindElement(By.XPath(xpath)); PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(ele); cartWidgetDic = new SortedDictionary <string, string>(); var cItemClass = ele.GetAttribute("class"); if (cItemClass.Contains(string.Empty) | cItemClass.IndexOf("register", StringComparison.CurrentCultureIgnoreCase) >= 0 | cItemClass.IndexOf("transfer", StringComparison.CurrentCultureIgnoreCase) >= 0) { var widgetItemDomainName = BrowserInit.Driver.FindElement(By.XPath(xpath + "//strong")).Text; if (widgetItemDomainName.Contains(".")) { domainName = widgetItemDomainName.Trim(); } var domainValidityDetails = BrowserInit.Driver.FindElements(By.XPath(xpath + "/ul/li/p")); for (var i = 1; i <= domainValidityDetails.Count; i++) { var spanCount = BrowserInit.Driver.FindElements(By.XPath(xpath + "/ul/li/p/span")); for (var j = 1; j <= spanCount.Count; j++) { var spanclass = BrowserInit.Driver.FindElement(By.XPath("(" + xpath + "/ul/li/p/span)[" + j + "]")) .GetAttribute(UiConstantHelper.AttributeClass); if (spanclass.Contains("item")) { var spantext = BrowserInit.Driver.FindElement(By.XPath("(" + xpath + "/ul/li/p/span)[" + j + "]")) .Text; if (spantext.IndexOf("registration", StringComparison.CurrentCultureIgnoreCase) >= 0) { domainValidity = Regex.Replace(spantext, "registration", string.Empty).Trim(); } else if (spantext.IndexOf("transfer", StringComparison.CurrentCultureIgnoreCase) >= 0) { domainValidity = Regex.Replace(spantext, "transfer", string.Empty).Trim(); } else if (spantext.IndexOf("FreeDNS", StringComparison.CurrentCultureIgnoreCase) >= 0) { cartWidgetDic.Add("Domaintype", spantext.Trim()); } } else if (spanclass.Contains("price")) { var spantext = BrowserInit.Driver.FindElement(By.XPath("(" + xpath + "/ul/li/p/span)[" + j + "]/../span[1]")).Text; var spanPrice = BrowserInit.Driver.FindElement(By.XPath("(" + xpath + "/ul/li/p/span)[" + j + "]")).Text; if (spantext.IndexOf("registration", StringComparison.CurrentCultureIgnoreCase) >= 0 | spantext.IndexOf("transfer", StringComparison.CurrentCultureIgnoreCase) >= 0) { domainPrice = Convert.ToDecimal(Regex.Replace(spanPrice, @"[^\d..][^\w\s]*", string.Empty).Trim()); } else if (spantext.Contains("ICANN fee")) { icannfees = Convert.ToDecimal(Regex.Replace(spanPrice, @"[^\d..][^\w\s]*", string.Empty).Trim()); } else if (spantext.IndexOf("FreeDNS", StringComparison.CurrentCultureIgnoreCase) >= 0) { domainPrice = Convert.ToDecimal(0.00M); } } } } } cartWidgetDic.Add(EnumHelper.DomainKeys.DomainName.ToString(), domainName.Trim()); if (domainValidity != string.Empty) { cartWidgetDic.Add(EnumHelper.DomainKeys.DomainDuration.ToString(), domainValidity); } cartWidgetDic.Add(EnumHelper.DomainKeys.DomainPrice.ToString(), domainPrice.ToString(CultureInfo.InvariantCulture)); cartWidgetDic.Add(EnumHelper.CartWidget.IcanPrice.ToString(), icannfees.ToString(CultureInfo.InvariantCulture)); subTotal = subTotal + domainPrice + icannfees; cartWidgetList.Add(cartWidgetDic); domainName = string.Empty; domainValidity = string.Empty; domainPrice = 0.00M; icannfees = 0.00M; } cartWidgetDic = new SortedDictionary <string, string> { { EnumHelper.CartWidget.SubTotal.ToString(), subTotal.ToString(CultureInfo.InvariantCulture) } }; cartWidgetList.Add(cartWidgetDic); var subtotaldiv = PageInitHelper <CartWidgetPageFactory> .PageInit.SubTotal; PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(subtotaldiv); var widgetSubTotalText = subtotaldiv.Text; var widgetSubTotal = Convert.ToDecimal(Regex.Replace(widgetSubTotalText, @"[^\d..][^\w\s]*", string.Empty).Trim()); Assert.IsTrue(widgetSubTotal.Equals(Convert.ToDecimal(cartWidgetDic[EnumHelper.CartWidget.SubTotal.ToString()])), "Cart Widget domain subtotal mismatching with subtotal values Expected - " + Convert.ToDecimal(cartWidgetDic[EnumHelper.CartWidget.SubTotal.ToString()]) + ", but actual subtotal shown as - " + widgetSubTotal); AVerify verifingTwoListOfDic = new VerifyData(); verifingTwoListOfDic.VerifyTwoListOfDic(searchResultDomainsList, cartWidgetList); AMerge mergeTWoListOfDic = new MergeData(); mergeTWoListOfDic.MergingTwoListOfDic(searchResultDomainsList, cartWidgetList); PageInitHelper <CartWidgetPageFactory> .PageInit.ViewCartButton.Click(); return(cartWidgetList); }
public List <SortedDictionary <string, string> > AddShoppingCartItemsToDic(List <SortedDictionary <string, string> > cartWidgetList, string whois, string premiumDns) { var certificateQtyinSc = string.Empty; var certificateDurationinSc = string.Empty; var certificatePriceinSc = 0.00M; var shoppingcartItemList = new List <SortedDictionary <string, string> >(); const string productGroupsXpath = "(.//*[@class='product-group'])"; var productGroups = BrowserInit.Driver.FindElements(By.XPath(productGroupsXpath)); var i = 0; foreach (var productGroup in productGroups) { i = i + 1; var shoppingCartItemsDic = new SortedDictionary <string, string>(); var certificateNameinSc = Regex.Replace(productGroup.FindElement(By.TagName("strong")).Text.Trim(), "UPDATE", string.Empty); var cerQty = productGroup.FindElements(By.ClassName("qty")).Count > 0; if (cerQty) { certificateQtyinSc = productGroup.FindElement(By.XPath("//*[contains(@class,'qty')]/input")).GetAttribute(UiConstantHelper.AttributeValue).Trim(); } var certificateDurationcount = productGroup.FindElement(By.XPath("//*[contains(@class,'Duration')]")); foreach (var certificateDuration in certificateDurationcount.FindElements(By.TagName("span")).Where(certificateDuration => certificateDuration.Text.Contains("Year"))) { certificateDurationinSc = certificateDuration.Text.Trim(); break; } if (BrowserInit.Driver.FindElements(By.XPath("(" + productGroupsXpath + "[" + i + "]/../div/div/*)")).Count == 4) { var extraCount = BrowserInit.Driver.FindElements( By.XPath("(" + productGroupsXpath + "[" + i + "]/../div/div/*)[2]//*")); foreach (var extradomainPrice in from extraDomain in extraCount where extraDomain.GetAttribute(UiConstantHelper.AttributeClass).Contains("price") select decimal.Parse(Regex.Replace(extraDomain.Text, @"[^\d..][^\w\s]*", string.Empty).Trim())) { shoppingCartItemsDic.Add("Extra domain price", extradomainPrice.ToString(CultureInfo.InvariantCulture)); break; } } var cerPriceCount = BrowserInit.Driver.FindElements(By.XPath("(" + productGroupsXpath + "[" + i + "]//div[3]/span)")); foreach (var cerPrice in cerPriceCount.Where(cerPrice => cerPrice.GetAttribute(UiConstantHelper.AttributeClass).Contains("amount"))) { certificatePriceinSc = decimal.Parse(Regex.Replace(cerPrice.Text, @"[^\d..][^\w\s]*", string.Empty).Trim()); } shoppingCartItemsDic.Add(EnumHelper.Ssl.CertificateName.ToString(), certificateNameinSc); shoppingCartItemsDic.Add(EnumHelper.Ssl.CertificatePrice.ToString(), certificatePriceinSc.ToString(CultureInfo.InvariantCulture)); shoppingCartItemsDic.Add(EnumHelper.Ssl.CertificateDuration.ToString(), certificateDurationinSc); if (certificateQtyinSc != string.Empty) { shoppingCartItemsDic.Add("Certificate Qty", certificateQtyinSc); } shoppingcartItemList.Add(shoppingCartItemsDic); } AVerify verifingTwoListOfDic = new VerifyData(); verifingTwoListOfDic.VerifyTwoListOfDic(shoppingcartItemList, cartWidgetList); AMerge mergeTWoListOfDic = new MergeData(); var mergedScAndCartWidgetDic = mergeTWoListOfDic.MergingTwoListOfDic(shoppingcartItemList, cartWidgetList); PageInitHelper <ShoppingCartPageFactory> .PageInit.ConfirmOrderBtn.Click(); return(mergedScAndCartWidgetDic); }
protected override void ExecuteInternal(JobExecutionContext context) { string connStr = ConfigurationManager.AppSettings["mergeData"]; OracleConnection conn = new OracleConnection(connStr); conn.Open(); OracleTransaction tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; var strInfo = new StringBuilder(); strInfo.AppendFormat("Source [Email:{0},Title:{1}]\n", ConfigurationManager.AppSettings["LongZhongSenderFilter"], ConfigurationManager.AppSettings["LongZhongTitleFilter"]); strInfo.AppendFormat("Destination [Type: Oracle DB, Address: {0}]\n", connStr); var lastSyncTime = Convert.ToDateTime("2016-11-16"); using (var cneEntities = new CnEEntities()) { var date = cneEntities.SCHEDULERLOGs.Where(x => x.STATUS == 0 && x.JOBTYPE == JobType).Select( x => (DateTime?)x.STARTTIME).Max(); if (date != null) { //ToGMT8 lastSyncTime = date.Value.AddHours(8); } } try { #region 执行数据同步程序 var attFetcherSever = ConfigurationManager.AppSettings["CnEServer"]; int attFetcherPort = int.Parse(ConfigurationManager.AppSettings["CnEPort"]); bool attFetcherUsingSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["CnEUsingSsl"]); string attFetcherUserName = ConfigurationManager.AppSettings["CnEUserName"]; string attFetcherPassWord = ConfigurationManager.AppSettings["CnEPassWord"]; string attFetcherSavingPath = ConfigurationManager.AppSettings["LongZhongSavingPath"]; var attFetcher = new IMAP4AttFetcher(attFetcherSever, attFetcherPort, attFetcherUsingSsl, attFetcherUserName, attFetcherPassWord, attFetcherSavingPath); var attFetcherSenderFilter = new SenderFilter(); /*Filter example. If there are more filters , please write like below.*/ string[] senders = ConfigurationManager.AppSettings["LongZhongSenderFilter"].Split(';'); foreach (var sender in senders) { var senderRegex = new Regex(sender, RegexOptions.Compiled); attFetcherSenderFilter.SetRule(senderRegex); } attFetcher.AppendFilter(attFetcherSenderFilter); var attFetcherTitleFilter = new TitleFilter(); var titleRegex = new Regex(ConfigurationManager.AppSettings["LongZhongTitleFilter"], RegexOptions.Compiled); attFetcherTitleFilter.SetRule(titleRegex); attFetcher.AppendFilter(attFetcherTitleFilter); attFetcher.Execute(lastSyncTime); /*Get the saved attachment names.*/ var attachmentFileNames = attFetcher.GetAttachmentFileNames(); //List<string> attachmentFileNames = Directory.GetFiles(@"C:\DataFeedApp\Scheduler\CnE\LongZhong").ToList<string>(); foreach (var tempattachname in attachmentFileNames) { LongZhongExcelManager manager = new LongZhongExcelManager(); manager.GetCellsByFirstSheet(tempattachname, strInfo); } var fold = new DirectoryInfo(attFetcherSavingPath); if (fold.Exists) { FileInfo[] files = fold.GetFiles(); foreach (FileInfo f in files)//删除目录下所有文件 { f.Delete(); } } if (attachmentFileNames.Count > 0) { MergeData merge = new MergeData(); merge.ExecuteLongZhongExcel(conn, tran); tran.Commit(); strInfo.Append("Execute Procedure : CREATEMAXENERGYYIELDTABLE, CREATEMAXCHEMISTRYOUTPUTTABLE \r\n"); strInfo.Append("Insert Into Table : GDT_CHEMISTRYOUTPUTMAX, GDT_ENERGYYIELDMAX \r\n"); } else { strInfo.Append("No files found\r\n"); } #endregion var endTime = DateTime.UtcNow; logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); //merge data from temp to persistence } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } finally { conn.Close(); conn.Dispose(); } }
public List <SortedDictionary <string, string> > CartWidgetValidation(List <SortedDictionary <string, string> > domainListValidation) { var cartBelongsTo = PageInitHelper <CartWidgetPageFactory> .PageInit.CartContent.GetAttribute(UiConstantHelper .AttributeId); Assert.IsTrue(cartBelongsTo.Contains("productUl")); var cartWidgetList = new List <SortedDictionary <string, string> >(); var cartWidgetDic = new SortedDictionary <string, string>(); foreach (var cartItem in PageInitHelper <CartWidgetPageFactory> .PageInit.CartWidgetWindowItems.Select((value, i) => new { i, value })) { var subitemvalue = cartItem.value; var subitemindex = cartItem.i + 1; var cItemClass = subitemvalue.GetAttribute("class"); if (!cItemClass.Equals(string.Empty)) { continue; } if (BrowserInit.Driver.FindElement(By.XPath("((.//*[contains(@class,'cart spacer-bottom')]//ul/li[@class='register'] | //ul/li[@class='transfer'] | .//*[@class='cart-widget']/ul/li|(//ul/li[not(@class)]/strong[contains(@class,'product')]/..)| .//*[@class='cart-widget']/ul/li)[not(contains(@class,'subtotal'))][not(contains(@class,'more'))])[" + subitemindex + "]/..")) .GetAttribute(UiConstantHelper.AttributeClass) .Contains("WhoisGuard")) { var pCount = subitemvalue.FindElements(By.TagName("p")); foreach (var spanClass in from itemTxt in pCount let pClassText = itemTxt.GetAttribute(UiConstantHelper.AttributeClass) where pClassText.Equals(string.Empty) select itemTxt.FindElements(By.TagName("span")) into spanCount from spanClass in spanCount select spanClass) { if (spanClass.GetAttribute(UiConstantHelper.AttributeClass).Contains("item")) { cartWidgetDic.Add(EnumHelper.ShoppingCartKeys.WhoisGuardForDomainDuration.ToString(), spanClass.Text.Replace("subscription", "").Trim()); } else if (spanClass.GetAttribute(UiConstantHelper.AttributeClass) .Contains("price")) { var priceText = spanClass.Text.Equals("FREE") ? "0.00" : Regex.Replace(spanClass.Text, @"[^\d..][^\w\s]*", ""); cartWidgetDic.Add(EnumHelper.ShoppingCartKeys.WhoisGuardForDomainPrice.ToString(), priceText.Trim()); } } } else { var strongClassName = subitemvalue.FindElement(By.TagName("strong")) .GetAttribute(UiConstantHelper.AttributeClass); var productName = subitemvalue.FindElement(By.TagName("strong")).Text; if (strongClassName.Equals("productname".Trim()) && !productName.Contains(".")) { if (subitemvalue.Text.Contains("Xeon")) { var dServers = Regex.Split(subitemvalue.Text, "(,)")[0]; var dedicatedServers = dServers.Split(' ')[0] + " " + dServers.Split(' ')[1] + " " + dServers.Split(' ')[2]; cartWidgetDic.Add(EnumHelper.HostingKeys.ProductName.ToString(), dedicatedServers); } else { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductName.ToString(), subitemvalue.FindElement(By.TagName("strong")).Text); } var pCount = subitemvalue.FindElements(By.TagName("p")); foreach (var itemTxt in pCount) { var pClassText = itemTxt.GetAttribute(UiConstantHelper.AttributeClass); if (pClassText.Equals(string.Empty)) { var spanCount = itemTxt.FindElements(By.TagName("span")); foreach (var spanClass in spanCount) { if (spanClass.GetAttribute(UiConstantHelper.AttributeClass).Contains("item")) { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductDuration.ToString(), spanClass.Text.Replace("subscription", "").Trim()); } else if (spanClass.GetAttribute(UiConstantHelper.AttributeClass) .Contains("price")) { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductPrice.ToString(), Regex.Replace(spanClass.Text, @"[^\d..][^\w\s]*", "").Trim()); } } } if (!pClassText.EndsWith("addon")) { continue; } { var spanCount = itemTxt.FindElements(By.TagName("span")); var associatedDicKey = ""; var associatedDicValue = ""; for (var i = 0; i < spanCount.Count; i++) { if (i == 0) { string associatedDicKeyTxt = spanCount[i].Text; associatedDicKey = associatedDicKeyTxt.Contains("transfer") ? associatedDicKeyTxt.Replace("transfer", "").Trim() : associatedDicKeyTxt; } else { associatedDicValue = spanCount[i].Text; } } var priceText = associatedDicValue.Equals("FREE") ? "0.00" : Regex.Replace(associatedDicValue, @"[^\d..][^\w\s]*", ""); cartWidgetDic.Add(associatedDicKey.Trim(), priceText.Trim()); } } } else if (strongClassName.Contains("productname domain".Trim()) || productName.Contains(".")) { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductDomainName.ToString(), subitemvalue.FindElement(By.TagName("strong")).Text); var pCount = subitemvalue.FindElements(By.TagName("p")); foreach (var itemTxt in pCount) { var spanCount = itemTxt.FindElements(By.TagName("span")); foreach (var spanClass in spanCount.Select((value, i) => new { i, value })) { if (spanClass.value.GetAttribute(UiConstantHelper.AttributeClass) .Contains("item") && spanClass.value.Text != "ICANN fee") { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductDomainDuration.ToString(), spanClass.value.Text.Replace("registration", string.Empty).Replace("transfer", string.Empty).Trim()); } else if (spanClass.value.GetAttribute(UiConstantHelper.AttributeClass) .Contains("price") && pCount.IndexOf(itemTxt) != 1) { cartWidgetDic.Add(EnumHelper.HostingKeys.ProductDomainPrice.ToString(), decimal.Parse(Regex.Replace(spanClass.value.Text, @"[^\d..][^\w\s]*", "").Trim()).ToString(CultureInfo.InvariantCulture)); } else if (spanClass.i.ToString() == "1") { if (spanClass.value.GetAttribute(UiConstantHelper.AttributeClass) .Contains("price")) { cartWidgetDic.Add(EnumHelper.CartWidget.IcanPrice.ToString(), decimal.Parse(Regex.Replace(spanClass.value.Text, @"[^\d..][^\w\s]*", "").Trim()).ToString(CultureInfo.InvariantCulture)); } } } } } } } var subTotal = cartWidgetDic.Where(dicCartWidgetItem => dicCartWidgetItem.Value.Contains(".") && !dicCartWidgetItem.Key.Equals(EnumHelper.HostingKeys.ProductDomainName.ToString()) && !dicCartWidgetItem.Key.Equals(EnumHelper.HostingKeys.ProductName.ToString())).Aggregate(0.0m, (current, dicCartWidgetItem) => current + decimal.Parse(dicCartWidgetItem.Value)); cartWidgetDic.Add(EnumHelper.CartWidget.SubTotal.ToString(), subTotal.ToString(CultureInfo.InvariantCulture)); cartWidgetList.Add(cartWidgetDic); var widgetSubTotal = decimal.Parse(Regex.Replace( PageInitHelper <CartWidgetPageFactory> .PageInit.CartWidgetSubTotal.Text, @"[^\d..][^\w\s]*", "")); var dictWithKey = cartWidgetList.First(d => d.ContainsKey(EnumHelper.CartWidget.SubTotal.ToString())); var dicSubTotalValue = decimal.Parse( Regex.Replace(dictWithKey[EnumHelper.CartWidget.SubTotal.ToString()], "\"[^\"]*\"", "") .Trim()); Assert.IsTrue(dicSubTotalValue.Equals(widgetSubTotal), "Sub total is miss matching with widget sub total"); AVerify verifingTwoListOfDic = new VerifyData(); verifingTwoListOfDic.VerifyTwoListOfDic(domainListValidation, cartWidgetList); AMerge mergeTWoListOfDic = new MergeData(); cartWidgetList = mergeTWoListOfDic.MergingTwoListOfDic(domainListValidation, cartWidgetList); PageInitHelper <CartWidgetPageFactory> .PageInit.ViewCartButton.Click(); if (!PageInitHelper <CartWidgetPageFactory> .PageInit.ShoppingCartHeadingTxt.Text.Trim().Equals("Shopping Cart")) { PageInitHelper <CartWidgetPageFactory> .PageInit.ViewCartButton.Click(); } return(cartWidgetList); }
void OnGUI() { EditorGUI.BeginChangeCheck(); mode = (Mode)EditorGUILayout.EnumPopup("Select Merge Mode", mode); if (EditorGUI.EndChangeCheck()) { lodRTH.Clear(); polyMergeCountDic.Clear(); mergeCount = 0; groupCount = 0; foundCount = 0; objectsToString = ""; dataDic.Clear(); seObj.Clear(); sg.Clear(); sel.Clear(); showList.Clear(); canMerge = false; } if (mode == Mode.select || mode == Mode.patchChild || mode == Mode.searchAndMerge || mode == Mode.fullAuto) { if (mode == Mode.searchAndMerge) { EditorGUILayout.LabelField("Please Chose a Gameobject"); radius = float.Parse(EditorGUILayout.TextField("Search Radius", radius.ToString())); } if (mode == Mode.fullAuto) { radius = float.Parse(EditorGUILayout.TextField("Group Radius", radius.ToString())); } if (GUILayout.Button("Select")) { totalcount = 0; counting = 0; UpdateProgress(); lodRTH.Clear(); polyMergeCountDic.Clear(); mergeCount = 0; groupCount = 0; foundCount = 0; objectsToString = ""; dataDic.Clear(); seObj.Clear(); sg.Clear(); sel.Clear(); showList.Clear(); if (mode == Mode.select) { sel = Selection.gameObjects.ToList(); foreach (GameObject _sel in sel) { if (CheckMeshAndLOD(_sel)) { sg.Add(_sel); } } } if (mode == Mode.patchChild) { sel = Selection.gameObjects.ToList(); if (sel.Count > 1) { Selection.objects = sg.ToArray(); canMerge = false; Debug.LogError("Please Select Only One Patch"); return; } else if (sel[0].GetComponent <MeshFilter>() != null || sel[0].GetComponent <LODGroup>() != null) { Selection.objects = sg.ToArray(); canMerge = false; Debug.LogError("This not patch child"); return; } Patchchild(sel[0]); } if (mode == Mode.searchAndMerge) { if (draw == null) { Debug.LogWarning("Please Chose a GameObject"); return; } else if (Selection.objects.Length > 1) { Debug.LogWarning("Please Chose Only One Object"); return; } Searching(); } if (mode == Mode.fullAuto) { mode = Mode.fullAuto; FullAuto(); } polyCount = 0; if (mode == Mode.select || mode == Mode.searchAndMerge) { if (sg.Count <= 1) { canMerge = false; Debug.LogError("Not Found Gameobject For Merge"); return; } sg = sg.OrderBy(go => go.name).ToList(); while (sg.Count > 0) { bool added = false; int num = 0; Object m_sgPrefab; Object c_sgPrefab; GameObject m_sg = sg [0]; sg.RemoveAt(0); m_sgPrefab = PrefabUtility.GetPrefabParent(m_sg); foreach (string k_se in seObj.Keys) { c_sgPrefab = PrefabUtility.GetPrefabParent(seObj[k_se][0]); if (m_sgPrefab == c_sgPrefab) { seObj [k_se].Add(m_sg); added = true; } } if (added == false) { while (seObj.ContainsKey(m_sgPrefab.name + "_Group_" + num)) { num++; } List <GameObject> newObjList = new List <GameObject> (); newObjList.Add(m_sg); seObj.Add(m_sgPrefab.name + "_Group_" + num, newObjList); } } } sg.Clear(); totalcount = seObj.Count; foreach (string key in seObj.Keys) { counting++; UpdateProgress(); if (seObj [key].Count <= 1) { continue; } else { groupCount++; foundCount += seObj [key].Count; sg.AddRange(seObj[key]); } List <GameObject> gos = seObj [key]; // gos = gos.OrderBy (go => go.name).ToList(); int lodCount = 1; if (gos[0].GetComponent <LODGroup>() != null) { lodCount = gos[0].GetComponent <LODGroup>().GetLODs().Count(); if (!lodRTH.ContainsKey(key)) { lodRTH.Add(key, new List <float>()); for (int t = 0; t < lodCount; t++) { float rth = gos [0].GetComponent <LODGroup> ().GetLODs() [t].screenRelativeTransitionHeight; GameObject gg = gos [0].GetComponent <LODGroup> ().GetLODs() [t].renderers [0].gameObject; if (gg.GetComponent <BillboardRenderer> () != null) { lodRTH[key][lodRTH[key].Count - 1] = rth; Debug.LogWarning(gg.name + " LOD " + t + " have BilboardRenderer"); } else { lodRTH[key].Add(rth); } } } } for (int h = 0; h < lodCount; h++) { meshes.Clear(); selectedObjs.Clear(); polyCount = 0; MergeData md = new MergeData(); objectLists = md._objectLists; subMeshLists = md._subMeshLists; matLists = md._matLists; tranMeshColLists = md._tranMeshColLists; meshColLists = md._meshColLists; if (dataDic.ContainsKey(key)) { dataDic [key].Add(md); } else { List <MergeData> mds = new List <MergeData> (); mds.Add(md); dataDic.Add(key, mds); } for (int i = 0; i < gos.Count; i++) { LODGroup lod = gos[i].GetComponent <LODGroup>(); GameObject go = null; if (lod != null) { go = lod.GetLODs() [h].renderers [0].gameObject; MeshCollider meshCol = go.GetComponent <MeshCollider> (); if (meshCol != null) { tranMeshColLists.Add(gos [i].transform); meshColLists.Add(meshCol.sharedMesh); } } else { go = gos [i]; MeshCollider meshCol = go.GetComponent <MeshCollider> (); if (meshCol != null) { tranMeshColLists.Add(gos [i].transform); meshColLists.Add(meshCol.sharedMesh); } } if (go.GetComponent <BillboardRenderer>() != null) { continue; } if (go.GetComponent <MeshFilter>() == null) { Selection.activeGameObject = go; Debug.LogError(go.name + " don't have mesh data!"); return; } sharedMats = go.GetComponent <Renderer>().sharedMaterials.ToList(); int id = 0; if (matLists.Count == 0) { objectLists.Add(new List <GameObject>()); matLists.Add(sharedMats); } for (int j = 0; j < matLists.Count; j++) { if (CompareList(sharedMats, matLists[j])) { id = j; break; } else if (j == matLists.Count - 1) { id = j + 1; objectLists.Add(new List <GameObject>()); matLists.Add(sharedMats); } } objectLists[id].Add(go); } for (int i = 0; i < matLists.Count; i++) { List <MeshFilter> mfs = new List <MeshFilter>(); for (int j = 0; j < objectLists[i].Count; j++) { mfs.Add(objectLists[i][j].GetComponent <MeshFilter>()); polyCount += mfs[j].sharedMesh.vertexCount; } if (mfs[0].sharedMesh.subMeshCount > 0) { subMeshLists.Add(SubMeshToMesh(mfs)); } if (polyCount > 65000) { objectsToString += meshContainsName + "_" + objectLists[i][0].name + "_" + matLists[i][0].name + " : " + polyCount + " ***Poly > 65000***" + "\n"; } else { objectsToString += meshContainsName + "_" + objectLists[i][0].name + "_" + matLists[i][0].name + " : " + polyCount + "\n"; } mergeCount++; polyMergeCount += polyCount; polyCount = 0; } if (!polyMergeCountDic.ContainsKey(key)) { polyMergeCountDic.Add(key, polyMergeCount); } polyMergeCount = 0; } objectsToString += "\n"; } Selection.objects = sg.ToArray(); canMerge = true; foreach (string p in polyMergeCountDic.Keys) { if (polyMergeCountDic[p] > 65000) { canMerge = false; } } } EditorUtility.ClearProgressBar(); lodGroup = EditorGUILayout.Toggle(new GUIContent("LOD Group", "Add Component LOD Group in new object"), lodGroup); if (mode == Mode.searchAndMerge || mode == Mode.fullAuto) { EditorGUILayout.LabelField("Found Count : " + foundCount); } EditorGUILayout.LabelField("Merge Count : " + mergeCount); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); if (mode == Mode.searchAndMerge || mode == Mode.select || mode == Mode.patchChild) { EditorGUILayout.TextArea(objectsToString); } else if (mode == Mode.fullAuto) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Select Merge Group"); List <string> seObjKeyList = new List <string> (); seObjKeyList = seObj.Keys.ToList(); int numOfseObjList = 0; foreach (KeyValuePair <string, List <GameObject> > sDic in seObj) { if (sDic.Value.Count <= 1) { continue; } EditorGUILayout.BeginHorizontal(); showList.Add(true); showList [numOfseObjList] = EditorGUILayout.Toggle(showList[numOfseObjList], GUILayout.MaxWidth(10)); showList [numOfseObjList] = EditorGUILayout.Foldout(showList[numOfseObjList], new GUIContent(sDic.Key, "Selected for merge")); EditorGUILayout.EndHorizontal(); if (showList [numOfseObjList]) { foreach (GameObject gObj in sDic.Value) { EditorGUILayout.ObjectField((GameObject)gObj, typeof(GameObject), false, GUILayout.MaxWidth(400)); } EditorGUILayout.Space(); } numOfseObjList++; } } EditorGUILayout.EndScrollView(); EditorGUILayout.LabelField("Group Count : " + groupCount); meshContainsName = EditorGUILayout.TextField("Name of merged object", meshContainsName); EditorGUI.BeginDisabledGroup(canMerge == false); if (GUILayout.Button("Marge")) { Mesh(); } EditorUtility.ClearProgressBar(); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); } }
public void MergeRegionData(DefaultDataCollection collection) { MergeData.MergeRegionData(collection); }
public void MergeBuildings <T>(IDataDictionary <T> list, IDataDictionary <StaticBuilding> buildings) { MergeData.MergeBuildings(list, buildings); }
protected override void ExecuteInternal(JobExecutionContext context) { var startTime = DateTime.UtcNow; var logEntity = new SCHEDULERLOG { STARTTIME = startTime }; string connStr = ConfigurationManager.AppSettings["mergeData"]; var conn = new OracleConnection(connStr); conn.Open(); var tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var strInfo = new StringBuilder(); string settingFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\MySteel-data-sync.xml"); var settingManager = new XmlSettingManager(File.ReadAllText(settingFilePath)); // Set Connection string var destinationDbConn = string.Empty; settingManager.Init(destinationDbConn);//初始化 mapping strInfo.AppendFormat("Source [Type: {0} Address: {1}]\n", settingManager.SourceDb.Type, settingManager.SourceDb.Conn); strInfo.AppendFormat("Destination [Type: {0} Address: {1}]\n", settingManager.DestinationDb.Type, settingManager.DestinationDb.Conn); DateTime lastSyncTime; var currentSyncTime = DateTime.Now; using (var cmd = new OracleCommand("SELECT max(dLastAccess) FROM RTMS_TABLEDATA ", conn)) { object obj = cmd.ExecuteScalar(); lastSyncTime = Convert.ToDateTime(obj.ToString()); strInfo.AppendFormat("Last successfully sync time : {0}.\n", obj); } try { using (var dataSync = new DataSynchronizer(settingManager, lastSyncTime, currentSyncTime)) { dataSync.TableSynched += (sender, e) => strInfo.AppendFormat ("{0} rows have been synchronized from {1} table in SYNC_REUTERS DB to {2} table in CnE DB.\n", e.NumOfRowsSynched, e.Source, e.Dest); dataSync.Init(); var sourceTable = settingManager.SourceTableName.Split(','); dataSync.Sync(sourceTable); } strInfo.AppendFormat("{0} table(s) be synchronized.\n", settingManager.TableMappings.Count()); var merge = new MergeData(); merge.ExecuteMetals(conn, tran); tran.Commit(); var endTime = DateTime.UtcNow; logEntity.ENDTIME = endTime; logEntity.JobStatus = JobStatus.Success; logEntity.RUNDETAIL = strInfo.ToString(); WriteLogEntity(logEntity); } catch (Exception exception) { tran.Rollback(); logEntity.ENDTIME = DateTime.UtcNow.AddDays(-1); logEntity.JobStatus = JobStatus.Fail; logEntity.RUNDETAIL = strInfo + "\n" + exception; WriteLogEntity(logEntity); } }
public override void UpdateBeforeSimulation10() { base.UpdateBeforeSimulation10(); if (!CheckUnobstructed()) { if (SafeConstraint != null) { RemoveConstraintInBoth(); } return; } if (SafeConstraint != null) { bool staticOk = this.CubeGrid.IsStatic || !m_other.CubeGrid.IsStatic; if (!staticOk || !IsWorking || !m_other.IsWorking) { return; } Debug.Assert(!m_other.CubeGrid.MarkedForClose && !CubeGrid.MarkedForClose); var mergeBlockDefinition = this.BlockDefinition as MyMergeBlockDefinition; float maxStrength = mergeBlockDefinition != null ? mergeBlockDefinition.Strength : 0.1f; float dist = (float)(WorldMatrix.Translation - m_other.WorldMatrix.Translation).Length() - CubeGrid.GridSize; if (dist > CubeGrid.GridSize * 3) { RemoveConstraintInBoth(); return; } MergeData data = new MergeData(); CalculateMergeData(ref data); (m_constraint.ConstraintData as HkMalleableConstraintData).Strength = data.ConstraintStrength; if (data.PositionOk && data.AxisOk && data.RotationOk) { if (m_frameCounter++ >= 3) { Vector3I gridOffset = CalculateOtherGridOffset(); Vector3I otherGridOffset = m_other.CalculateOtherGridOffset(); bool canMerge = this.CubeGrid.CanMergeCubes(m_other.CubeGrid, gridOffset); if (!canMerge) { if (this.CubeGrid.GridSystems.ControlSystem.IsLocallyControlled || m_other.CubeGrid.GridSystems.ControlSystem.IsLocallyControlled) { MyHud.Notifications.Add(MyNotificationSingletons.ObstructingBlockDuringMerge); } return; } var handle = BeforeMerge; if (handle != null) { BeforeMerge(); } if (Sync.IsServer) { foreach (var block in CubeGrid.GetBlocks()) { var mergeBlock = block.FatBlock as MyShipMergeBlock; if (mergeBlock != null && mergeBlock != this && mergeBlock.InConstraint) { (block.FatBlock as MyShipMergeBlock).RemoveConstraintInBoth(); } } MyCubeGrid mergedGrid = this.CubeGrid.MergeGrid_MergeBlock(m_other.CubeGrid, gridOffset); if (mergedGrid == null) { mergedGrid = m_other.CubeGrid.MergeGrid_MergeBlock(this.CubeGrid, otherGridOffset); } Debug.Assert(mergedGrid != null); RemoveConstraintInBoth(); } } } else { m_frameCounter = 0; } return; } foreach (var other in m_gridList) { if (other.MarkedForClose) { continue; } Vector3I pos = Vector3I.Zero; double dist = double.MaxValue; LineD l = new LineD(Physics.ClusterToWorld(Physics.RigidBody.Position), Physics.ClusterToWorld(Physics.RigidBody.Position) + GetMergeNormalWorld()); if (other.GetLineIntersectionExactGrid(ref l, ref pos, ref dist)) { var block = other.GetCubeBlock(pos).FatBlock as MyShipMergeBlock; if (block == null) { continue; } if (block.InConstraint || !block.IsWorking || !block.CheckUnobstructed() || block.GetMergeNormalWorld().Dot(GetMergeNormalWorld()) > 0.0f) { return; } if (!block.FriendlyWithBlock(this)) { return; } CreateConstraint(other, block); NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; m_updateBeforeFlags |= UpdateBeforeFlags.EnableConstraint; break; } } }
protected override void Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) { IHttpRequest request = context.Request; IHttpResponse response = context.Response; MergeData data = Helper.DeserializeXml <MergeData>(request.InputStream); string activityId = PathParser.GetActivityId(data.Source.Href); response.AppendHeader("Cache-Control", "no-cache"); try { // MergeActivityResponse mergeResponse = sourceControlProvider.MergeActivity(activityId); int version = 0; System.DateTime date = System.DateTime.Now; ActivityRepository.Use(activityId, delegate(Activity activity) { if (activity.MergeList.Count != 0) { for (int i = 0; i < activity.MergeList.Count; i++) { string path = activity.MergeList[i].Path; if (path.StartsWith("//!svn/wrk")) { path = Helper.Decode(path.Substring(11 + activityId.Length)); } int ver = GetSDKObject().GetLastestVersionNum(path); System.DateTime d; version = ver > version ? ver : version; GetSDKObject().GetFileModifiedDate(path, out d); date = d > date ? d : date; } } }); MergeActivityResponse mergeResponse = new MergeActivityResponse(version, date, this.UserInfo.strUserName); ActivityRepository.Use(activityId, delegate(Activity activity) { foreach (ActivityItem t in activity.MergeList) { string path = t.Path; if (path.StartsWith("//!svn/wrk")) { path = Helper.Decode(path.Substring(11 + activityId.Length)); } MergeActivityResponseItem item = new MergeActivityResponseItem(t.FileType, path); mergeResponse.Items.Add(item); } }); SetResponseSettings(response, "text/xml", Encoding.UTF8, 200); response.SendChunked = true; using (StreamWriter output = new StreamWriter(response.OutputStream)) { WriteMergeResponse(request, mergeResponse, output); } } catch (ConflictException ex) { SetResponseSettings(response, "text/xml; charset=\"utf-8\"", Encoding.UTF8, 409); string responseContent = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<D:error xmlns:D=\"DAV:\" xmlns:m=\"http://apache.org/dav/xmlns\" xmlns:C=\"svn:\">\n" + "<C:error/>\n" + "<m:human-readable errcode=\"160024\">\n" + ex.Message + "\n" + "</m:human-readable>\n" + "</D:error>\n"; WriteToResponse(response, responseContent); } }