Exemplo n.º 1
0
 private void bt4_Click(object sender, EventArgs e)
 {
     try
     {
         frmChangeInput frm = new frmChangeInput();
         frm.InitData(typelist);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             for (int j = 0; j < frm.list2.Count; j++)
             {
                 glebeType g = frm.list2[j];
                 foreach (DataRow row in sondt.Rows)
                 {
                     if (row["TypeUID"].ToString() == g.TypeName)
                     {
                         row["Burthen"] = Convert.ToDouble(row["Area"]) * Convert.ToDouble(g.TypeStyle) * Convert.ToDouble(g.ObligateField2) * Convert.ToDouble(g.ObligateField3);
                     }
                 }
             }
             ReLoadViewData(gPro, str220, str110, str66);
         }
     }
     catch (Exception e1) {
         string err = e1.Message;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            glebeType obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            //glebeType objCopy = new glebeType();
            //DataConverter.CopyTo<glebeType>(obj, objCopy);

            //执行修改操作
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.Object = obj;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //用副本更新焦点对象
            //DataConverter.CopyTo<glebeType>(objCopy, obj);
            //刷新表格
            Services.BaseService.Update <glebeType>(obj);
            gridControl.RefreshDataSource();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            glebeType obj = new glebeType();

            //执行添加操作
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除焦点对象
        /// </summary>
        public void DeleteObject()
        {
            //获取焦点对象
            glebeType obj = FocusedObject;

            if (obj == null)
            {
                return;
            }
            if (obj.UID == "6ab9af7b-3d97-4e6c-8ed7-87b76950b90b")
            {
                MessageBox.Show("最低负荷密度不能删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //请求确认
            if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes)
            {
                return;
            }

            //执行删除操作
            try
            {
                Services.BaseService.Delete <glebeType>(obj);
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return;
            }

            this.gridView.BeginUpdate();
            //记住当前焦点行索引
            int iOldHandle = this.gridView.FocusedRowHandle;

            //从链表中删除
            ObjectList.Remove(obj);
            //刷新表格
            gridControl.RefreshDataSource();
            //设置新的焦点行索引
            GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle);
            this.gridView.EndUpdate();
        }
Exemplo n.º 5
0
        public void InitData(glebeProperty gp, string _sub220, string _sub110, string _sub66)
        {
            try
            {
                str220 = _sub220;
                str110 = _sub110;
                str66  = _sub66;

                gPro.EleID  = gp.EleID;
                gPro.SvgUID = gp.SvgUID;
                layerID     = gp.LayerID;

                IList svglist = Services.BaseService.GetList("SelectglebePropertyByEleID", gPro);
                if (svglist.Count > 0)
                {
                    gPro = (glebeProperty)svglist[0];

                    IsCreate = false;
                    if (gPro.SonUid == "")
                    {
                        gPro.SonUid = "2";
                    }
                }
                else
                {
                    IsCreate     = true;
                    gPro.LayerID = layerID;
                }
                glebeType g = new glebeType();
                g.UID = "6ab9af7b-3d97-4e6c-8ed7-87b76950b90b";
                g     = (glebeType)Services.BaseService.GetObject("SelectglebeTypeByKey", g);
                if (gPro.ObligateField10 == "")
                {
                    gPro.ObligateField10 = "0";
                }
                gPro.ObligateField10 = gPro.ObligateField10.Replace("-", "");
                if (gPro.ObligateField10 != "0")
                {
                    nullvalue = Convert.ToDecimal(gPro.ObligateField10) * Convert.ToDecimal(g.TypeStyle);
                }
                bh.DataBindings.Add("Text", gPro, "UseID");
                lx.DataBindings.Add("EditValue", gPro, "TypeUID");

                mj.DataBindings.Add("Text", gPro, "Area");

                fh.DataBindings.Add("Text", gPro, "Burthen");
                dl.DataBindings.Add("Text", gPro, "Number");
                rzb.DataBindings.Add("Text", gPro, "SonUid");
                remark.DataBindings.Add("Text", gPro, "Remark");

                yk1.DataBindings.Add("Text", gPro, "ObligateField2");
                jc1.DataBindings.Add("Text", gPro, "ObligateField3");
                nl1.DataBindings.Add("Text", gPro, "ObligateField4");
                yk2.DataBindings.Add("Text", gPro, "ObligateField5");
                jc2.DataBindings.Add("Text", gPro, "ObligateField6");
                nl2.DataBindings.Add("Text", gPro, "ObligateField7");
                ph1.DataBindings.Add("Text", gPro, "ObligateField8");
                ph2.DataBindings.Add("Text", gPro, "ObligateField9");

                yk3.DataBindings.Add("Text", gPro, "ObligateField12");
                jc3.DataBindings.Add("Text", gPro, "ObligateField13");
                nl3.DataBindings.Add("Text", gPro, "ObligateField14");
                ph3.DataBindings.Add("Text", gPro, "ObligateField15");
                comboBoxEdit1.DataBindings.Add("Text", gPro, "ObligateField16");

                Hashtable hs = new Hashtable();
                hs.Add("ParentEleID", gPro.EleID);
                hs.Add("SvgUID", gPro.SvgUID);
                sondt = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectglebePropertParentID", hs), typeof(glebeProperty));
                gridControl.DataSource = sondt;
                //添加负荷预测数据
                ctrlglebeYearValue1.ParentObj = gPro;
                string temp = "";
                foreach (DataRow row in sondt.Rows)
                {
                    if (temp != row["TypeUID"].ToString())
                    {
                        temp = row["TypeUID"].ToString();
                        if (!typelist.Contains(row["TypeUID"]))
                        {
                            typelist.Add(row["TypeUID"]);
                        }
                    }
                }
                //if (gPro.Number==0 || gPro.Burthen==0)
                //{
                Hashtable hs1 = new Hashtable();
                if (gPro.SelSonArea != "")
                {
                    string[] selArea = gPro.SelSonArea.Split(";".ToCharArray());
                    for (int i = 0; i < selArea.Length; i++)
                    {
                        if (selArea[i] != "")
                        {
                            string[] _SonArea = selArea[i].Split(",".ToCharArray());
                            hs1.Add(_SonArea[0], _SonArea[1]);
                        }
                    }
                }

                IEnumerator Ilist = sondt.Rows.GetEnumerator();
                while (Ilist.MoveNext())
                {
                    DataRow row = (DataRow)Ilist.Current;

                    string eleid = (string)hs1[row["EleID"]];
                    if (eleid != "")
                    {
                        dou_fh = dou_fh + (Convert.ToDouble(hs1[row["EleID"]]) / Convert.ToDouble(row["Area"])) * Convert.ToDouble(row["Burthen"]);
                    }
                }

                gPro.Burthen = Convert.ToDecimal(dou_fh) + nullvalue;
                fh.Text      = gPro.Burthen.ToString("#####.####");
                //gPro.Number = Convert.ToDecimal( dou_dl.ToString("#####.##"));
                //}
                if (fh.Text == "")
                {
                    fh.Text = "0";
                }
                if (dl.Text == "")
                {
                    dl.Text = "0";
                }
                gPro.Burthen = Convert.ToDecimal(fh.Text);
                if (gPro.Area == 0)
                {
                    return;
                }

                pjfh.Text = Convert.ToDecimal(Convert.ToDecimal(fh.Text) / (Convert.ToDecimal(gPro.Area) + Convert.ToDecimal(gPro.ObligateField10))).ToString("#####.####");
                //辅助决策
                if ((gPro.ObligateField2 == "" || gPro.ObligateField2 == null) && (gPro.ObligateField5 == "" || gPro.ObligateField5 == null))
                {
                    Reload();
                }
                if (strID == "")
                {
                    return;
                }
                string         sql = " where SUID in ( " + strID + ")";
                IList <PSPDEV> l22 = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", sql);
                gridControl1.DataSource = l22;
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }
Exemplo n.º 6
0
        public void ReLoadViewData(glebeProperty gp, string _sub220, string _sub110, string _sub66)
        {
            double dou_fh1 = 0;

            try
            {
                str220 = _sub220;
                str110 = _sub110;
                str66  = _sub66;

                gPro.EleID  = gp.EleID;
                gPro.SvgUID = gp.SvgUID;
                layerID     = gp.LayerID;

                IList svglist = Services.BaseService.GetList("SelectglebePropertyByEleID", gPro);
                if (svglist.Count > 0)
                {
                    gPro = (glebeProperty)svglist[0];

                    IsCreate = false;
                    if (gPro.SonUid == "")
                    {
                        gPro.SonUid = "2";
                    }
                }
                else
                {
                    IsCreate     = true;
                    gPro.LayerID = layerID;
                }
                glebeType g = new glebeType();
                g.UID = "6ab9af7b-3d97-4e6c-8ed7-87b76950b90b";
                g     = (glebeType)Services.BaseService.GetObject("SelectglebeTypeByKey", g);
                if (gPro.ObligateField10 == "")
                {
                    gPro.ObligateField10 = "0";
                }

                nullvalue = Convert.ToDecimal(gPro.ObligateField10) * Convert.ToDecimal(g.TypeStyle);
                //空间负荷进行自动的刷新
                ctrlglebeYearValue1.ParentObj = gPro;
                ctrlglebeYearValue1.Refresh();
                //bh.DataBindings.Add("Text", gPro, "UseID");
                //lx.DataBindings.Add("EditValue", gPro, "TypeUID");

                //mj.DataBindings.Add("Text", gPro, "Area");

                //fh.DataBindings.Add("Text", gPro, "Burthen");
                //dl.DataBindings.Add("Text", gPro, "Number");
                //rzb.DataBindings.Add("Text", gPro, "SonUid");
                //remark.DataBindings.Add("Text", gPro, "Remark");

                //yk1.DataBindings.Add("Text", gPro, "ObligateField2");
                //jc1.DataBindings.Add("Text", gPro, "ObligateField3");
                //nl1.DataBindings.Add("Text", gPro, "ObligateField4");
                //yk2.DataBindings.Add("Text", gPro, "ObligateField5");
                //jc2.DataBindings.Add("Text", gPro, "ObligateField6");
                //nl2.DataBindings.Add("Text", gPro, "ObligateField7");
                //ph1.DataBindings.Add("Text", gPro, "ObligateField8");
                //ph2.DataBindings.Add("Text", gPro, "ObligateField9");

                //Hashtable hs = new Hashtable();
                //hs.Add("ParentEleID", gPro.EleID);
                //hs.Add("SvgUID", gPro.SvgUID);
                //sondt = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectglebePropertParentID", hs), typeof(glebeProperty));
                //gridControl.DataSource = sondt;

                //string temp = "";
                //foreach (DataRow row in sondt.Rows)
                //{
                //    if (temp != row["TypeUID"].ToString())
                //    {
                //        temp = row["TypeUID"].ToString();
                //        typelist.Add(row["TypeUID"]);
                //    }
                //}
                //if (gPro.Number==0 || gPro.Burthen==0)
                //{
                Hashtable hs1 = new Hashtable();
                if (gPro.SelSonArea != "")
                {
                    string[] selArea = gPro.SelSonArea.Split(";".ToCharArray());
                    for (int i = 0; i < selArea.Length; i++)
                    {
                        if (selArea[i] != "")
                        {
                            string[] _SonArea = selArea[i].Split(",".ToCharArray());
                            hs1.Add(_SonArea[0], _SonArea[1]);
                        }
                    }
                }

                IEnumerator Ilist = sondt.Rows.GetEnumerator();
                while (Ilist.MoveNext())
                {
                    DataRow row = (DataRow)Ilist.Current;

                    string eleid = (string)hs1[row["EleID"]];
                    if (eleid != "")
                    {
                        dou_fh1 = dou_fh1 + (Convert.ToDouble(hs1[row["EleID"]]) / Convert.ToDouble(row["Area"])) * Convert.ToDouble(row["Burthen"]);
                    }
                }

                gPro.Burthen = Convert.ToDecimal(dou_fh1) + nullvalue;
                fh.Text      = gPro.Burthen.ToString("#####.####");
                //gPro.Number = Convert.ToDecimal( dou_dl.ToString("#####.##"));
                //}
                if (fh.Text == "")
                {
                    fh.Text = "0";
                }
                if (dl.Text == "")
                {
                    dl.Text = "0";
                }
                gPro.Burthen = Convert.ToDecimal(fh.Text);

                pjfh.Text = Convert.ToDecimal(Convert.ToDecimal(fh.Text) / (Convert.ToDecimal(gPro.Area) + Convert.ToDecimal(gPro.ObligateField10))).ToString("#####.####");
                //辅助决策
                //if ((gPro.ObligateField2 == "" || gPro.ObligateField2 == null) && (gPro.ObligateField5 == "" || gPro.ObligateField5 == null))
                //{
                //    Reload();
                //}
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }