Beispiel #1
0
        private void SaveStep()
        {
            string   key   = listBox1.GetItemText(listBox1.SelectedItem);
            StepItem value = FindItem(key);

            if (value != null)
            {
                if (value.mName != textBoxStepName.Text)
                {
                    foreach (StepItem step in Const.stepList)
                    {
                        if (step.mNextTrue == value.mName)
                        {
                            step.mNextTrue = textBoxStepName.Text;
                        }
                        if (step.mNextFalse == value.mName)
                        {
                            step.mNextFalse = textBoxStepName.Text;
                        }
                    }
                    value.mName = textBoxStepName.Text;
                    UpdateList();
                }
                value.mDescription = textBoxStepMota.Text;
                value.mPoint       = this.comboBoxStepPoint.Text;
                value.mNextTrue    = comboBoxStepNext.Text;
                value.mNextFalse   = comboBoxStepFail.Text;
            }
        }
Beispiel #2
0
    public StepItem GetCurStepItem()
    {
        int      index = StepManager.Instance().CurSetpIndex - 1;
        StepItem temp  = GetOneStepItem(index);

        return(temp);
    }
Beispiel #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string   key   = listBox1.GetItemText(listBox1.SelectedItem);
            StepItem value = FindItem(key);

            if (value != null)
            {
                // Const.stepList[key];
                this.textBoxStepName.Text   = value.mName;
                this.textBoxStepMota.Text   = value.mDescription;
                this.comboBoxStepPoint.Text = value.mPoint;
                this.comboBoxStepNext.Text  = value.mNextTrue;

                if (value.mType == "TT")
                {
                    this.label5.Text = "Tên thao tác:";
                    this.comboBoxStepFail.Hide();// = "N/A";
                    label11.Hide();
                    //this.comboBoxStepFail.Text = "N/A";
                }
                else
                {
                    this.label5.Text = "Tên điều kiện:";
                    this.comboBoxStepFail.Show();
                    label11.Show();
                    this.comboBoxStepFail.Text = value.mNextFalse;
                }
                selectSchemePoint(value.mPoint);
            }
            //UpdateList();
        }
        public ActionResult Details(int id)
        {
            StepDetailViewModel viewModel = new StepDetailViewModel();

            StepItem stepItem = GetSqlItem <StepItem>(StepItem.ItemSql, new { Id = id });

            stepItem.Houses = GetSqlList <ProcedureStepHouse>(ProcedureStepHouse.ListByStepSql, new { StepId = id });

            if (stepItem.Id != 0)
            {
                viewModel.Step = stepItem;

                Tuple <List <RouteItem>, List <StepHouse> > routesAndSteps = GetSqlList <RouteItem, StepHouse>(RouteItem.ListByStepSql, new { StepId = id });

                routesAndSteps.Item1
                .ForEach(r => {
                    r.FromStepHouseName =
                        string.Join(",", routesAndSteps.Item2
                                    .Where(s => s.ProcedureStepId == r.FromStepId).Select(s => s.HouseName));
                    r.ToStepHouseName = string.Join(",", routesAndSteps.Item2
                                                    .Where(s => s.ProcedureStepId == r.ToStepId).Select(s => s.HouseName));
                });

                viewModel.Routes = routesAndSteps.Item1;

                viewModel.BusinessItems = GetSqlList <BusinessItem>(BusinessItem.ListByStepSql, new { StepId = id });
                List <BusinessItemStep> steps = GetSqlList <BusinessItemStep>(BusinessItemStep.ListByStepSql, new { StepId = id });
                viewModel.BusinessItems.ForEach(bi => bi.ActualisesProcedureStep = steps.Where(s => s.BusinessItemId == bi.Id).ToList());
            }

            return(View(viewModel));
        }
Beispiel #5
0
        private void AddCheckInDT(string qrcode, int id)
        {
            CheckInDT dT = new CheckInDT
            {
                CheckData   = DateTime.Now.ToShortDateString(),
                CheckInID   = id,
                delflag     = false,
                Rating      = ratingStar.Rating,
                Meno        = frist_ScStauts.Dicval,
                GoodsStauts = frist_ScStauts.id
            };

            int iddt = checkInService.AddCheckInDT(dT);

            if (iddt > 0)
            {
                ShowTipsMessageBox("添加成功");
                pb_qr.Image     = QRManage.GetQRCodeByZXingNet(qrcode, pb_qr.Width, pb_qr.Height);
                lbl_qrcode.Text = qrcode;

                StepItem item = new StepItem(frist_ScStauts.id.ToString(), frist_ScStauts.Dicname);
                progressSteps.Items.Add(item);
                Btn_adddt.Visible = true;
                btn_print.Visible = true;
                GetHistory((int)txb_name.Tag);
            }
            oper = 0;
        }
