void ToolbarDDL_SelectedIndexChanged(object sender, EventArgs e) { if (this.SelectedItemStringVal == "...") { PubClass.Alert("hello"); return; } // throw new Exception("The method or operation is not implemented."); }
/// <summary> /// 与业务表数据同步 /// </summary> /// <returns></returns> public string DTSBTable_Save() { Flow flow = new Flow(this.FK_Flow); BP.WF.Template.FlowDTSWay dtsWay = (BP.WF.Template.FlowDTSWay) this.GetRequestValInt("RB_DTSWay"); flow.DTSWay = dtsWay; if (flow.DTSWay == FlowDTSWay.None) { flow.Update(); return("保存成功."); } flow.DTSDBSrc = this.GetRequestVal("DDL_DBSrc"); flow.DTSBTable = this.GetRequestVal("DDL_Table"); DTSField field = (DTSField)this.GetRequestValInt("DTSField"); if (field == 0) { field = DTSField.SameNames; } flow.DTSField = field; SFDBSrc s = new SFDBSrc("local"); if (field == DTSField.SameNames) { DataTable dt = s.GetColumns(flow.PTable); s = new SFDBSrc(flow.DTSDBSrc); // this.src); DataTable ywDt = s.GetColumns(flow.DTSBTable); // this.ywTableName); string str = ""; string ywStr = ""; foreach (DataRow ywDr in ywDt.Rows) { foreach (DataRow dr in dt.Rows) { if (ywDr["No"].ToString().ToUpper() == dr["No"].ToString().ToUpper()) { if (dr["No"].ToString().ToUpper() == "OID") { flow.DTSBTablePK = "OID"; } str += dr["No"].ToString() + ","; ywStr += ywDr["No"].ToString() + ","; } } } if (!DataType.IsNullOrEmpty(str)) { flow.DTSFields = str.TrimEnd(',') + "@" + ywStr.TrimEnd(','); } else { PubClass.Alert("未检测到业务主表【" + flow.PTable + "】与表【" + flow.DTSBTable + "】有相同的字段名."); return("");//不执行保存 } } else//按设置的字段匹配 检查在 { try { s = new SFDBSrc("local"); string str = flow.DTSFields; string[] arr = str.Split('@'); string sql = "SELECT " + arr[0] + " FROM " + flow.PTable; s.RunSQL(sql); s = new SFDBSrc(flow.DTSDBSrc); sql = "SELECT " + arr[1] + ", " + flow.DTSBTablePK + " FROM " + flow.DTSBTable; s.RunSQL(sql); } catch { //PubClass.Alert(ex.Message); PubClass.Alert("设置的字段有误.【" + flow.DTSFields + "】"); return("");//不执行保存 } } flow.Update(); return(flow.ToJson()); }
public void btn_Do_Click(object sender, EventArgs e) { string ensName = this.Request.QueryString["M"]; Method rm = BP.DA.ClassFactory.GetMethod(ensName); // rm.Init(); int mynum = 0; foreach (Attr attr in rm.HisAttrs) { if (attr.MyFieldType == FieldType.RefText) { continue; } mynum++; } int idx = 0; foreach (Attr attr in rm.HisAttrs) { if (attr.MyFieldType == FieldType.RefText) { continue; } if (attr.UIVisible == false) { continue; } try { switch (attr.UIContralType) { case UIContralType.TB: switch (attr.MyDataType) { case BP.DA.DataType.AppString: case BP.DA.DataType.AppDate: case BP.DA.DataType.AppDateTime: string str1 = this.UCEn1.GetTBByID("TB_" + attr.Key).Text; rm.SetValByKey(attr.Key, str1); break; case BP.DA.DataType.AppInt: int myInt = int.Parse(this.UCEn1.GetTBByID("TB_" + attr.Key).Text); rm.Row[idx] = myInt; rm.SetValByKey(attr.Key, myInt); break; case BP.DA.DataType.AppFloat: float myFloat = float.Parse(this.UCEn1.GetTBByID("TB_" + attr.Key).Text); rm.SetValByKey(attr.Key, myFloat); break; case BP.DA.DataType.AppDouble: case BP.DA.DataType.AppMoney: case BP.DA.DataType.AppRate: decimal myDoub = decimal.Parse(this.UCEn1.GetTBByID("TB_" + attr.Key).Text); rm.SetValByKey(attr.Key, myDoub); break; case BP.DA.DataType.AppBoolean: int myBool = int.Parse(this.UCEn1.GetTBByID("TB_" + attr.Key).Text); rm.SetValByKey(attr.Key, myBool); break; default: throw new Exception("没有判断的数据类型."); } break; case UIContralType.DDL: try { string str = this.UCEn1.GetDDLByKey("DDL_" + attr.Key).SelectedItemStringVal; rm.SetValByKey(attr.Key, str); } catch (Exception ex) { rm.SetValByKey(attr.Key, ""); } break; case UIContralType.CheckBok: if (this.UCEn1.GetCBByKey("CB_" + attr.Key).Checked) { rm.SetValByKey(attr.Key, 1); } else { rm.SetValByKey(attr.Key, 0); } break; default: break; } idx++; } catch (Exception ex) { throw new Exception("attr=" + attr.Key + " attr = " + attr.Key + ex.Message); } } try { object obj = rm.Do(); if (obj != null) { switch (rm.HisMsgShowType) { case MsgShowType.SelfAlert: PubClass.Alert(obj.ToString()); return; case MsgShowType.SelfMsgWindows: PubClass.Alert(obj.ToString()); return; case MsgShowType.Blank: this.ToMsgPage(obj.ToString()); return; default: return; } } this.WinClose(); } catch (Exception ex) { this.UCEn1.AddMsgOfWarning("@执行[" + ensName + "]期间出现错误:", ex.Message); } return; }
/// <summary> /// 保存数据同步 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSave_Click(object sender, EventArgs e) { Flow flow = new Flow(this.FK_Flow); #region 步 if (this.RB_DTSWay0.Checked) { flow.DTSWay = FlowDTSWay.None; } #endregion #region 步 if (this.RB_DTSWay1.Checked) { flow.DTSDBSrc = this.DDL_DBSrc.SelectedValue; flow.DTSBTable = this.DDL_Table.SelectedValue; DTSField field = DTSField.SameNames; if (this.RB_DTSField1.Checked) { field = DTSField.SpecField; } flow.DTSField = field; FlowDTSTime time = FlowDTSTime.AllNodeSend; if (this.RB_DTSTime1.Checked) { time = FlowDTSTime.SpecNodeSend; } if (this.RB_DTSTime2.Checked) { time = FlowDTSTime.WhenFlowOver; } if (time == FlowDTSTime.SpecNodeSend) { string specNodes = this.HiddenField.Value.TrimEnd(','); if (string.IsNullOrEmpty(specNodes)) { PubClass.Alert("没有设置要同步的节点"); return; } else { flow.DTSSpecNodes = specNodes.TrimEnd(','); } } flow.DTSTime = time; flow.DTSWay = FlowDTSWay.Syn; #region 字段名相同 SFDBSrc s = new SFDBSrc("local"); if (field == DTSField.SameNames) { DataTable dt = s.GetColumns(flow.PTable); s = new SFDBSrc(this.DDL_DBSrc.SelectedValue); // this.src); DataTable ywDt = s.GetColumns(this.DDL_Table.SelectedValue); // this.ywTableName); string str = ""; string ywStr = ""; foreach (DataRow ywDr in ywDt.Rows) { foreach (DataRow dr in dt.Rows) { if (ywDr["No"].ToString().ToUpper() == dr["No"].ToString().ToUpper()) { if (dr["No"].ToString().ToUpper() == "OID") { flow.DTSBTablePK = "OID"; } str += dr["No"].ToString() + ","; ywStr += ywDr["No"].ToString() + ","; } } } if (!string.IsNullOrEmpty(str)) { flow.DTSFields = str.TrimEnd(',') + "@" + ywStr.TrimEnd(','); } else { PubClass.Alert("未检测到业务主表【" + flow.PTable + "】与表【" + this.DDL_Table.SelectedValue + "】有相同的字段名."); return;//不执行保存 } } else//按设置的字段匹配 检查在 { try { s = new SFDBSrc("local"); string str = flow.DTSFields; string[] arr = str.Split('@'); string sql = "SELECT " + arr[0] + " FROM " + flow.PTable; s.RunSQL(sql); s = new SFDBSrc(this.DDL_DBSrc.SelectedValue); sql = "SELECT " + arr[1] + ", " + flow.DTSBTablePK + " FROM " + flow.DTSBTable; s.RunSQL(sql); } catch { //PubClass.Alert(ex.Message); PubClass.Alert("设置的字段有误.【" + flow.DTSFields + "】"); return;//不执行保存 } } #endregion } #endregion flow.Update(); }