Exemplo n.º 1
0
 public TimingTriggerEdit(string action, PlatformService.T_WF_TIMINGTRIGGERACTIVITY entity)
 {
     InitializeComponent();
     XmlClient  = new FlowXmlDefineClient();
     ActionType = action;
     ListCycle  = new ObservableCollection <Cycle>()
     {
         new Cycle {
             CycleType = "一次"
         },
         new Cycle {
             CycleType = "分钟"
         },
         new Cycle {
             CycleType = "小时"
         },
         new Cycle {
             CycleType = "天"
         },
         new Cycle {
             CycleType = "月"
         },
         new Cycle {
             CycleType = "年"
         }
     };
     this.cmbCycle.ItemsSource = ListCycle;
     if (entity != null)
     {
         Entity = entity;
         InitTiming();
     }
     else
     {
         myDate.Text  = DateTime.Now.ToShortDateString();
         myTime.Value = DateTime.Now;
         this.cmbCycle.SelectedIndex = 3;
     }
     triggerClient.EditTimingActivityCompleted += new EventHandler <EditTimingActivityCompletedEventArgs>(triggerClient_EditTimingActivityCompleted);
     triggerClient.AddTimingActivityCompleted  += new EventHandler <AddTimingActivityCompletedEventArgs>(triggerClient_AddTimingActivityCompleted);
     XmlClient.ListFuncTableColumnCompleted    += new EventHandler <ListFuncTableColumnCompletedEventArgs>(XmlClient_ListFuncTableColumnCompleted);
 }
