//草稿 protected void DraftBtn_Click(object sender, EventArgs e) { //M_UserInfo mu = buser.GetLogin(); DataTable dt = mfieldBll.GetModelFieldList(ModelID); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState); M_CommonData CData = new M_CommonData(); CData.NodeID = NodeID; if (!string.IsNullOrEmpty(ModelID.ToString())) { CData.ModelID = ModelID; CData.TableName = modelBll.GetModelById(ModelID).TableName; } CData.Title = txtTitle.Text.Trim(); CData.Status = -3; //CData.Inputer = mu.UserName; CData.InfoID = ""; CData.PdfLink = ""; CData.TagKey = Request.Form["tabinput"]; CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; CData.TitleStyle = Request.Form["ThreadStyle"]; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(NodeID, ref parentTree); CData.ParentTree = parentTree; int newID = contentBll.AddContent(table, CData); Response.Redirect("MyContent.aspx?NodeID=" + NodeID); }
protected void LinkButton_Command(object sender, CommandEventArgs e) { int Id = DataConverter.CLng(e.CommandArgument.ToString().Split('|')[0].Trim()); M_ModelField nowFieldinfo = this.bll.GetModelByID(ModelID.ToString(), Id); string col = e.CommandArgument.ToString().Split('|')[1].Trim(); switch (col) { case "Null": nowFieldinfo.IsNotNull = !nowFieldinfo.IsNotNull; break; case "Show": nowFieldinfo.ShowList = !nowFieldinfo.ShowList; //nowFieldinfo.IsShow = !nowFieldinfo.IsShow; break; case "Copy": nowFieldinfo.IsCopy ^= 1; break; case "BatchAdd": nowFieldinfo.Islotsize = !nowFieldinfo.Islotsize; break; } bll.Update(nowFieldinfo); }
/// <summary> /// 初始化方法 /// </summary> public void PageInit() { if (!string.IsNullOrEmpty(ModelID.Trim()) && !string.IsNullOrEmpty(TableName.Trim())) { SplitDataBind(); } }
public override int GetHashCode() { return(ModelID.GetHashCode() ^ SubscriptionKey.GetHashCode() ^ UriBase.GetHashCode() ^ ApiVersion.GetHashCode()); }
protected override void Execute(CodeActivityContext context) { var projectID = ProjectID.Get(context); var modelID = ModelID.Get(context); var locationID = LocationID.Get(context); var bearerToken = BearerToken.Get(context); var content = Content.Get(context); var jsonData = String.Format("{ \"payload\": { \"textSnippet\": { \"content\": \"{0}\", \"mime_type\": \"text/plain\" } } }", content); var jsonDataBytes = Encoding.ASCII.GetBytes(jsonData); request = HttpWebRequest.CreateHttp(String.Format("https://automl.googleapis.com/v1/projects/{0}/locations/{1}/models/{2}:predict", projectID, locationID, modelID)); request.Method = "POST"; request.ContentType = "application/json"; request.Headers.Add(HttpRequestHeader.Authorization, $"Bearer {bearerToken}"); using (var req_stream = request.GetRequestStream()) { req_stream.Write(jsonDataBytes, 0, jsonDataBytes.Length); req_stream.Close(); } var response = request.GetResponse(); }
/// <summary> /// 初始化方法 /// </summary> public void PageInit() { hdnUrlParm.Value = this.urlParam; if (!string.IsNullOrEmpty(ModelID.Trim()) && !string.IsNullOrEmpty(TableName.Trim())) { SplitDataBind(); } }
private void BindDropDownList() { ArrayList modelList = new ArrayList(); modelList.AddRange(this.modelService.FindAll()); ModelID.DataSource = modelList; ModelID.DataTextField = "Name"; ModelID.DataValueField = "ID"; ModelID.DataBind(); }
private PQio.Model.Event ParseObservationRecord(GSF.PQDIF.Logical.ObservationRecord record, AdoDataConnection connection) { Event evt = new Event(); evt.EventTime = record.StartTime; evt.Name = record.Name; evt.GUID = new Guid().ToString(); //Add Disturbance Category record in GSF GSF.Data.Model.TableOperations <Event> evtTable = new GSF.Data.Model.TableOperations <Event>(connection); evtTable.AddNewRecord(evt); evt.ID = ModelID.GetID <Event>(connection); return(evt); }
protected void Order_B_Click(object sender, EventArgs e) { string[] ordervalues = Order_Hid.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string value in ordervalues) { if (string.IsNullOrWhiteSpace(value.Split('|')[0])) { continue; } int fid = Convert.ToInt32(value.Split('|')[0]); int orderid = Convert.ToInt32(value.Split('|')[1]); M_ModelField modfield = bll.GetModelByID(ModelID.ToString(), fid); modfield.OrderID = orderid; bll.UpdateOrder(modfield); } function.WriteSuccessMsg("保存排序成功"); }
private void SearchModel_TextChanged(object sender, EventArgs e) { ModelID dataset = new ModelID(); ModelIDTableAdapters.MainStockTableAdapter mainstockTableAdapter = new ModelIDTableAdapters.MainStockTableAdapter(); DataTable dt = new DataTable(); mainstockTableAdapter.FillMainStockMaterialInfo(this.modelID.MainStock); dt = mainStockTableAdapter.GetDataMainStockMaterialInfo(); DataView dv = dt.DefaultView; dv.RowFilter = string.Format("MaterialName like '%{0}%'", SearchModel.Text); dataGridView1.DataSource = dv; dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.AutoResizeColumn(1); dataGridView1.Refresh(); }
private void BindModel() { VehicleModelManager modelManager = new VehicleModelManager(); DataTable dt = new DataTable(); dt.Columns.Add("ID", Type.GetType("System.String")); dt.Columns.Add("Name", Type.GetType("System.String")); DataTable platformTable = modelManager.GetAllModelInfo(); foreach (DataRow row in platformTable.Rows) { DataRow newRow = dt.NewRow(); newRow["ID"] = row["ID"].ToString(); newRow["Name"] = row["Name"]; dt.Rows.Add(newRow); } ModelID.DataSource = dt; ModelID.DataTextField = "Name"; ModelID.DataValueField = "ID"; ModelID.DataBind(); }
//草稿 protected void DraftBtn_Click(object sender, EventArgs e) { M_AdminInfo adminMod = B_Admin.GetLogin(); DataTable dt = fieldBll.SelByModelID(ModelID); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState); M_CommonData CData = new M_CommonData(); CData.NodeID = NodeID; if (!string.IsNullOrEmpty(ModelID.ToString())) { CData.ModelID = ModelID; CData.TableName = modelBll.GetModelById(ModelID).TableName; } CData.Title = txtTitle.Text.Trim(); CData.Status = (int)ZLEnum.ConStatus.Draft; CData.Inputer = adminMod.AdminName; CData.Inputer = string.IsNullOrEmpty(txtInputer.Text) ? adminMod.AdminName : txtInputer.Text; CData.EliteLevel = ChkAudit.Checked ? 1 : 0; CData.InfoID = ""; CData.PdfLink = ""; CData.Hits = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text); CData.CreateTime = DataConverter.CDate(txtAddTime.Text); CData.UpDateType = 2; CData.UpDateTime = DataConverter.CDate(txtdate.Text); CData.TagKey = Request.Form["tabinput"]; CData.Template = TxtTemplate_hid.Value; CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; CData.TitleStyle = Request.Form["ThreadStyle"]; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(NodeID, ref parentTree); CData.ParentTree = parentTree; int newID = contentBll.AddContent(table, CData); Response.Redirect("ContentShow.aspx?gid=" + newID + "&type=add"); }
//草稿 protected void DraftBtn_Click(object sender, EventArgs e) { DataTable dt = mfieldBll.GetModelFieldList(ModelID).Tables[0]; Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState); string adminname = HttpContext.Current.Request.Cookies["ManageState"]["LoginName"]; adminname = StringHelper.Base64StringDecode(adminname); M_CommonData CData = new M_CommonData(); CData.NodeID = NodeID; if (!string.IsNullOrEmpty(ModelID.ToString())) { CData.ModelID = ModelID; CData.TableName = modelBll.GetModelById(ModelID).TableName; } CData.Title = txtTitle.Text.Trim(); CData.Status = -3; CData.Inputer = adminname; CData.Inputer = string.IsNullOrEmpty(txtInputer.Text) ? adminname : txtInputer.Text; CData.EliteLevel = ChkAudit.Checked ? 1 : 0; CData.InfoID = ""; CData.PdfLink = ""; CData.Hits = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text); CData.CreateTime = DataConverter.CDate(txtAddTime.Text); CData.UpDateType = 2; CData.UpDateTime = DataConverter.CDate(txtdate.Text); CData.TagKey = Request.Form["tabinput"]; CData.Template = TxtTemplate_hid.Value; CData.IsBid = (Request.Form["IsBid"] == "1") ? 1 : 0; CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; CData.TitleStyle = Request.Form["ThreadStyle"]; CData.ParentTree = GetParentTree(NodeID);//父级别树 int newID = contentBll.AddContent(table, CData); Response.Redirect("ContentShow.aspx?gid=" + newID + "&nodename=" + Server.UrlEncode(nodename.Value) + "&type=add"); }
///-------------------------------------------------------------------------------- /// <summary>This method determines whether or not any metadata is /// different between the input instance and the current instance.</summary> /// /// <param name="inputEnumeration">The enumeration to compare metadata.</param> ///-------------------------------------------------------------------------------- public bool IsIdenticalMetadata(Enumeration inputEnumeration) { if (EnumerationName.GetString() != inputEnumeration.EnumerationName.GetString()) { return(false); } if (ModelID.GetGuid() != inputEnumeration.ModelID.GetGuid()) { return(false); } if (IsAutoUpdated.GetBool() != inputEnumeration.IsAutoUpdated.GetBool()) { return(false); } if (Description.GetString() != inputEnumeration.Description.GetString()) { return(false); } #region protected #endregion protected return(true); }
protected void rptModelField_ItemCommand(object sender, RepeaterCommandEventArgs e) { int Id = DataConverter.CLng(e.CommandArgument.ToString().Split('|')[0].Trim()); M_ModelField nowFieldinfo = this.bll.GetModelByID(ModelID.ToString(), Id); //if (e.CommandName == "UpMove")//上移 //{ // if (nowFieldinfo.OrderID <= this.bll.GetMinOrder(nowFieldinfo.ModelID)) // return; // M_ModelField topFieldPre = this.bll.GetPreField(nowFieldinfo.ModelID, nowFieldinfo.OrderID); // int nowID = nowFieldinfo.OrderID; // int preID = topFieldPre.OrderID; // nowFieldinfo.OrderID = preID; // topFieldPre.OrderID = nowID; // this.bll.UpdateOrder(nowFieldinfo, topFieldPre); // Response.Redirect(Request.RawUrl); //} //if (e.CommandName == "DownMove")//下移 //{ // if (nowFieldinfo.OrderID >= this.bll.GetMaxOrder(nowFieldinfo.ModelID)) // return; // M_ModelField fieldNext = this.bll.GetNextField(nowFieldinfo.ModelID, nowFieldinfo.OrderID); // int nowID = nowFieldinfo.OrderID; // int nextID = fieldNext.OrderID; // nowFieldinfo.OrderID = nextID; // fieldNext.OrderID = nowID; // this.bll.UpdateOrder(fieldNext, nowFieldinfo); // Response.Redirect(Request.RawUrl); //} if (e.CommandName == "IsPlay") { if (nowFieldinfo.ShowList == false) { nowFieldinfo.ShowList = true; } else { nowFieldinfo.ShowList = false; } this.bll.UpdateShowList(nowFieldinfo); (e.CommandSource as LinkButton).Text = nowFieldinfo.ShowList ? "不显示" : "显示"; } if (e.CommandName == "Delete") { bll.DelByFieldID(Id); } if (e.CommandName == "ChangeValue") { string col = e.CommandArgument.ToString().Split('|')[1].Trim(); switch (col) { case "Null": nowFieldinfo.IsNotNull = !nowFieldinfo.IsNotNull; break; case "Show": nowFieldinfo.ShowList = !nowFieldinfo.ShowList; (e.Item.FindControl("lbtnShow") as LinkButton).Text = nowFieldinfo.ShowList ? "不显示" : "显示"; break; case "Copy": nowFieldinfo.IsCopy ^= 1; break; case "BatchAdd": nowFieldinfo.Islotsize = !nowFieldinfo.Islotsize; break; } bll.Update(nowFieldinfo); } MyBind(); }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { string action = Request["action"]; string value = Request["value"].Trim(); string result = ""; switch (action) { case "duptitle": DataTable dt = contentBll.GetByDupTitle(value); result = Newtonsoft.Json.JsonConvert.SerializeObject(dt); break; } Response.Write(result); Response.Flush(); Response.End(); } DataSet ds = new DataSet(); if (ModelID > 0 && NodeID > 0) { ds = mfieldBll.GetProModelFieldS(ModelID.ToString()); bt_txt.Text = GetAlias("Title", ds.Tables[0]); gjz_txt.Text = GetAlias("Tagkey", ds.Tables[0]); Label4.Text = GetAlias("Subtitle", ds.Tables[0]); py.Text = GetAlias("PYtitle", ds.Tables[0]); if (spbll.GetSpecList().Rows.Count > 0) { SpecInfo_Li.Text = "<button type='button' class='btn btn-primary' onclick='ShowSpDiag()'>添加至专题</button>"; } else { SpecInfo_Li.Text = "<div style='margin:5px;' class='btn btn-default disabled'><span class='glyphicon glyphicon-info-sign'></span> 尚未定义专题</div>"; } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["Source"])) { function.Script(this, "SetContent();"); } nodeMod = nodeBll.GetNodeXML(NodeID); NodeDir = nodeMod.NodeDir; if (nodeMod.ListPageHtmlEx < 3) { CreateHTML.Visible = true; } else { CreateHTML.Visible = false; } nodeMod = nodeBll.GetNodeXML(NodeID); if (nodeMod.Contribute != 1) { function.Script(this, "ShowSys();"); } nodename.Value = nodeMod.NodeName; M_ModelInfo model = modelBll.GetModelById(ModelID); Label1.Text = "添加" + model.ItemName; EBtnSubmit.Text = "添加" + model.ItemName; Title_L.Text = "添加" + model.ItemName; ModelHtml.Text = mfieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.UserContent }); } } else { function.WriteErrMsg("参数错误!!"); } }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { string action = Request["action"]; string value = Request["value"].Trim(); string result = ""; switch (action) { case "duptitle": DataTable dt = contentBll.GetByDupTitle(value); result = Newtonsoft.Json.JsonConvert.SerializeObject(dt); break; } Response.Write(result); Response.Flush(); Response.End(); } DataSet ds = new DataSet(); if (ModelID > 0 && NodeID > 0) { ds = mfieldBll.GetProModelFieldS(ModelID.ToString()); bt_txt.Text = GetAlias("Title", ds.Tables[0]); hits_txt.Text = GetAlias("Hits", ds.Tables[0]); gjz_txt.Text = GetAlias("Tagkey", ds.Tables[0]); tj_txt.Text = GetAlias("EliteLevel", ds.Tables[0]); zht_txt.Text = GetAlias("Status", ds.Tables[0]); gx_time.Text = GetAlias("UpDateTime", ds.Tables[0]); Label4.Text = GetAlias("Subtitle", ds.Tables[0]); py.Text = GetAlias("PYtitle", ds.Tables[0]); if (spbll.GetSpecList().Rows.Count > 0) { SpecInfo_Li.Text = "<button type='button' class='btn btn-primary' onclick='ShowSpDiag()'>添加至专题</button>"; } else { SpecInfo_Li.Text = "<div style='margin:5px;' class='btn btn-default disabled'><span class='glyphicon glyphicon-info-sign'></span> 尚未定义专题</div>"; } if (!IsPostBack) { B_ARoleAuth.CheckEx(ZLEnum.Auth.content, "ContentMange"); if (!string.IsNullOrEmpty(Request.QueryString["Source"])) { function.Script(this, "SetContent();"); } //-----工作流,检测该节点是否绑定工作流,如无绑定,则直接通过,未绑定,则以第一步为准 contentsk.Visible = B_ARoleAuth.Check(ZLEnum.Auth.content, "ContentMange"); DataTable ddlDT = proBll.SelByNodeID2(NodeID); ddlFlow.DataSource = ddlDT; ddlFlow.DataTextField = "PName"; ddlFlow.DataValueField = "PPassCode"; ddlFlow.DataBind(); B_Admin AdminBll = new B_Admin(); M_AdminInfo adminMod = adminBll.GetAdminLogin(); ddlFlow.SelectedValue = adminMod.DefaultStart.ToString(); //if (ddlDT.TableName.Equals("Default")) //{ // ddlFlow.SelectedValue = "99"; //} //else //{ // ddlFlow.Items[0].Selected = true; //} //----- nodeMod = nodeBll.GetNodeXML(NodeID); NodeDir = nodeMod.NodeDir; if (nodeMod.ListPageHtmlEx < 3) { CreateHTML.Visible = true; } else { CreateHTML.Visible = false; } #region 节点权限 adminMod = adminBll.GetAdminLogin(); if (!("," + adminMod.RoleList + ",").Contains(",1,") && adminMod.NodeRole != 0) { DataTable dt = roleBll.SelectNodeRoleName(adminMod.NodeRole); if (dt.Rows.Count > 0) { IList <string[]> liss = new List <string[]>(); for (int i = 0; i < dt.Rows.Count; i++) { string[] nodeM = new string[2]; nodeM[0] = dt.Rows[i]["nodeid"].ToString(); nodeM[1] = dt.Rows[i]["Columns"].ToString(); liss.Add(nodeM); } string bb = nodeBll.stringTreeNodeRole(0, "", liss); if (checknode(bb, NodeID)) { if (!GetRole("addTo")) { function.WriteErrMsg("你无权限添加信息", "ContentManage.aspx?NodeID=" + NodeID.ToString()); } } else { function.WriteErrMsg("你无权限添加信息", "ContentManage.aspx?NodeID=" + NodeID.ToString()); } } } #endregion nodeMod = nodeBll.GetNodeXML(NodeID); //CheckNode(nodeMod); if (nodeMod.Contribute != 1) { function.Script(this, "ShowSys();"); } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ContentManage.aspx'>内容管理</a></li><li><a href='ContentManage.aspx?NodeID=" + nodeMod.NodeID + "'>" + nodeMod.NodeName + "</a></li><li class='active'>添加内容</li><div class='pull-right hidden-xs'><span><a href='" + customPath2 + "Content/SchedTask.aspx' title='查看计划任务'><span class='glyphicon glyphicon-time' style='color:#28b462;'></span></a>" + GetOpenView() + "<span onclick=\"ShowDiag('EditNode.aspx?NodeID=" + NodeID + "','配置本节点');\" class='glyphicon glyphicon-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></span></div>"); //Label2.Text = "<a href='ContentManage.aspx?Nodeid=" + nodeMod.NodeID + "'>" + nodeMod.NodeName + "</a>"; nodename.Value = nodeMod.NodeName; //txtNode.Text = nodeMod.NodeName; //hfNode.Value = NodeID + ","; M_ModelInfo model = modelBll.GetModelById(ModelID); Label1.Text = "添加" + model.ItemName; EBtnSubmit.Text = "添加" + model.ItemName; Title_L.Text = "添加" + model.ItemName; ModelHtml.Text = mfieldBll.GetInputallHtml(ModelID, NodeID); txtAddTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); txtdate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); BindTempList(); } } else { function.WriteErrMsg("参数错误!!"); } }
//保存项目 protected void EBtnSubmit_Click(object sender, EventArgs e) { string adminname = HttpContext.Current.Request.Cookies["ManageState"]["LoginName"]; adminname = StringHelper.Base64StringDecode(adminname); M_CommonData CData = contentBll.GetCommonData(GeneralID); NodeID = CData.NodeID; ModelID = CData.ModelID; CData.Title = txtTitle.Text; CData.NodeID = NodeID; int elite = ChkAudit.Checked ? 1 : 0; if (CData.EliteLevel == 0 && elite == 1)//推荐增加用户积分 { if (SiteConfig.UserConfig.InfoRule > 0) { M_UserInfo muser = buser.GetUserByName(adminname); if (!muser.IsNull) { buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis() { score = SiteConfig.UserConfig.InfoRule, detail = "修改内容:" + txtTitle.Text + "增加积分", ScoreType = (int)M_UserExpHis.SType.Point, Operator = muser.UserID, OperatorIP = Request.UserHostAddress }); } } } /*-----------可用智能判断模型与节点绑定-------------------*/ M_Node nodeinfo = bnode.GetNodeXML(NodeID); if (nodeinfo.ContentModel != "") { string ContentModel = "," + nodeinfo.ContentModel + ","; if (ContentModel.IndexOf("," + ModelID.ToString() + ",") == -1) { nodeinfo.ContentModel = nodeinfo.ContentModel + "," + ModelID.ToString(); bnode.UpdateNode(nodeinfo); } } else { nodeinfo.ContentModel = ModelID.ToString(); bnode.UpdateNode(nodeinfo); } /*---------------------------------------------*/ CData.EliteLevel = elite; CData.InfoID = ""; CData.Template = TxtTemplate_hid.Value; CData.Hits = DataConverter.CLng(txtNum.Text); CData.UpDateType = 2; CData.UpDateTime = DataConverter.CDate(txtdate.Text); CData.Hits = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text); if (!string.IsNullOrEmpty(txtAddTime.Text)) { CData.CreateTime = DataConverter.CDate(txtAddTime.Text); } if (!string.IsNullOrEmpty(txtInputer.Text)) { CData.Inputer = txtInputer.Text; } string OldKey = CData.TagKey; CData.TagKey = Request.Form["tabinput"]; CData.Status = Convert.ToInt32(string.IsNullOrEmpty(ddlFlow.SelectedValue) ? "-3" : ddlFlow.SelectedValue);//-3为草稿状态 CData.ProWeek = DataConverter.CLng(proweek.Text); CData.Pronum = DataConverter.CLng(pronum.Text); CData.BidType = DataConverter.CLng(BidType.SelectedValue); CData.BidMoney = DataConverter.CDouble(bidmoney.Text); CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; CData.FirstNodeID = GetFriestNode(NodeID); CData.TitleStyle = ThreadStyle.Value; CData.ParentTree = GetParentTree(NodeID); CData.TopImg = Request.Form["selectpic"];//首页图片 CData.SpecialID = Spec_Hid.Value; CData.RelatedIDS = RelatedIDS_Hid.Value; CData.IsComm = Convert.ToInt32(IsComm_Radio.SelectedValue); DataTable dt = bfield.GetModelFieldAllList(ModelID).Tables[0]; Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState, content); contentBll.UpdateContent(table, CData); //推送 if (!string.IsNullOrEmpty(pushcon_hid.Value)) { string[] nodeArr = pushcon_hid.Value.Trim(',').Split(','); for (int i = 0; i < nodeArr.Length; i++) { CData.NodeID = Convert.ToInt32(nodeArr[i]); contentBll.AddContent(table, CData); } } #region 关键词 B_KeyWord kll = new B_KeyWord(); //if (!string.IsNullOrEmpty(Keyword)) //{ // if (string.IsNullOrEmpty(OldKey)) // { // string[] arrKey = Keyword.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // for (int tt = 0; tt < arrKey.Length; tt++) // { // if (kll.IsExist(arrKey[tt])) // { // M_KeyWord kinfo = kll.GetKeyByName(arrKey[tt]); // kinfo.QuoteTimes++; // kinfo.LastUseTime = DateTime.Now; // if (string.IsNullOrEmpty(kinfo.ArrGeneralID)) // kinfo.ArrGeneralID = CData.GeneralID.ToString() + ","; // else // kinfo.ArrGeneralID = kinfo.ArrGeneralID + CData.GeneralID.ToString() + ","; // kll.Update(kinfo); // } // else // { // M_KeyWord kinfo1 = new M_KeyWord(); // kinfo1.KeyWordID = 0; // kinfo1.KeywordText = arrKey[tt]; // kinfo1.KeywordType = 1; // kinfo1.LastUseTime = DateTime.Now; // kinfo1.Hits = 0; // kinfo1.Priority = 10; // kinfo1.QuoteTimes = 1; // kinfo1.ArrGeneralID = "," + CData.GeneralID.ToString() + ","; // kll.Add(kinfo1); // } // } // } // else // { // string[] arrKey1 = Keyword.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // string[] arrOld = OldKey.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // for (int it = 0; it < arrKey1.Length; it++) // { // if (!FindInArr(arrOld, arrKey1[it])) // { // if (kll.IsExist(arrKey1[it])) // { // M_KeyWord kinfo = kll.GetKeyByName(arrKey1[it]); // kinfo.QuoteTimes++; // kinfo.LastUseTime = DateTime.Now; // if (string.IsNullOrEmpty(kinfo.ArrGeneralID)) // kinfo.ArrGeneralID = CData.GeneralID.ToString() + ","; // else // kinfo.ArrGeneralID = kinfo.ArrGeneralID + CData.GeneralID.ToString() + ","; // kll.Update(kinfo); // } // else // { // M_KeyWord kinfo1 = new M_KeyWord(); // kinfo1.KeyWordID = 0; // kinfo1.KeywordText = arrKey1[it]; // kinfo1.KeywordType = 1; // kinfo1.LastUseTime = DateTime.Now; // kinfo1.Hits = 0; // kinfo1.Priority = 10; // kinfo1.QuoteTimes = 1; // kinfo1.ArrGeneralID = "," + CData.GeneralID.ToString() + ","; // kll.Add(kinfo1); // } // } // } // } //} #endregion ZLLog.ToDB(ZLEnum.Log.content, new M_Log() { UName = adminname, Source = Request.RawUrl, Action = "修改内容", Message = "标题:" + CData.Title + ",Gid:" + CData.GeneralID, Level = "edit" }); //修改计划任务(审核时间) if (!CheckDate_Hid.Value.Equals(CheckDate_T.Text)) { UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.AuditArt, CheckDate_T.Text); } //修改计划任务(过期时间) if (!TimeDate_Hid.Value.Equals(TimeDate_T.Text)) { UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.UnAuditArt, TimeDate_T.Text); } if (!string.IsNullOrEmpty(Request.Form["HdnSpec"])) //专题 { string SpecID = Request.Form["HdnSpec"]; // HdnSpec.Value; if (SpecID.EndsWith(",")) { SpecID = SpecID.Substring(0, SpecID.LastIndexOf(",")); } } //修改多节点 string nodeid = (Request.Form["hfNode"] ?? "").TrimEnd(','); if (!string.IsNullOrEmpty(nodeid)) { string[] narr = nodeid.Split(','); bmn.DelByIDS(nodeid); M_MultiNode mmu = new M_MultiNode(); for (int i = 0; i < narr.Length; i++) { if (!string.IsNullOrEmpty(narr[i])) { mmu.N_NodeID = DataConverter.CLng(narr[i]); mmu.N_ItemID = GeneralID; bmn.GetInsert(mmu); } } } string iscreate = "0"; M_Node nodeMod = bnode.GetNodeXML(NodeID); CreateHtmlDel createHtml = CreateHtmlFunc; createHtml.BeginInvoke(HttpContext.Current.Request, createnew, CData, table, null, null); if (nodeMod.ListPageHtmlEx < 3 && quickmake.Checked == true) { iscreate = "1"; } Response.Redirect("ContentShow.aspx?gid=" + GeneralID + "&iscreate=" + iscreate + "&nodename=" + Server.UrlEncode(nodename.Value) + "&type=edit"); }
private void Parse(string filename) { List <ObservationRecord> observationRecords; List <DataSourceRecord> dataSourceRecords; using (LogicalParser logicalParser = new LogicalParser(filename)) { observationRecords = new List <ObservationRecord>(); logicalParser.Open(); while (logicalParser.HasNextObservationRecord()) { observationRecords.Add(logicalParser.NextObservationRecord()); } dataSourceRecords = logicalParser.DataSourceRecords; } this.m_previousProgress = this.m_previousProgress + 50; this.mProgress.Report(this.m_previousProgress); if (observationRecords.Count == 0) { return; } if (dataSourceRecords.Count != 1) { return; } //create Meter Definition //For now assume a single meter Meter meter = new Meter(); meter.DeviceName = dataSourceRecords[0].DataSourceName; meter.Owner = dataSourceRecords[0].DataSourceOwner; meter.DeviceAlias = GSF.PQDIF.Logical.Equipment.ToString(dataSourceRecords[0].EquipmentID); meter.DeviceLocation = dataSourceRecords[0].DataSourceLocation; if (dataSourceRecords[0].Latitude < uint.MaxValue) { meter.Latitude = dataSourceRecords[0].Latitude; } if (dataSourceRecords[0].Longitude < uint.MaxValue) { meter.Longitude = dataSourceRecords[0].Longitude; } meter.AccountName = GSF.PQDIF.Logical.Vendor.ToString(dataSourceRecords[0].VendorID); using (TransactionScope scope = new TransactionScope()) { AdoDataConnection connection = new AdoDataConnection(connectionstring, dataprovider); GSF.Data.Model.TableOperations <Meter> meterTable = new GSF.Data.Model.TableOperations <Meter>(connection); meterTable.AddNewRecord(meter); meter.ID = ModelID.GetID <Meter>(connection); //create Channel Definitions List <PQio.Model.Channel> channels = dataSourceRecords[0].ChannelDefinitions.Select(channel => ParseChannel(meter, channel, connection)).ToList(); List <PQio.Model.Event> events = new List <Event>(); //create Event Definitions foreach (ObservationRecord record in observationRecords) { //Create Event Event evt = ParseObservationRecord(record, connection); //create DataSeries objects foreach (ChannelInstance channelInstance in record.ChannelInstances) { ParseSeries(channelInstance, channels[(int)channelInstance.ChannelDefinitionIndex], evt, connection); } events.Add(evt); } // Remove Channels whithout data channels = channels.FindAll(item => RemoveEmptyChannel(item, connection)).ToList(); events = events.FindAll(item => RemoveEmptyEvents(item, connection)).ToList(); // Remove Channels whithout data channels = channels.FindAll(item => RemoveEmptyChannel(item, connection)).ToList(); // If only one set of data it's easy to keep only single line int nVa = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.VoltageA); int nVb = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.VoltageB); int nVc = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.VoltageC); int nIa = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.CurrentA); int nIb = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.CurrentB); int nIc = channels.Count(channel => channel.MeasurementType.ToLower() == MeasurementType.CurrentC); if (nVa == 1 && nVb == 1 && nVc == 1) { //Create new asset Asset asset = new Asset() { AssetKey = String.Format("Asset 1 ({0})", meter.AccountName) }; GSF.Data.Model.TableOperations <Asset> assetTable = new GSF.Data.Model.TableOperations <Asset>(connection); assetTable.AddNewRecord(asset); asset.ID = ModelID.GetID <Asset>(connection); GSF.Data.Model.TableOperations <Channel> channelTable = new GSF.Data.Model.TableOperations <Channel>(connection); Channel Va = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.VoltageA); Channel Vb = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.VoltageB); Channel Vc = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.VoltageC); Va.AssetID = asset.ID; Vb.AssetID = asset.ID; Vc.AssetID = asset.ID; channelTable.UpdateRecord(Va); channelTable.UpdateRecord(Vb); channelTable.UpdateRecord(Vc); if (nIa == 1 && nIb == 1 && nIc == 1) { Channel Ia = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.CurrentA); Channel Ib = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.CurrentB); Channel Ic = channels.Find(item => item.MeasurementType.ToLower() == MeasurementType.CurrentC); Ia.AssetID = asset.ID; Ib.AssetID = asset.ID; Ic.AssetID = asset.ID; channelTable.UpdateRecord(Ia); channelTable.UpdateRecord(Ib); channelTable.UpdateRecord(Ic); } } scope.Complete(); } this.m_previousProgress = this.m_previousProgress + 50; this.mProgress.Report(this.m_previousProgress); }
private Channel ParseChannel(Meter meter, GSF.PQDIF.Logical.ChannelDefinition channeldef, AdoDataConnection connection) { Channel channel = new Channel(); channel.MeterID = meter.ID; channel.Name = channeldef.ChannelName; GSF.PQDIF.Logical.QuantityMeasured quantity = channeldef.QuantityMeasured; Guid quantityType = channeldef.QuantityTypeID; GSF.PQDIF.Logical.Phase phase = channeldef.Phase; if (isRMS(quantityType)) { channel.SignalType = SignalType.RMS; } else if (isPOW(quantityType)) { channel.SignalType = SignalType.PointOnWave; } else { channel.SignalType = SignalType.other; } Boolean isV = quantity == QuantityMeasured.Voltage; Boolean isI = quantity == QuantityMeasured.Current; Boolean isA = (phase == Phase.AN) || (phase == Phase.AB); Boolean isB = (phase == Phase.BN) || (phase == Phase.BC); Boolean isC = (phase == Phase.CN) || (phase == Phase.CA); Boolean isN = phase == Phase.Residual; string measurementname = MeasurementType.other; if (isV && isA) { measurementname = MeasurementType.VoltageA; } else if (isV && isB) { measurementname = MeasurementType.VoltageB; } else if (isV && isC) { measurementname = MeasurementType.VoltageC; } else if (isI && isA) { measurementname = MeasurementType.CurrentA; } else if (isI && isB) { measurementname = MeasurementType.CurrentB; } else if (isI && isC) { measurementname = MeasurementType.CurrentC; } else if (isV && isN) { measurementname = MeasurementType.other; } else if (isI && isN) { measurementname = MeasurementType.other; } GSF.Data.Model.TableOperations <Channel> channelTable = new GSF.Data.Model.TableOperations <Channel>(connection); channel.MeasurementType = measurementname; channelTable.AddNewRecord(channel); channel.ID = ModelID.GetID <Channel>(connection); return(channel); }
//保存项目 protected void EBtnSubmit_Click(object sender, EventArgs e) { B_Admin.CheckIsLogged(); M_AdminInfo adminMod = badmin.GetAdminLogin(); M_CommonData CData = contentBll.GetCommonData(GeneralID); NodeID = CData.NodeID; ModelID = CData.ModelID; CData.Title = txtTitle.Text; CData.NodeID = NodeID; int elite = ChkAudit.Checked ? 1 : 0; if (CData.EliteLevel == 0 && elite == 1)//推荐增加用户积分 { if (SiteConfig.UserConfig.InfoRule > 0) { M_UserInfo muser = buser.GetUserByName(adminMod.AdminName); if (!muser.IsNull) { buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis() { score = SiteConfig.UserConfig.InfoRule, detail = "修改内容:" + txtTitle.Text + "增加积分", ScoreType = (int)M_UserExpHis.SType.Point, Operator = muser.UserID, OperatorIP = Request.UserHostAddress }); } } } /*-----------可用智能判断模型与节点绑定-------------------*/ M_Node nodeinfo = bnode.GetNodeXML(NodeID); if (nodeinfo.ContentModel != "") { string ContentModel = "," + nodeinfo.ContentModel + ","; if (ContentModel.IndexOf("," + ModelID.ToString() + ",") == -1) { nodeinfo.ContentModel = nodeinfo.ContentModel + "," + ModelID.ToString(); bnode.UpdateNode(nodeinfo); } } else { nodeinfo.ContentModel = ModelID.ToString(); bnode.UpdateNode(nodeinfo); } /*---------------------------------------------*/ CData.EliteLevel = elite; CData.InfoID = ""; CData.Template = TxtTemplate_hid.Value; CData.Hits = DataConverter.CLng(txtNum.Text); CData.UpDateType = 2; CData.UpDateTime = DataConverter.CDate(txtdate.Text); CData.Hits = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text); if (!string.IsNullOrEmpty(txtAddTime.Text)) { CData.CreateTime = DataConverter.CDate(txtAddTime.Text); } if (!string.IsNullOrEmpty(txtInputer.Text)) { CData.Inputer = txtInputer.Text; } string OldKey = CData.TagKey; CData.TagKey = Request.Form["tabinput"]; CData.Status = Convert.ToInt32(string.IsNullOrEmpty(ddlFlow.SelectedValue) ? "-3" : ddlFlow.SelectedValue);//-3为草稿状态 CData.ProWeek = DataConverter.CLng(proweek.Text); CData.Pronum = DataConverter.CLng(pronum.Text); CData.BidType = DataConverter.CLng(BidType.SelectedValue); CData.BidMoney = DataConverter.CDouble(bidmoney.Text); CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; string tree = ""; CData.FirstNodeID = bnode.SelFirstNodeID(NodeID, ref tree); CData.TitleStyle = ThreadStyle.Value; CData.ParentTree = tree; CData.TopImg = Request.Form["selectpic"];//首页图片 CData.SpecialID = Spec_Hid.Value; CData.RelatedIDS = RelatedIDS_Hid.Value; CData.IsComm = Convert.ToInt32(IsComm_Radio.SelectedValue); DataTable dt = fieldBll.SelByModelID(ModelID); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState, content); contentBll.UpdateContent(table, CData); //推送 if (!string.IsNullOrEmpty(pushcon_hid.Value)) { string[] nodeArr = pushcon_hid.Value.Trim(',').Split(','); for (int i = 0; i < nodeArr.Length; i++) { CData.NodeID = Convert.ToInt32(nodeArr[i]); contentBll.AddContent(table, CData); } } #region 关键词 { keys = StrHelper.RemoveRepeat(CData.TagKey.Split(','), IgnoreKey_Hid.Value.Split(',')); if (!string.IsNullOrEmpty(keys)) { keyBll.AddKeyWord(keys, 1); } } #endregion ZLLog.ToDB(ZLEnum.Log.content, new M_Log() { UName = adminMod.AdminName, Source = Request.RawUrl, Action = "修改内容", Message = "标题:" + CData.Title + ",Gid:" + CData.GeneralID, Level = "edit" }); //修改计划任务(审核时间) if (!CheckDate_Hid.Value.Equals(CheckDate_T.Text)) { UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.AuditArt, CheckDate_T.Text); } //修改计划任务(过期时间) if (!TimeDate_Hid.Value.Equals(TimeDate_T.Text)) { UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.UnAuditArt, TimeDate_T.Text); } if (!string.IsNullOrEmpty(Request.Form["HdnSpec"])) //专题 { string SpecID = Request.Form["HdnSpec"]; // HdnSpec.Value; if (SpecID.EndsWith(",")) { SpecID = SpecID.Substring(0, SpecID.LastIndexOf(",")); } } CreateHtmlDel createHtml = CreateHtmlFunc; createHtml.BeginInvoke(HttpContext.Current.Request, createnew, CData, table, null, null); //if (nodeMod.ListPageHtmlEx < 3 && quickmake.Checked == true) // iscreate = "1"; Response.Redirect("ContentShow.aspx?gid=" + GeneralID + "&type=edit"); }
/// <summary> /// Given a <see cref="ModelID"/>, determines if it has a graphical representation. /// </summary> /// <param name="inModelID">The <see cref="ModelID"/> for the <see cref="Model"/> whose graphics status sought.</param> /// <returns><c>true</c> if the model supports graphics, otherwise <c>false</c>.</returns> internal static bool IDHasGraphics(ModelID inModelID) => GraphicalAssetPaths.ContainsKey(All.GetIDRangeForType(inModelID));
// 设定模板 protected void SetTemplate(object sender, EventArgs e) { modBll.UpdateTemplate(this.TxtTemplate_hid.Value, ModelID); function.WriteSuccessMsg("设定模板成功", "ModelField.aspx?ModelID=" + ModelID.ToString() + "&ModelType=" + ModelType); }
/// <summary> /// Given a <see cref="ModelID"/> for a model that has a graphical representation, returns the path to that representation's assets. /// </summary> /// <param name="inModelID">The <see cref="ModelID"/> for the <see cref="Model"/> whose graphical asset is sought.</param> /// <returns>The path to that asset, if any.</returns> internal static string GetGraphicsPathForModelID(ModelID inModelID) => GraphicalAssetPaths.ContainsKey(All.GetIDRangeForType(inModelID)) ? Path.Combine(All.ProjectDirectory, GraphicalAssetPaths[All.GetIDRangeForType(inModelID)]) : Path.Combine(All.ProjectDirectory, GraphicsFolderName);
private void FillModel(ref DataTable table, M_CommonData CData) { M_AdminInfo adminMod = badmin.GetAdminLogin(); //CData = contentBll.GetCommonData(GeneralID); NodeID = CData.NodeID; ModelID = CData.ModelID; DataTable dt = fieldBll.SelByModelID(CData.ModelID); Call commonCall = new Call(); table = commonCall.GetDTFromPage(dt, Page, ViewState, content); CData.Title = txtTitle.Text; /*-----------可用智能判断模型与节点绑定-------------------*/ M_Node nodeinfo = bnode.GetNodeXML(CData.NodeID); if (nodeinfo.ContentModel != "") { string ContentModel = "," + nodeinfo.ContentModel + ","; if (ContentModel.IndexOf("," + ModelID.ToString() + ",") == -1) { nodeinfo.ContentModel = nodeinfo.ContentModel + "," + ModelID.ToString(); bnode.UpdateNode(nodeinfo); } } else { nodeinfo.ContentModel = ModelID.ToString(); bnode.UpdateNode(nodeinfo); } /*---------------------------------------------*/ CData.EliteLevel = ChkAudit.Checked ? 1 : 0; CData.InfoID = ""; CData.Template = TxtTemplate_hid.Value; CData.Hits = DataConverter.CLng(txtNum.Text); CData.UpDateType = 2; CData.UpDateTime = DataConverter.CDate(txtdate.Text); CData.Hits = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text); if (!string.IsNullOrEmpty(txtAddTime.Text)) { CData.CreateTime = DataConverter.CDate(txtAddTime.Text); } if (!string.IsNullOrEmpty(txtInputer.Text)) { CData.Inputer = txtInputer.Text; } string OldKey = CData.TagKey; CData.TagKey = Request.Form["tabinput"]; CData.Status = Convert.ToInt32(string.IsNullOrEmpty(ddlFlow.SelectedValue) ? "-3" : ddlFlow.SelectedValue);//-3为草稿状态 CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; string tree = ""; CData.FirstNodeID = bnode.SelFirstNodeID(CData.NodeID, ref tree); CData.TitleStyle = ThreadStyle.Value; CData.ParentTree = tree; CData.TopImg = ThumImg_Hid.Value;//首页图片 CData.SpecialID = Spec_Hid.Value; CData.RelatedIDS = RelatedIDS_Hid.Value; CData.IsComm = Convert.ToInt32(IsComm_Radio.SelectedValue); // 关键词 { if (string.IsNullOrEmpty(CData.TagKey)) { keys = ""; } else { keys = StrHelper.RemoveRepeat(CData.TagKey.Split(','), IgnoreKey_Hid.Value.Split(',')); } if (!string.IsNullOrEmpty(keys)) { keyBll.AddKeyWord(keys, 1); } } ////修改计划任务(审核时间) //if (!CheckDate_Hid.Value.Equals(CheckDate_T.Text)) // UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.AuditArt, CheckDate_T.Text); ////修改计划任务(过期时间) //if (!TimeDate_Hid.Value.Equals(TimeDate_T.Text)) // UpdateSched(GeneralID, M_Content_ScheTask.TaskTypeEnum.UnAuditArt, TimeDate_T.Text); }