Beispiel #6
0
    public bool IsCurDragTarget(EleItem item)
    {
        int      index = StepManager.Instance().CurSetpIndex - 1;
        StepItem temp  = GetOneStepItem(index);

        return(temp.CurDragEleItem.Name.Equals(item.Name));
    }
Beispiel #7
0
 private void AddStep(string p, int type, StepItem nextTrue = null, StepItem nextFalse = null)
 {
     if (p == null)
     {
         MessageBox.Show("Tên không hợp lệ");
         return;
     }
     if (FindItem(p) != null)
     {
         MessageBox.Show("Tên như vậy đã tồn tại");
         return;
     }
     if (type == 2)//thao tac
     {
         StepItem newstep = new StepItem();
         newstep.Init(p, nextTrue);
         Const.stepList.Add(newstep);
         UpdateList();
     }
     else if (type == 3)//dieu kien
     {
         StepItem newstep = new StepItem();
         newstep.Init(p, nextTrue, nextFalse);
         Const.stepList.Add(newstep);
         UpdateList();
     }
 }
Beispiel #8
0
        private void CreateList()
        {
            var stepItem = new StepItem();

            stepItem.actionTitle = parent.Title;
            stepItem.actionTime  = "This takes: " + parent.ExpectedCompletionTime.ToString(@"%h") + (parent.ExpectedCompletionTime.ToString(@"%h") != "1" ? "hrs " : "hr ") + parent.ExpectedCompletionTime.ToString(@"mm") + (parent.ExpectedCompletionTime.ToString(@"mm") != "01" ? "mins" : "min");;
            stepItem.stepsList   = new ObservableCollection <Instruction>();

            var stepsCount = 0;


            foreach (Instruction step in instruction_steps)
            {
                if (step.IsComplete == true)
                {
                    step.Photo = "greencheckmark.png";
                    processedSteps.Add(stepsCount);
                }
                else
                {
                    step.Photo = parent.PicUrl;
                    step.Photo = "whiteCheckMarkIcon";
                }
                step.stepIndex = stepsCount;
                step.color     = MainPage.account.routineColor.ToHex();;

                stepItem.stepsList.Add(step);
                items.Add(step);
                stepsCount++;
            }

            stepSource.Add(stepItem);
            collectionViewSteps.ItemsSource = stepSource;
            UpdateRoutineStatus();
        }