Exemplo n.º 2
0
 private void btnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (TimingTriggerDataGrid.SelectedItems.Count != 1)
     {
         ComfirmWindow.ConfirmationBox("提示信息", "请选择一条记录进行修改!", "确定");
         return;
     }
     PlatformService.T_WF_TIMINGTRIGGERACTIVITY entity = TimingTriggerDataGrid.SelectedItem as PlatformService.T_WF_TIMINGTRIGGERACTIVITY;
     if (entity != null)
     {
         TimingTriggerEdit edit = new TimingTriggerEdit("1", entity);
         edit.SaveTimingClick += (obj, ev) =>
         {
             BindTriggerData();
         };
         edit.appSystem = appSystem;
         edit.appModel  = appModel;
         edit.cmbModelCode.ItemsSource   = this.cbModelCode.ItemsSource;
         edit.cmbModelCode.SelectedIndex = 0;
         edit.cmbSystemCode.ItemsSource  = this.cbSystemCode.ItemsSource;
         if (this.cbSystemCode.Items.Count > 1)
         {
             for (int i = 0; i < this.cbSystemCode.Items.Count; i++)
             {
                 if ((this.cbSystemCode.Items[i] as FLOW_MODELDEFINE_T).SYSTEMCODE == entity.SYSTEMCODE)
                 {
                     edit.cmbSystemCode.SelectedIndex = i;
                 }
             }
         }
         else
         {
             edit.cmbSystemCode.SelectedIndex = 0;
         }
         edit.cmbModelCode.Selected <FLOW_MODELDEFINE_T>("MODELCODE", entity.MODELCODE);
         edit.Show();
     }
     else
     {
         ComfirmWindow.ConfirmationBox("提示信息", "请选择一条记录进行修改!", "确定");
     }
 }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (txtTriggerName.Text.Trim() == "")
            {
                ComfirmWindow.ConfirmationBox("提示信息", "定时触发名称不能为空!", "确定");
                return;
            }
            FLOW_MODELDEFINE_T system = cmbSystemCode.SelectedItem as FLOW_MODELDEFINE_T;
            FLOW_MODELDEFINE_T model  = cmbModelCode.SelectedItem as FLOW_MODELDEFINE_T;

            if (system.SYSTEMCODE == "0" || model.MODELCODE == "0")
            {
                ComfirmWindow.ConfirmationBox("提示信息", "请正确选择 [系统名称]和[模块名称]!", "确定");
                return;
            }
            if (myDate.Text == "")
            {
                ComfirmWindow.ConfirmationBox("提示信息", "开始时间不能为空!", "确定");
                return;
            }
            if (ActionType == "0")
            {
                #region 新增
                Entity                     = new PlatformService.T_WF_TIMINGTRIGGERACTIVITY();
                Entity.TRIGGERID           = Guid.NewGuid().ToString();
                Entity.TRIGGERNAME         = txtTriggerName.Text;
                Entity.CREATEUSERNAME      = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
                Entity.CREATEUSERID        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                Entity.COMPANYID           = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                Entity.SYSTEMCODE          = (this.cmbSystemCode.SelectedItem as FLOW_MODELDEFINE_T).SYSTEMCODE;
                Entity.SYSTEMNAME          = (this.cmbSystemCode.SelectedItem as FLOW_MODELDEFINE_T).SYSTEMNAME;
                Entity.MODELCODE           = (this.cmbModelCode.SelectedItem as FLOW_MODELDEFINE_T).MODELCODE;
                Entity.MODELNAME           = (this.cmbModelCode.SelectedItem as FLOW_MODELDEFINE_T).DESCRIPTION;
                Entity.TRIGGERROUND        = CycleOperate.CycleExchangeTo((this.cmbCycle.SelectedItem as Cycle).CycleType);
                Entity.CONTRACTTYPE        = "Engine";
                Entity.TRIGGERTYPE         = rbUser.IsChecked == true ? "User" : "System";
                Entity.TRIGGERTIME         = DateTime.Parse(myDate.Text + " " + myTime.Value.Value.TimeOfDay.ToString());
                Entity.TRIGGERACTIVITYTYPE = rbSMS.IsChecked == true ? 1 : 2;
                Entity.MESSAGEURL          = MsgOpen;

                if (this.txtValue.Text.Trim() != "" && cmbFunc.SelectedIndex > 0)
                {
                    AppFunc func = cmbFunc.SelectedItem as AppFunc;
                    Entity.FUNCTIONNAME       = func.FuncName;
                    Entity.FUNCTIONPARAMTER   = ParamOperate.CollectionToString(listpatrm);
                    Entity.WCFURL             = func.Address;
                    Entity.WCFBINDINGCONTRACT = func.Binding;
                    Entity.PAMETERSPLITCHAR   = func.SplitChar;
                }
                else
                {
                    Entity.FUNCTIONNAME       = string.Empty;
                    Entity.FUNCTIONPARAMTER   = string.Empty;
                    Entity.WCFURL             = string.Empty;
                    Entity.WCFBINDINGCONTRACT = string.Empty;
                    Entity.PAMETERSPLITCHAR   = string.Empty;
                }
                triggerClient.AddTimingActivityAsync(Entity);
                #endregion
            }
            else
            {
                #region 修改
                Entity.TRIGGERNAME         = txtTriggerName.Text;
                Entity.COMPANYID           = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                Entity.SYSTEMCODE          = (this.cmbSystemCode.SelectedItem as FLOW_MODELDEFINE_T).SYSTEMCODE;
                Entity.SYSTEMNAME          = (this.cmbSystemCode.SelectedItem as FLOW_MODELDEFINE_T).SYSTEMNAME;
                Entity.MODELCODE           = (this.cmbModelCode.SelectedItem as FLOW_MODELDEFINE_T).MODELCODE;
                Entity.MODELNAME           = (this.cmbModelCode.SelectedItem as FLOW_MODELDEFINE_T).DESCRIPTION;
                Entity.TRIGGERROUND        = CycleOperate.CycleExchangeTo((this.cmbCycle.SelectedItem as Cycle).CycleType);
                Entity.CONTRACTTYPE        = "Engine";
                Entity.TRIGGERTYPE         = rbUser.IsChecked == true ? "User" : "System";
                Entity.TRIGGERTIME         = DateTime.Parse(myDate.Text + " " + myTime.Value.Value.TimeOfDay.ToString());
                Entity.TRIGGERACTIVITYTYPE = rbSMS.IsChecked == true ? 1 : 2;
                Entity.MESSAGEURL          = MsgOpen;
                if (this.txtValue.Text.Trim() != "" && cmbFunc.SelectedIndex > 0)
                {
                    AppFunc func = cmbFunc.SelectedItem as AppFunc;
                    Entity.FUNCTIONNAME       = func.FuncName;
                    Entity.FUNCTIONPARAMTER   = ParamOperate.CollectionToString(listpatrm);
                    Entity.WCFURL             = func.Address;
                    Entity.WCFBINDINGCONTRACT = func.Binding;
                    Entity.PAMETERSPLITCHAR   = func.SplitChar;
                }
                else
                {
                    Entity.FUNCTIONNAME       = string.Empty;
                    Entity.FUNCTIONPARAMTER   = string.Empty;
                    Entity.WCFURL             = string.Empty;
                    Entity.WCFBINDINGCONTRACT = string.Empty;
                    Entity.PAMETERSPLITCHAR   = string.Empty;
                }
                #endregion
                triggerClient.EditTimingActivityAsync(Entity);
            }
        }