예제 #1
0
        protected void btnXLineSave_Click(object sender, EventArgs e)
        {
            if (CurveID == "")
            {
                MessageBox.popupClientMessage(this.Page, "请选择具体曲线!", "call();");

                return;
            }

            int    xlinetype   = int.Parse(ddl_CurveType.SelectedValue);
            int    xlinegetype = int.Parse(ddl_CurveGetType.SelectedValue);
            double dout        = 0;
            string xlinexyz    = "";

            if (xlinetype == 0)
            {
                if (!double.TryParse(tbxXLineXYZ.Text, out dout))
                {
                    MessageBox.popupClientMessage(this.Page, "定值格式不正确!无法保存!", "call();");
                    return;
                }
            }
            else if (xlinetype == 1)
            {
                if (dtXLine.Rows.Count < 2)
                {
                    MessageBox.popupClientMessage(this.Page, "区间定义不完整!无法保存!", "call();");
                    return;
                }
            }
            else if (xlinetype == 2)
            {
                if (dtXLine.Rows.Count < 2 && dtXLine.Columns.Count < 2)
                {
                    MessageBox.popupClientMessage(this.Page, "区间定义不完整!无法保存!", "call();");
                    return;
                }
            }

            CurveTagEntity mEntity = CurveTagDal.GetEntity(CurveID);

            mEntity.CurveType     = xlinetype;
            mEntity.CurveGetType  = xlinegetype;
            mEntity.CurveXRealTag = ddl_CurveXRealTag.SelectedValue != "NULLDATA" ? ddl_CurveXRealTag.SelectedValue : "";
            mEntity.CurveYRealTag = ddl_CurveYRealTag.SelectedValue != "NULLDATA" ? ddl_CurveYRealTag.SelectedValue : "";
            mEntity.CurveZRealTag = "";

            xlinexyz = ECTagDal.SetXLineXYZ(xlinetype, dtXLine, dout);

            mEntity.CurveXYZ = xlinexyz;

            CurveTagDal.Update(mEntity);
        }
예제 #2
0
        protected void btnAddCurve_Click(object sender, EventArgs e)
        {
            int index = CurveTagDal.CurveIDCounts();

            string sID = PageControl.GetGuid();

            CurveTagEntity ote = new CurveTagEntity();

            ote.CurveID       = sID;
            ote.CurveCode     = "InputCode";
            ote.CurveName     = "InputName";
            ote.CurveDesc     = "";
            ote.CurveGroup    = "InputGroup";
            ote.CurveMonth    = "1,2,3,4,5,6,7,8,9,10,11,12,";
            ote.CurveIsValid  = 0;
            ote.CurveIndex    = 100;
            ote.CurveType     = 0;
            ote.CurveGetType  = 0;
            ote.CurveXRealTag = "";
            ote.CurveYRealTag = "";
            ote.CurveZRealTag = "";
            ote.CurveXYZ      = "";
            ote.CurveNote     = "";

            ote.CurveCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            ote.CurveModifyTime = ote.CurveCreateTime;

            if (CurveTagDal.Insert(ote))
            {
                //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();");

                gvCurve.EditIndex = index;

                BindValues();
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "添加错误!", "call();");
            }
        }