Beispiel #9
0
        private void button6_Click(object sender, EventArgs e)
        {
            string   key   = listBox1.GetItemText(listBox1.SelectedItem);
            StepItem value = FindItem(key);

            if (value.mType == "TT")
            {
                if (MessageBox.Show("Chuyển bước tiếp theo?", "Chuyển bước", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                int index = listBox1.FindString(comboBoxStepNext.Text);
                if (index > -1)
                {
                    listBox1.SetSelected(index, true);
                }
                else
                {
                    return;
                }
            }
            else if (label_kl_voltage.Text == "Đạt" && label_kl_amp.Text == "Đạt" && label_kl_noise.Text == "Đạt")
            {
                if (MessageBox.Show("Kết quả đo đạt yêu cầu, chuyển bước tiếp theo?", "Chuyển bước", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                int index = listBox1.FindString(comboBoxStepNext.Text);
                if (index > -1)
                {
                    listBox1.SetSelected(index, true);
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (MessageBox.Show("Kết quả đo không đạt yêu cầu, chuyển bước tiếp theo?", "Chuyển bước", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                int index = listBox1.FindString(comboBoxStepFail.Text);
                if (index > -1)
                {
                    listBox1.SetSelected(index, true);
                }
                else
                {
                    return;
                }
            }
        }
Beispiel #10
0
 private bool CheckNeedWaitNextStep(StepItem step)
 {
     foreach (FadeInItem item in step.fadeInList)
     {
         if (item.gameObject.activeSelf)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #11
0
        private void AddProgressSetp(CheckInDT dt)
        {
            Sysdic   staut = ScStautlist.Find(s => s.id == dt.GoodsStauts);
            StepItem item  = new StepItem(staut.id.ToString(), staut.Dicval);

            item.Tag = dt;
            progressSteps.Items.Add(item);
            ratingStar.Rating = (int)dt.Rating;
            lbl_dtmemo.Text   = dt.Meno;
            nud_cost.Value    = (int)dt.ServerPay;
            progressSteps.Refresh();
        }
Beispiel #12
0
        private void ProgressStepsClick(object sender)
        {
            StepItem  item = (StepItem)sender;
            CheckInDT dt   = (CheckInDT)item.Tag;

            ratingStar.Rating = (int)dt.Rating;
            lbl_dtmemo.Text   = dt.Meno;
            nud_cost.Value    = (int)dt.ServerPay;
            int       count    = progressSteps.Items.Count;
            StepItem  lastitem = (StepItem)progressSteps.Items[count - 1];
            CheckInDT dTlast   = (CheckInDT)lastitem.Tag;
            bool      islast   = dt.id == dTlast.id;

            DetailBtnVisible(islast);
        }
Beispiel #13
0
        private void button5_Click(object sender, EventArgs e)
        {
            //Const.stepList.Remove(listBox1.SelectedItem as StepItem);
            if (MessageBox.Show("Xóa bước đã chọn?", "Xóa bước", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            StepItem step = FindItem(this.textBoxStepName.Text);

            if (step != null)
            {
                Const.stepList.Remove(step);
            }
            UpdateList();
        }
        /// 添加新的阶梯电价
        /// <summary>
        /// 添加新的阶梯电价
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int             rowIndex = dataGridViewX1.Rows.Add();
            DataGridViewRow row      = dataGridViewX1.Rows[rowIndex];
            StepItem        step     = new StepItem();

            row.Cells[0].Value = rowIndex;
            row.Cells[1].Value = string.Format("{0:F2}", step.StepValue);
            row.Cells[2].Value = string.Format("{0:F4}", step.StepPrice);

            if (row.Index == 0)
            {
                row.Cells[1].Value = 0;
            }
            stepCount = dataGridViewX1.Rows.Count;
        }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            readForm();
        }
        else
        {
            var step1 = new StepItem();
            step1.SubSteps = new List <SubStepItem>();
            step1.SubSteps.Add(new SubStepItem());

            var Steps = new List <StepItem>();
            Steps.Add(step1);

            StoredList = Steps;

            bindRepeater();
        }
    }
Beispiel #16
0
 private void SwapItems(string key, string keynext)
 {
     foreach (StepItem step in Const.stepList)
     {
         if (step.mName == key)
         {
             foreach (StepItem stepnext in Const.stepList)
             {
                 if (stepnext.mName == keynext)
                 {
                     StepItem temp = new StepItem();
                     temp.copy(step);
                     step.copy(stepnext);
                     stepnext.copy(temp);
                     return;
                 }
             }
         }
     }
 }
Beispiel #17
0
    private void InitData()
    {
        _congfigStep = (ConfigStep)ConfigManager.Instance().GetConfig(ConfigType.ConfigStep);
        Transform tran = GameObject.Find("StepObjs").transform;

        EleItems = new List <EleItem>(tran.childCount);
        for (int i = 0; i < tran.childCount; i++)
        {
            EleItem item = new EleItem(tran.GetChild(i));
            EleItems.Add(item);
        }
        StepItems = new Dictionary <int, StepItem>(5);

        for (int i = 0; i < _congfigStep.ConfigDatas.Count; i++)
        {
            StepItem sItem = new StepItem();
            sItem.Index          = i;
            sItem.Desc           = StepManager.Instance().GetCurStepDesc(i);
            sItem.CurDragEleItem = EleItems.Find(x => x.Name.Equals(_congfigStep.Get(i + 1).dragName));
            sItem.CurCastEleItem = EleItems.Find(x => x.Name.Equals(_congfigStep.Get(i + 1).castName));
            StepItems.Add(i, sItem);
        }
    }
Beispiel #18
0
    private void readForm()
    {
        var steps = new List <StepItem>();

        foreach (RepeaterItem RI in StepRep.Items)
        {
            var step = new StepItem();
            step.Name     = ((TextBox)RI.FindControl("NameBox")).Text;
            step.Ratio    = Double.Parse(((TextBox)RI.FindControl("RatioBox")).Text);
            step.SubSteps = new List <SubStepItem>();

            var SubRep = (Repeater)RI.FindControl("SubStepRep");
            foreach (RepeaterItem SubRI in SubRep.Items)
            {
                var subStep = new SubStepItem();
                subStep.Name  = ((TextBox)SubRI.FindControl("SubNameBox")).Text;
                subStep.Ratio = Double.Parse(((TextBox)SubRI.FindControl("SubRatioBox")).Text);
                step.SubSteps.Add(subStep);
            }
            steps.Add(step);
        }
        StoredList = steps;
    }
        /// <summary>
        /// must start with low-case!!!
        /// </summary>
        /// <param name="xpath"></param>
        public void htmlElementSelected(string xpath)
        {
            Application.Current.Dispatcher.Invoke((Action)(() =>
            {
                switch (route_type)
                {
                case RouteType.DATA_SEPARATED_FROM_LIST:
                    MainWindow.This.Browser.HighlightElements(xpath);
                    if (step.SelectedIndex == 0)
                    {
                        route.SetOutput(Queue.StartQueueName, new Route.Output.UrlCollection {
                            Queue = "ListNextPage", Xpath = xpath
                        });
                        route.SetOutput("ListNextPage", new Route.Output.UrlCollection {
                            Queue = "ListNextPage", Xpath = xpath
                        });
                    }
                    else if (step.SelectedIndex == 1)
                    {    //SetProductPages
                        string x = find_product_links_xpath(xpath);
                        route.SetOutput(Queue.StartQueueName, new Route.Output.UrlCollection {
                            Queue = "Product0", Xpath = x
                        });
                        route.SetOutput("ListNextPage", new Route.Output.UrlCollection {
                            Queue = "Product0", Xpath = x
                        });
                        MainWindow.This.Browser.HighlightElements(x);
                    }
                    else if (step.SelectedIndex == step.Items.Count - 1)
                    {
                        route.SetOutput("Product" + (step.Items.Count - 4), new Route.Output.UrlCollection {
                            Queue = "Product" + (step.Items.Count - 3), Xpath = xpath
                        });
                        step.Items.Insert(step.Items.Count - 1, "SetProduct" + (step.Items.Count - 3));
                    }
                    else
                    {    //SetProduct
                        DataFieldWindow w = new DataFieldWindow(xpath);
                        if (w.ShowDialog() == true)
                        {
                            foreach (DataFieldWindow.Item i in w.Items)
                            {
                                if (i.Get)
                                {
                                    route.SetOutput("Product" + (step.SelectedIndex - 2), new Route.Output.Field {
                                        Name = w.Name.Text + "." + i.Attribute, Xpath = xpath, Attribute = i.Attribute
                                    });
                                }
                            }
                        }
                    }
                    break;

                case RouteType.DATA_IS_IN_LIST:
                    MainWindow.This.Browser.HighlightElements(xpath);
                    if (step.SelectedIndex == 0)
                    {
                        route.SetOutput(Queue.StartQueueName, new Route.Output.UrlCollection {
                            Queue = "ListNextPage", Xpath = xpath
                        });
                        route.SetOutput("ListNextPage", new Route.Output.UrlCollection {
                            Queue = "ListNextPage", Xpath = xpath
                        });
                    }
                    else if (step.SelectedIndex == 1)
                    {    //SetProductBlocks
                        string x = find_product_blocks_xpath(xpath);
                        route.SetOutput(Queue.StartQueueName, new Route.Output.ElementCollection {
                            Queue = "Product0", Xpath = x
                        });
                        route.SetOutput("ListNextPage", new Route.Output.ElementCollection {
                            Queue = "Product0", Xpath = x
                        });
                        MainWindow.This.Browser.HighlightElements(x);
                        base_xpath = xpath;
                    }
                    else
                    {    //SetProduct
                        if (base_xpath == null)
                        {
                            Message.Error("No product block was set.");
                            return;
                        }
                        if (!xpath.StartsWith(base_xpath))
                        {
                            MainWindow.This.Browser.HighlightElements(base_xpath);
                            Message.Error("Your selection must be inside the product block you picked up previously.");
                            return;
                        }
                        DataFieldWindow w = new DataFieldWindow(xpath);
                        if (w.ShowDialog() == true)
                        {
                            foreach (DataFieldWindow.Item i in w.Items)
                            {
                                if (i.Get)
                                {
                                    route.SetOutput("Product0", new Route.Output.Field {
                                        Name = w.Name.Text + "." + i.Attribute, Xpath = xpath.Substring(base_xpath.Length, xpath.Length - base_xpath.Length), Attribute = i.Attribute
                                    });
                                }
                            }
                        }
                    }
                    break;

                case RouteType.UNIVERSAL:
                    MainWindow.This.Browser.HighlightElements(xpath);
                    StepItem si = ((StepItem)step.SelectedItem);
                    if (si.Step == StepItem.Steps.ListNext)
                    {
                        route.SetOutput(si.QueueName, new Route.Output.UrlCollection {
                            Queue = si.QueueName, Xpath = xpath, QueuingManner = Route.Output.UrlCollection.QueuingManners.LIFO
                        });
                    }
                    else if (si.Step == StepItem.Steps.Children)
                    {
                        string x = find_product_links_xpath(xpath);

                        string output_queue_name = null;
                        bool passed = false;
                        foreach (Route.Queue q in route.GetQueues())
                        {
                            if (passed)
                            {
                                output_queue_name = q.Name;
                                break;
                            }
                            if (q.Name == si.QueueName)
                            {
                                passed = true;
                            }
                        }
                        if (output_queue_name == null)
                        {
                            output_queue_name = Queue.BaseName + (Queue.GetLevel(si.QueueName) + 1);
                            step.Items.Add(new StepItem(StepItem.Steps.ListNext, output_queue_name));
                            step.Items.Add(new StepItem(StepItem.Steps.Data, output_queue_name));
                            step.Items.Add(new StepItem(StepItem.Steps.Children, output_queue_name));
                        }
                        route.SetOutput(si.QueueName, new Route.Output.UrlCollection {
                            Queue = output_queue_name, Xpath = x
                        });

                        MainWindow.This.Browser.HighlightElements(x);
                    }
                    else if (si.Step == StepItem.Steps.Data)
                    {
                        DataFieldWindow w = new DataFieldWindow(xpath);
                        if (w.ShowDialog() == true)
                        {
                            foreach (DataFieldWindow.Item i in w.Items)
                            {
                                if (i.Get)
                                {
                                    Route.Output.Field f = new Route.Output.Field {
                                        Name = w.Name.Text + "." + i.Attribute, Xpath = xpath, Attribute = i.Attribute
                                    };
                                    route.SetOutput(si.QueueName, f);
                                    DataFieldsWindow.This.OutputFieldAdded(si.QueueName, f.Name, i.Value);
                                }
                            }
                        }
                    }
                    else if (si.Step == StepItem.Steps.Submit)
                    {
                        string action = null;
                        if (Regex.IsMatch(xpath, @"/input(\[\d+\])?$", RegexOptions.IgnoreCase))
                        {
                            string type = MainWindow.This.Browser.GetAttribute(xpath, "type")[0];
                            if (Regex.IsMatch(type, @"text|email|password", RegexOptions.IgnoreCase))
                            {
                                action = "set";
                            }
                            else
                            {
                                action = "click";
                            }
                        }
                        else if (Regex.IsMatch(xpath, @"/textarea(\[\d+\])?$", RegexOptions.IgnoreCase))
                        {
                            action = "set";
                        }
                        else if (Regex.IsMatch(xpath, @"/button(\[\d+\])?$", RegexOptions.IgnoreCase))
                        {
                            action = "click";
                        }
                        else
                        {
                            return;
                        }

                        switch (action)
                        {
                        case "set":
                            route.AddAction(si.QueueName, new Route.Action.Set {
                                Xpath = xpath, Attribute = "value", Value = MainWindow.This.Browser.GetValue(xpath)[0]
                            });
                            break;

                        case "click":
                            route.AddAction(si.QueueName, new Route.Action.Click {
                                Xpath = xpath
                            });
                            route.AddAction(si.QueueName, new Route.Action.WaitDocumentLoaded {
                                MinimalSleepMss = 500
                            });

                            MainWindow.This.Browser.Click(xpath);
                            //MainWindow.This.Browser.WaitForCompletion();
                            break;

                        default:
                            throw new Exception("Undefined action: " + action);
                        }
                    }
                    else
                    {
                        throw new Exception("No such option: " + si.Step);
                    }
                    break;

                default:
                    throw new Exception("No such option: " + route_type);
                }
            }));
        }
 /// <summary>
 /// 渲染 Step 组件方法
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected virtual RenderFragment RenderStep(StepItem item) => new(builder =>