/// <summary> /// ensName /// </summary> /// <param name="ensName"></param> public void BindEns(string ensName) { this.UIBindKey = ensName; this.HisLGType = LGType.FK; FF.CCFlowAPISoapClient da = Glo.GetCCFlowAPISoapClientServiceInstance(); da.RequestSFTableAsync(ensName); da.RequestSFTableCompleted += new EventHandler <FF.RequestSFTableCompletedEventArgs>(da_RequestSFTableCompleted); }
/// <summary> /// 发送 /// </summary> private void Send() { this.loadingWindow.Title = "正在保存并发送..."; this.loadingWindow.Show(); FF.CCFlowAPISoapClient sendWorkNode = Glo.GetCCFlowAPISoapClientServiceInstance(); sendWorkNode.Node_SendWorkAsync(Glo.FK_Flow, Glo.FK_Node, Glo.WorkID, Glo.UserNo, this.GenerFrmDataSet().ToXml(true, false)); sendWorkNode.Node_SendWorkCompleted += new EventHandler <FF.Node_SendWorkCompletedEventArgs>(sendWorkNode_Node_SendWorkCompleted); }
/// <summary> /// 入口点 /// </summary> public MainPage() { InitializeComponent(); #region 获取参数 FF.CCFlowAPISoapClient da = Glo.GetCCFlowAPISoapClientServiceInstance(); da.GenerWorkNodeAsync(Glo.FK_Flow, Glo.FK_Node, Glo.WorkID, Glo.UserNo); da.GenerWorkNodeCompleted += new EventHandler <FF.GenerWorkNodeCompletedEventArgs>(BindFrm); #endregion 获取参数 }
/// <summary> /// 删除它 /// </summary> public void DeleteIt() { if (MessageBox.Show("您确定要删除[" + this.Name + "]吗?如果确定它相关的字段与设置也将会被删除,以前产生的历史数据也会被删除。", "删除提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } FF.CCFlowAPISoapClient da = Glo.GetCCFlowAPISoapClientServiceInstance(); da.DoTypeAsync("DelM2M", this.Name, null, null, null, null, null); da.DoTypeCompleted += new EventHandler <FF.DoTypeCompletedEventArgs>(da_DoTypeCompleted); }
public void BindSQL(string sql) { try { FF.CCFlowAPISoapClient da = Glo.GetCCFlowAPISoapClientServiceInstance(); da.RunSQLReturnTableAsync(sql); da.RunSQLReturnTableCompleted += new EventHandler <FF.RunSQLReturnTableCompletedEventArgs>(da_RunSQLReturnTableCompleted); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public BPLine(string name, string color, double borderW, double x1, double y1, double x2, double y2) { this.Name = name; this.MyLine = new Line(); // this.MyLine. this.MyLine.Name = "lo" + name; this.MyLine.X1 = x1; this.MyLine.Y1 = y1; this.MyLine.X2 = x2; this.MyLine.Y2 = y2; this.MyLine.StrokeThickness = borderW; this.MyLine.Cursor = Cursors.Hand; this.Color = color; this.MyLine.Stroke = new SolidColorBrush(Glo.ToColor(color)); this.Content = this.MyLine; }
public void LoadDtl() { FF.CCFlowAPISoapClient da = Glo.GetCCFlowAPISoapClientServiceInstance(); da.RunSQLReturnTableAsync("SELECT * FROM Sys_MapM2M WHERE NoOfObj='" + this.Name + "' AND FK_MapData='" + Glo.FK_MapData + "'"); da.RunSQLReturnTableCompleted += new EventHandler <FF.RunSQLReturnTableCompletedEventArgs>(da_RunSQLReturnTableCompleted); }
/// <summary> /// 绑定表单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BindFrm(object sender, FF.GenerWorkNodeCompletedEventArgs e) { #region 初始化数据. this.canvasMain.Children.Clear(); this.FrmDS = new DataSet(); try { if (e.Result.Length < 200) { throw new Exception(e.Result); } this.FrmDS.FromXml(e.Result); loadingWindow.DialogResult = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Err", MessageBoxButton.OK); loadingWindow.DialogResult = true; return; } #endregion 初始化数据. this.InitToolbar(); string table = ""; try { this.dtMapAttrs = this.FrmDS.Tables["Sys_MapAttr"]; foreach (DataTable dt in this.FrmDS.Tables) { Glo.TempVal = dt.TableName; table = dt.TableName; switch (dt.TableName) { case "Sys_MapAttr": foreach (DataRow dr in dt.Rows) { if (dr["UIVisible"] == "0") { continue; } if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } string myPk = dr["MyPK"]; string FK_MapData = dr["FK_MapData"]; string keyOfEn = dr["KeyOfEn"]; string name = dr["Name"]; string defVal = dr["DefVal"]; string UIContralType = dr["UIContralType"]; string MyDataType = dr["MyDataType"]; string lgType = dr["LGType"]; bool isEnable = false; if (dr["UIIsEnable"].ToString() == "1") { isEnable = true; } double X = double.Parse(dr["X"]); double Y = double.Parse(dr["Y"]); if (X == 0) { X = 100; } if (Y == 0) { Y = 100; } string UIBindKey = dr["UIBindKey"]; switch (UIContralType) { case CtrlType.TextBox: TBType tp = TBType.String; switch (MyDataType) { case DataType.AppInt: tp = TBType.Int; break; case DataType.AppFloat: case DataType.AppDouble: tp = TBType.Float; break; case DataType.AppMoney: tp = TBType.Money; break; case DataType.AppString: tp = TBType.String; break; case DataType.AppDateTime: tp = TBType.DateTime; break; case DataType.AppDate: tp = TBType.Date; break; default: break; } BPTextBox tb = new BPTextBox(tp); tb.NameOfReal = keyOfEn; tb.Name = keyOfEn; tb.SetValue(Canvas.LeftProperty, X); tb.SetValue(Canvas.TopProperty, Y); tb.Text = this.GetValByKey(keyOfEn); //给控件赋值. tb.Width = double.Parse(dr["UIWidth"]); if (tb.Height > 24) { tb.TextWrapping = TextWrapping.Wrap; } tb.Height = double.Parse(dr["UIHeight"]); if (isEnable) { tb.IsEnabled = true; } else { tb.IsEnabled = false; } this.canvasMain.Children.Add(tb); break; case CtrlType.DDL: BPDDL ddl = new BPDDL(); ddl.Name = keyOfEn; ddl.HisLGType = lgType; ddl.Width = double.Parse(dr["UIWidth"]); ddl.UIBindKey = UIBindKey; ddl.HisLGType = lgType; if (lgType == LGType.Enum) { DataTable dtEnum = this.FrmDS.Tables["Sys_Enum"]; foreach (DataRow drEnum in dtEnum.Rows) { if (drEnum["EnumKey"].ToString() != UIBindKey) { continue; } ListBoxItem li = new ListBoxItem(); li.Tag = drEnum["IntKey"].ToString(); li.Content = drEnum["Lab"].ToString(); ddl.Items.Add(li); } if (ddl.Items.Count == 0) { throw new Exception("@没有从Sys_Enum中找到编号为(" + UIBindKey + ")的枚举值。"); } } else { ddl.BindEns(UIBindKey); } ddl.SetValue(Canvas.LeftProperty, X); ddl.SetValue(Canvas.TopProperty, Y); //给控件赋值. ddl.SetSelectVal(this.GetValByKey(keyOfEn)); this.canvasMain.Children.Add(ddl); break; case CtrlType.CheckBox: BPCheckBox cb = new BPCheckBox(); cb.Name = keyOfEn; cb.Content = name; Label cbLab = new Label(); cbLab.Name = "CBLab" + cb.Name; cbLab.Content = name; cbLab.Tag = keyOfEn; cb.Content = cbLab; cb.SetValue(Canvas.LeftProperty, X); cb.SetValue(Canvas.TopProperty, Y); if (this.GetValByKey(keyOfEn) == "1") { cb.IsChecked = true; } else { cb.IsChecked = false; } this.canvasMain.Children.Add(cb); break; case CtrlType.RB: break; default: break; } } continue; case "Sys_FrmRB": DataTable dtRB = this.FrmDS.Tables["Sys_FrmRB"]; foreach (DataRow dr in dtRB.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPRadioBtn btn = new BPRadioBtn(); btn.Name = dr["MyPK"]; btn.GroupName = dr["KeyOfEn"]; btn.Content = dr["Lab"]; btn.UIBindKey = dr["EnumKey"]; btn.Tag = dr["IntKey"]; btn.SetValue(Canvas.LeftProperty, double.Parse(dr["X"].ToString())); btn.SetValue(Canvas.TopProperty, double.Parse(dr["Y"].ToString())); this.canvasMain.Children.Add(btn); } continue; case "Sys_MapDtl": foreach (DataRow dr in dt.Rows) { BPDtl dtl = new BPDtl(dr["No"], this.FrmDS); dtl.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); dtl.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); dtl.Width = double.Parse(dr["W"]); dtl.Height = double.Parse(dr["H"]); this.canvasMain.Children.Add(dtl); } continue; case "Sys_FrmEle": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPEle img = new BPEle(); img.Name = dr["MyPK"].ToString(); img.EleType = dr["EleType"].ToString(); img.EleName = dr["EleName"].ToString(); img.EleID = dr["EleID"].ToString(); img.Cursor = Cursors.Hand; img.SetValue(Canvas.LeftProperty, double.Parse(dr["X"].ToString())); img.SetValue(Canvas.TopProperty, double.Parse(dr["Y"].ToString())); img.Width = double.Parse(dr["W"].ToString()); img.Height = double.Parse(dr["H"].ToString()); this.canvasMain.Children.Add(img); } continue; case "Sys_MapData": if (dt.Rows.Count == 0) { continue; } foreach (DataRow dr in dt.Rows) { if (dr["No"] != Glo.FK_MapData) { continue; } Glo.HisMapData = new MapData(); Glo.HisMapData.FrmH = double.Parse(dt.Rows[0]["FrmH"]); Glo.HisMapData.FrmW = double.Parse(dt.Rows[0]["FrmW"]); Glo.HisMapData.No = (string)dt.Rows[0]["No"]; Glo.HisMapData.Name = (string)dt.Rows[0]["Name"]; // Glo.IsDtlFrm = false; this.canvasMain.Width = Glo.HisMapData.FrmW; this.canvasMain.Height = Glo.HisMapData.FrmH; this.scrollViewer1.Width = Glo.HisMapData.FrmW; } break; case "Sys_FrmBtn": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPBtn btn = new BPBtn(); btn.Name = dr["MyPK"]; btn.Content = dr["Text"].Replace(" ", " "); btn.HisBtnType = (BtnType)int.Parse(dr["BtnType"]); btn.HisEventType = (EventType)int.Parse(dr["EventType"]); if (dr["EventContext"] != null) { btn.EventContext = dr["EventContext"].Replace("~", "'"); } if (dr["MsgErr"] != null) { btn.MsgErr = dr["MsgErr"].Replace("~", "'"); } if (dr["MsgOK"] != null) { btn.MsgOK = dr["MsgOK"].Replace("~", "'"); } btn.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); btn.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); this.canvasMain.Children.Add(btn); } continue; case "Sys_FrmLine": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } string color = dr["BorderColor"]; if (string.IsNullOrEmpty(color)) { color = "Black"; } BPLine myline = new BPLine(dr["MyPK"], color, double.Parse(dr["BorderWidth"]), double.Parse(dr["X1"]), double.Parse(dr["Y1"]), double.Parse(dr["X2"]), double.Parse(dr["Y2"])); myline.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); myline.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); this.canvasMain.Children.Add(myline); } continue; case "Sys_FrmLab": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPLabel lab = new BPLabel(); lab.Name = dr["MyPK"]; string text = dr["Text"].Replace(" ", " "); text = text.Replace("@", "\n"); lab.Content = text; lab.FontSize = double.Parse(dr["FontSize"]); lab.Cursor = Cursors.Hand; lab.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); lab.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); if (dr["IsBold"] == "1") { lab.FontWeight = FontWeights.Bold; } else { lab.FontWeight = FontWeights.Normal; } string color = dr["FontColor"]; lab.Foreground = new SolidColorBrush(Glo.ToColor(color)); this.canvasMain.Children.Add(lab); } continue; case "Sys_FrmLink": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPLink link = new BPLink(); link.Name = dr["MyPK"]; link.Content = dr["Text"]; link.URL = dr["URL"]; link.WinTarget = dr["Target"]; link.FontSize = double.Parse(dr["FontSize"]); link.Cursor = Cursors.Hand; link.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); link.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); string color = dr["FontColor"]; if (string.IsNullOrEmpty(color)) { color = "Black"; } link.Foreground = new SolidColorBrush(Glo.ToColor(color)); this.canvasMain.Children.Add(link); } continue; case "Sys_FrmImg": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPImg img = new BPImg(); img.Name = dr["MyPK"]; img.Cursor = Cursors.Hand; img.SetValue(Canvas.LeftProperty, double.Parse(dr["X"].ToString())); img.SetValue(Canvas.TopProperty, double.Parse(dr["Y"].ToString())); img.Width = double.Parse(dr["W"].ToString()); img.Height = double.Parse(dr["H"].ToString()); this.canvasMain.Children.Add(img); } continue; case "Sys_FrmImgAth": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPImgAth ath = new BPImgAth(); ath.Name = dr["MyPK"]; ath.Cursor = Cursors.Hand; ath.SetValue(Canvas.LeftProperty, double.Parse(dr["X"].ToString())); ath.SetValue(Canvas.TopProperty, double.Parse(dr["Y"].ToString())); ath.Height = double.Parse(dr["H"].ToString()); ath.Width = double.Parse(dr["W"].ToString()); this.canvasMain.Children.Add(ath); } continue; case "Sys_MapM2M": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } BPM2M m2m = new BPM2M(dr["NoOfObj"]); m2m.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); m2m.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); m2m.Width = double.Parse(dr["W"]); m2m.Height = double.Parse(dr["H"]); this.canvasMain.Children.Add(m2m); } continue; case "Sys_FrmAttachment": foreach (DataRow dr in dt.Rows) { if (dr["FK_MapData"] != Glo.FK_MapData) { continue; } string uploadTypeInt = dr["UploadType"].ToString(); if (uploadTypeInt == null) { uploadTypeInt = "0"; } AttachmentUploadType uploadType = (AttachmentUploadType)int.Parse(uploadTypeInt); if (uploadType == AttachmentUploadType.Single) { BPAttachment ath = new BPAttachment(dr["NoOfObj"], dr["Name"], dr["Exts"], double.Parse(dr["W"]), dr["SaveTo"].ToString()); ath.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); ath.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); ath.Label = dr["Name"] as string; ath.Exts = dr["Exts"] as string; ath.SaveTo = dr["SaveTo"] as string; ath.X = double.Parse(dr["X"]); ath.Y = double.Parse(dr["Y"]); if (dr["IsUpload"] == "1") { ath.IsUpload = true; } else { ath.IsUpload = false; } if (dr["IsDelete"] == "1") { ath.IsDelete = true; } else { ath.IsDelete = false; } if (dr["IsDownload"] == "1") { ath.IsDownload = true; } else { ath.IsDownload = false; } this.canvasMain.Children.Add(ath); continue; } if (uploadType == AttachmentUploadType.Multi) { BPAttachmentM athM = new BPAttachmentM(); athM.SetValue(Canvas.LeftProperty, double.Parse(dr["X"])); athM.SetValue(Canvas.TopProperty, double.Parse(dr["Y"])); athM.Name = dr["NoOfObj"]; athM.Width = double.Parse(dr["W"]); athM.Height = double.Parse(dr["H"]); athM.X = double.Parse(dr["X"]); athM.Y = double.Parse(dr["Y"]); athM.SaveTo = dr["SaveTo"]; athM.Text = dr["Name"]; athM.Label = dr["Name"]; this.canvasMain.Children.Add(athM); continue; } } continue; default: break; } } loadingWindow.DialogResult = true; } catch (Exception ex) { MessageBox.Show("err:" + table, ex.Message + " " + ex.StackTrace, MessageBoxButton.OK); } this.SetGridLines(); }