예제 #3
0
        void BindXLine(bool binit)
        {
            if (CurveID == "")
            {
                return;
            }

            int    xlinetype    = int.Parse(ddl_CurveType.SelectedValue);
            int    xlinegettype = int.Parse(ddl_CurveGetType.SelectedValue);
            double dout         = 0;

            //bool bResult = true;

            if (binit)
            {
                mEntity = CurveTagDal.GetEntity(CurveID);

                lblInfor.Text = "当前曲线为: " + mEntity.CurveCode + mEntity.CurveName;

                xlinetype    = mEntity.CurveType;
                xlinegettype = mEntity.CurveGetType;
                dtXLine      = new DataTable();

                ddl_CurveType.SelectedValue    = xlinetype.ToString();
                ddl_CurveGetType.SelectedValue = xlinegettype.ToString();

                ECTagDal.GetXLineXYZ(xlinetype, mEntity.CurveXYZ, out dtXLine, out dout);
            }

            //if (binit)
            //{

            //}

            if (xlinetype == 0)
            {
                lblGetType.Visible       = false;
                ddl_CurveGetType.Visible = false;

                spanX.Visible   = false;
                spanXX.Visible  = false;
                spanY.Visible   = false;
                spanYY.Visible  = false;
                btnAddX.Visible = false;
                btnAddY.Visible = false;

                //
                tbxXLineXYZ.Visible = true;
                tbxXLineXYZ.Text    = dout.ToString("0.000");

                gvXLine.Visible = false;

                gvXLine.DataSource = null;
                gvXLine.DataBind();
            }
            else if (xlinetype == 1)
            {
                lblGetType.Visible       = true;
                ddl_CurveGetType.Visible = true;

                spanX.Visible   = true;
                spanXX.Visible  = true;
                spanY.Visible   = false;
                spanYY.Visible  = false;
                btnAddX.Visible = true;
                btnAddY.Visible = true;

                ddl_CurveXRealTag.SelectedValue = mEntity.CurveXRealTag != "" ? mEntity.CurveXRealTag : "NULLDATA";
                //ddl_CurveYRealTag.SelectedValue = mEntity.CurveYRealTag != "" ? mEntity.CurveYRealTag : "NULLDATA";

                tbxXLineXYZ.Visible = false;
                //tbxXLineXYZ.Text = dout.ToString("0.000");

                gvXLine.Visible = true;

                gvXLine.DataSource = dtXLine;
                gvXLine.DataBind();
            }
            else if (xlinetype == 2)
            {
                lblGetType.Visible       = true;
                ddl_CurveGetType.Visible = true;

                spanX.Visible   = true;
                spanXX.Visible  = true;
                spanY.Visible   = true;
                spanYY.Visible  = true;
                btnAddX.Visible = true;
                btnAddY.Visible = true;

                ddl_CurveXRealTag.SelectedValue = mEntity.CurveXRealTag != "" ? mEntity.CurveXRealTag : "NULLDATA";
                ddl_CurveYRealTag.SelectedValue = mEntity.CurveYRealTag != "" ? mEntity.CurveYRealTag : "NULLDATA";

                tbxXLineXYZ.Visible = false;
                //tbxXLineXYZ.Text = dout.ToString("0.000");

                gvXLine.Visible = true;

                gvXLine.DataSource = dtXLine;
                gvXLine.DataBind();
            }
        }
예제 #4
0
        protected void gvCurve_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            HtmlInputHidden key = (HtmlInputHidden)gvCurve.Rows[e.RowIndex].Cells[0].FindControl("curveid");

            string sID    = key.Value;
            string sCode  = ((TextBox)(gvCurve.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
            string sName  = ((TextBox)(gvCurve.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string sDesc  = ((TextBox)(gvCurve.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
            string sGroup = ((TextBox)(gvCurve.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
            string sMonth = ((TextBox)(gvCurve.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
            string sValid = ((DropDownList)(gvCurve.Rows[e.RowIndex].Cells[6].FindControl("ddlValid"))).SelectedValue;

            string msg = "";

            if (sCode == "")
            {
                msg += "代码不能为空!\r\n";
            }

            if (sName == "")
            {
                msg += "名称不能为空!\r\n";
            }

            if (msg != "")
            {
                MessageBox.popupClientMessage(this.Page, msg);
                return;
            }

            //代码是否重复
            if (CurveTagDal.CodeExist(sCode, sID) || ALLDal.CodeExist(sCode, sID))
            {
                MessageBox.popupClientMessage(this.Page, "已存在相同的代码!");
                return;
            }

            //更新
            CurveTagEntity ote = new CurveTagEntity();

            ote.CurveID      = sID;
            ote.CurveCode    = sCode;
            ote.CurveName    = sName;
            ote.CurveDesc    = sDesc;
            ote.CurveGroup   = sGroup;
            ote.CurveMonth   = sMonth;
            ote.CurveIndex   = 100;
            ote.CurveIsValid = int.Parse(sValid);

            ote.CurveModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            if (CurveTagDal.Update(ote))
            {
                MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();");
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();");
            }

            gvCurve.EditIndex = -1;

            BindValues();
        }