private void RepeatItemOperation(ItemOperation func, Item item, int repeatCount) { for (int i = 0; i < repeatCount; i++) { func(item); } }
public void CheckLinks(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); List <Item> items = GetSubItems(args); if (args.IsPostBack) { if (args.Result != "yes") { args.AbortPipeline(); } } else { int num = 0; foreach (Item item in items) { num += ItemOperation.GetLinks(item); if (num > 250) { break; } } if (num > 250) { SheerResponse.Confirm(Translate.Text("This operation may take a long time to complete.\n\nAre you sure you want to continue?")); args.WaitForPostBack(); } } }
private static string GetBugOperationUrl(ItemOperation operation, int itemId) { ApplicationConfig appconfig = IOHelper.LoadIsolatedData(); string url = string.Empty; switch (operation) { case ItemOperation.View: url = string.Format(appconfig.ViewBugUrl, itemId); break; case ItemOperation.Edit: url = string.Format(appconfig.EditBugUrl, itemId); break; case ItemOperation.Resole: url = string.Format(appconfig.ResolveBugUrl, itemId); break; case ItemOperation.Active: url = string.Format(appconfig.ResolveBugUrl, itemId); break; default: break; } return(url); }
public void DeleteItemTest() { var test1 = ItemOperation.GetDeSerializeFolders(testItems); var test2 = ItemOperation.ListToRecursion(test1.ToList()); var target = test2.FirstOrDefault(i => i.Key == 0); ItemOperation.DeleteItem(1, test2); }
public static ItemOperation ToItemOperation(this CopyResult data) { var res = new ItemOperation { DateTime = data.DateTime, Path = data.OldFullPath }; return(res); }
public static ItemOperation ToItemOperation(this RemoveResult data) { var res = new ItemOperation { DateTime = data.DateTime, Path = data.Path }; return(res); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); conn.Open(); //初始化投票项目操作类 ItemOperation io = new ItemOperation(); //获取总投票数 VoteCount = io.GetVoteCount(); conn.Close(); } }
public void InsertItemTest() { var test1 = ItemOperation.GetDeSerializeFolders(testItems); var test2 = ItemOperation.ListToRecursion(test1.ToList()); var insert = new ItemOperation.RecursionFolder() { Key = 3, Title = "insert", ParentKey = 1, Items = new List <ItemOperation.PasswordItem>(3), Children = null, }; var target = test2.FirstOrDefault(i => i.Key == 0); var result = ItemOperation.InsertItem(target, insert, test2); }
public async Task <RemoveResult> Remove(string fullPath) { //var req = await new YadDeleteRequest(HttpSettings, (YadWebAuth)Authent, fullPath) // .MakeRequestAsync(); await new YaDCommonRequest(HttpSettings, (YadWebAuth)Authent) .With(new YadDeletePostModel(fullPath), out YadResponseModel <YadDeleteRequestData, YadDeleteRequestParams> itemInfo) .MakeRequestAsync(); var res = itemInfo.ToRemoveResult(); if (res.IsSuccess) { _lastRemoveOperation = res.ToItemOperation(); } return(res); }
public string ToString(int keyLength) { int padding; if (keyLength == -1) { padding = 2; } else { padding = keyLength - Item.Key.Length; } string opLine = $"{new string(' ', 4)}{Item.Key}{new string(' ', padding)}"; opLine += ItemOperation.ToString(padded: true) + " "; opLine += StatusOperation.ToString(padded: true) + " "; opLine += Reason; return(opLine); }
protected void Btntp_Click(object sender, EventArgs e) { //初始化投票项目操作类 ItemOperation io = new ItemOperation(); //遍历网格控件中的每一行 foreach (GridViewRow rowview in GridView1.Rows) { //搜索模板列中的CheckBox控件 CheckBox check = (CheckBox)rowview.Cells[2].FindControl("CheckBox1"); //如果被选中 if (check.Checked) { //更新数据库中的被投次数 io.UpdateVote(int.Parse(rowview.Cells[0].Text)); this.lblMessage.Visible = true; lblMessage.Text = "谢谢您的投票"; check.Checked = false; } } BindData(); }
protected void Btntp_Click(object sender, EventArgs e) { //初始化投票项目操作类 ItemOperation io = new ItemOperation(); //遍历网格控件中的每一行 foreach (GridViewRow rowview in GridView1.Rows) { //搜索模板列中的CheckBox控件 CheckBox check = (CheckBox)rowview.Cells[2].FindControl("CheckBox1"); //如果被选中 if (check.Checked) { //更新数据库中的被投次数 io.UpdateVote(int.Parse(rowview.Cells[0].Text)); lblMessage.Visible = true; lblMessage.Text = "谢谢您的投票"; check.Checked = false; } } BindData(); }
internal static void OpenItem(int newItemsId, ItemType newItemsType, ItemOperation operation) { string url = string.Empty; if (newItemsId > 0) { if (newItemsType == ItemType.Bug) { url = GetBugOperationUrl(operation, newItemsId); } else if (newItemsType == ItemType.Task) { url = GetTaskOperationUrl(operation, newItemsId); } else if (newItemsType == ItemType.Story) { url = GetStoryOperationUrl(operation, newItemsId); } OpenWebBrowser(url); } }
/// <summary> /// 打开对应的网页 /// </summary> /// <param name="item"></param> internal static void OpenItem(ItemBase item, ItemOperation operation) { string url = string.Empty; if (item != null) { if (item is BugItem) { url = GetBugOperationUrl(operation, item); } else if (item is TaskItem) { url = GetTaskOperationUrl(operation, item); } else if (item is StoryItem) { url = GetStoryOperationUrl(operation, item); } OpenWebBrowser(url); } }
public FrmItemBox(ItemOperation operation, Product product = null) { InitializeComponent(); Product = product; if (operation == ItemOperation.Add) { Product = new Product(); } else { if (Product == null) { throw new ApplicationException("Produto não pode ser nulo em modo de edição."); } this.Text = "Editar Item"; } this.tbName.DataBindings.Add("Text", this.Product, "Name"); this.tbBuyingPrice.DataBindings.Add("Text", this.Product, "BuyingPrice"); this.tbSellingPrice.DataBindings.Add("Text", this.Product, "SellingPrice"); btnConfirm.DialogResult = DialogResult.OK; btnCancel.DialogResult = DialogResult.Cancel; }
public ProductionPlanControl() { InitializeComponent(); m_productionPlanDao = new ProductionPlanDao(); m_productionPlanList = new BindingList <Models.ProductionPlan>(); productionPlans = new List <Models.ProductionPlan>(); m_productionInfoDao = new ProductionInfoDao(); opcClient = new OpcClient(); string batchNo = DateTime.Now.ToString("yyyyMMdd"); productionPlans = m_productionPlanDao.GetDataSourceList(batchNo); gridControl.DataSource = productionPlans; Dictionary <object, string> dicButtons = new Dictionary <object, string>(); dicButtons.Add("Up", "上件"); dicButtons.Add("Stop", "暂停"); //dicButtons.Add("Finish", "结束上件"); RepositoryItemButtonEdit ribe = ItemOperation.CreateRepositoryItemButtonEdit(dicButtons); ribe.ButtonClick += new ButtonPressedEventHandler(this.ribe_ButtonClick); //绑定事件 this.gridView.Columns["Operating"].ColumnEdit = ribe; m_xmlSettings = new XMLSettings(); m_xmlSettings.ReadXMLSettings(); if (opcClient.WriteDataToOpcServer(m_xmlSettings.Count, (ushort)0)) { opcClient.WriteDataToOpcServer(new Models.ProductionPlan { BatchNo = "0", WorkpieceType = "0", PrimerColor = "0", PigmentedCoatingColor = "0", VarnishColor = "0", WorkpieceNo = "0", PrimerFirm = "0", PrimerCraft = "0", PigmentedCoatingFirm = "0", PigmentedCoatingCraft = "0", VarnishFirm = "0", VarnishCraft = "0", TotalNum = 0 }); } Task t1 = Task.Run(() => { byte data = 0; while (data < 128) { try { opcClient.WriteDataToOpcServer(m_xmlSettings.Heartbeat, data); data++; if (data == 128) { data = 0; } } catch (Exception ex) { LogManager.WriteLog(LogFile.Warning, $"t1:{ex.Message}"); } } }); Task t2 = Task.Run(() => { while (true) { try { short tagInitializationNo202 = Convert.ToInt16(opcClient.ReadData(m_xmlSettings.TagInitializationNo202).Value); short tagInitializationNo203 = Convert.ToInt16(opcClient.ReadData(m_xmlSettings.TagInitializationNo203).Value); if (tagInitializationNo202 >= tagInitializationNo203) { int value = tagInitializationNo202 <= 454 ? 454 : tagInitializationNo202; opcClient.WriteStrDataToOpcServer(m_xmlSettings.TagInitializationNo203, $"{value}"); } } catch (Exception ex) { LogManager.WriteLog(LogFile.Warning, $"t2:{ex.Message}"); } } }); }
public void RecursionToListTest() { var test1 = ItemOperation.GetDeSerializeFolders(testItems); var test2 = ItemOperation.ListToRecursion(test1.ToList()); var test3 = ItemOperation.RecursionToList(test2.ToList()); }
public static string ToString(this ItemOperation op, bool padded = false) { string name = op == ItemOperation.None ? "" : Enum.GetName(typeof(ItemOperation), op); return(name + new string(' ', maxlen - name.Length)); }
private static string GetStoryOperationUrl(ItemOperation operation, ItemBase item) { return(GetStoryOperationUrl(operation, item.ID)); }
public void GetSerializeFoldersTest() { var test = ItemOperation.GetDeSerializeFolders(testItems); var test2 = ItemOperation.GetSerializeFolders(test.ToList()); }