コード例 #1
0
ファイル: FrmEditProject1.cs プロジェクト: EdgarEDT/myitoppsp
        private bool SaveCellValue(string year, string typeID, string value)
        {
            PowerProValues PowerValues = new PowerProValues();
            PowerValues.TypeID = typeID;
            PowerValues.Value = value;
            PowerValues.Year = year;
            PowerValues.TypeID1 = flag;

            try
            {
                Common.Services.BaseService.Update<PowerProValues>(PowerValues);
            }
            catch (Exception ex)
            {
                MsgBox.Show("�������ݳ����" + ex.Message);
                return false;
            }
            return true;
        }
コード例 #2
0
ファイル: Form9_LangFang.cs プロジェクト: EdgarEDT/myitoppsp
        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (treeList1.FocusedNode.HasChildren)
            {
                MsgBox.Show("此项目下有子项目,请先删除子项目!");
                return;
            }
            if (treeList1.FocusedNode.ParentNode == null)
            {
                if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("L3") + "?") == DialogResult.Yes)
                {
                    PowerProValues PowerValues = new PowerProValues();
                    PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString();
                    PowerValues.Year = typeFlag2;

                    PSP_PowerProValues_LangFang ppss = new PSP_PowerProValues_LangFang();
                    ppss.ID = treeList1.FocusedNode["ID"].ToString();
                    ppss.Flag2 = typeFlag2;

                    PSP_PowerProValues_LangFang ppss1 = Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppss);
                    PowerValues.TypeID1 = ppss1.Code;

                    try
                    {
                        //DeletePowerValuesByType里面删除数据和分类

                        Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues);

                        TreeListNode brotherNode = null;
                        try
                        {
                            if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1)
                            {
                                brotherNode = treeList1.FocusedNode.PrevNode;
                                if (brotherNode == null)
                                {
                                    brotherNode = treeList1.FocusedNode.NextNode;
                                }
                            }
                        }
                        catch { }
                        Common.Services.BaseService.Update("DeletePSP_PowerProValues_LangFangByIDFlag2", ppss);
                        treeList1.DeleteNode(treeList1.FocusedNode);
                        WaitDialogForm wait = null;

                        try
                        {
                            wait = new WaitDialogForm("", "正在计算数据, 请稍候...");
                            LoadDatadata();
                            wait.Close();
                        //    MsgBox.Show("计算成功");

                        }
                        catch
                        {
                            wait.Close();
                        }

                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("删除出错:" + ex.Message);
                    }
                }
                return;
            }
            else {

            if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("L3") + "?") == DialogResult.Yes)
            {
                bool flag = false;
                PowerProValues PowerValues = new PowerProValues();
                PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString();
                PowerValues.Year = typeFlag2;

                PSP_PowerProValues_LangFang ppss = new PSP_PowerProValues_LangFang();
                ppss.ID=treeList1.FocusedNode["ID"].ToString();
                ppss.Flag2=typeFlag2;

                PSP_PowerProValues_LangFang ppss1 = Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppss);
                PowerValues.TypeID1 = ppss1.Code;

                try
                {
                    //DeletePowerValuesByType里面删除数据和分类

                    Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues);

                    TreeListNode brotherNode = null;
                    try
                    {
                        if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1)
                        {
                            flag = false;
                            brotherNode = treeList1.FocusedNode.PrevNode;
                            if (brotherNode == null)
                            {
                                brotherNode = treeList1.FocusedNode.NextNode;
                            }
                        }
                        if (treeList1.FocusedNode.ParentNode.Nodes.Count == 1)
                        {
                            flag = true;
                        }
                     }
                    catch { }
                    Common.Services.BaseService.Update("DeletePSP_PowerProValues_LangFangByIDFlag2",ppss);
                    TreeListColumn column = treeList1.Columns["L10"];
                    treeList1.DeleteNode(treeList1.FocusedNode);
                    if(flag==false)
                       CalculateSum(treeList1.FocusedNode.ParentNode, column, 0,false);
                    else
                       CalculateSum(treeList1.FocusedNode, column, 0,false);
                   WaitDialogForm wait = null;

                   try
                   {
                       wait = new WaitDialogForm("", "正在计算数据, 请稍候...");
                       LoadDatadata();
                       wait.Close();
                       //MsgBox.Show("计算成功");

                   }
                   catch
                   {
                       wait.Close();
                   }

                }
                catch (Exception ex)
                {
                    MsgBox.Show("删除出错:" + ex.Message);
                }
            }
            }
              //            InitSodata();
              //obj= frm.OBJ;

              // CalculateSum(focusedNode, column, double.Parse(obj.L10));
        }
コード例 #3
0
ファイル: FrmEditProject1.cs プロジェクト: EdgarEDT/myitoppsp
        private void FrmEditProject_Load(object sender, EventArgs e)
        {
            string q1 = "";
            PowerProTypes ppt = new PowerProTypes();
            ppt.ID = poweruid;
            ppt.Flag2 = flag;

            PowerProTypes ps = Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt);
            if (ps != null)
            {
                groupBox1.Text = ps.Title;
                powerid = ps.Code;
                q1 = ps.Remark;
            }

            LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid);
            if (li22 != null)
            {
                isline = true;
            }

            substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid);
            if (sb != null)
            {
                isPower = true;
            }

            PowerProValues ppv = new PowerProValues();
            ppv.TypeID = poweruid;
            ppv.TypeID1 = flag;
            IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv);

            PowerProYears pps = new PowerProYears();
            pps.Flag = flag;
            IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps);

            lb=new Label[li.Count];
            te=new TextEdit[li.Count];

            int i=0;
            foreach (PowerProYears ppy in li)
            {
                lb[i] = new Label();
                lb[i].Name= "Label"+ppy.Year;
                lb[i].Text = ppy.Year+":";
                lb[i].Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lb[i]);

                te[i] = new TextEdit();
                te[i].Name = "Text" + ppy.Year;
                te[i].Location = new Point(157, 26 + 33 * i);
                te[i].Size = new Size(231, 21);
                groupBox1.Controls.Add(te[i]);

                foreach (PowerProValues ppy1 in listValues)
                {
                    if (ppy.Year == ppy1.Year)
                        te[i].Text = ppy1.Value;
                }

                i++;

            }

            //ls1.Text = "�ƻ���ʼʱ��:";
            //ls1.Location = new Point(52, 27 + 33 * i);
            //groupBox1.Controls.Add(ls1);

            //ts1 = new TextEdit();
            //ts1.Location = new Point(157, 27 + 33 * i);
            //ts1.Size = new Size(231, 21);

            //ts1.Properties.DisplayFormat.FormatString = "n0";
            //ts1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
            //ts1.Properties.EditFormat.FormatString = "n0";
            //ts1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
            //ts1.Properties.Mask.EditMask = "####";
            //ts1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
            //groupBox1.Controls.Add(ts1);

            //ls2.Text = "Ԥ��Ͷ��ʱ��:";
            //ls2.Location = new Point(52, 60 + 33 * i);
            //groupBox1.Controls.Add(ls2);

            //ts2 = new TextEdit();
            //ts2.Location = new Point(157, 60 + 33 * i);
            //ts2.Size = new Size(231, 21);

            //ts2.Properties.DisplayFormat.FormatString = "n0";
            //ts2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
            //ts2.Properties.EditFormat.FormatString = "n0";
            //ts2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
            //ts2.Properties.Mask.EditMask = "####";
            //ts2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
            //groupBox1.Controls.Add(ts2);

            ls3.Text = "��ע:";
            ls3.Location = new Point(52, 27 + 33 * i);
            groupBox1.Controls.Add(ls3);

            ts3 = new TextEdit();
            ts3.Location = new Point(157, 27 + 33 * i);
            ts3.Size = new Size(231, 21);
            groupBox1.Controls.Add(ts3);

            ts3.Text = q1;

            if (isline)
            {
                la.Text = "����:";
                la.Location = new Point(52, 61 + 33 * i);
                groupBox1.Controls.Add(la);

                ta = new TextEdit();
                ta.Location = new Point(157, 60 + 33 * i);
                ta.Size = new Size(231, 21);
                groupBox1.Controls.Add(ta);

                lb1.Text = "�ͺ�:";
                lb1.Location = new Point(52, 61 + 33 * (i + 1));
                groupBox1.Controls.Add(lb1);

                tb = new TextEdit();
                tb.Location = new Point(157, 60 + 33 * (i + 1));
                tb.Size = new Size(231, 21);
                groupBox1.Controls.Add(tb);

                try
                {
                    if (li22 != null)
                    {
                        ta.Text = li22.Length;
                        tb.Text = li22.LineType;
                    }
                }
                catch { }

            }
            if (isPower)
            {
                l11.Text = "����:";
                l11.Location = new Point(52, 61 + 33 * i);
                groupBox1.Controls.Add(l11);

                t11 = new TextEdit();
                t11.Location = new Point(157, 60 + 33 * i);
                t11.Size = new Size(231, 21);
                groupBox1.Controls.Add(t11);

                l33.Text = "������:";
                l33.Location = new Point(52, 61 + 33 * (i + 1));
                groupBox1.Controls.Add(l33);

                t33 = new TextEdit();
                t33.Location = new Point(157, 60 + 33 * (i + 1));
                t33.Size = new Size(231, 21);
                groupBox1.Controls.Add(t33);

                try
                {

                    if (sb != null)
                    {
                        t11.Text = sb.Burthen.ToString();
                        t33.Text = sb.ObligateField2;
                    }

                }
                catch { }
            }

            groupBox1.Size = new Size(434, 124 + 33 * i);
            simpleButton1.Location = new Point(296, 144 + 33 * i);
            simpleButton2.Location = new Point(389, 144 + 33 * i);
            this.Size = new Size(490, 224 + 33 * i);
        }
コード例 #4
0
ファイル: Form10.cs プロジェクト: EdgarEDT/myitoppsp
        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (treeList1.FocusedNode.ParentNode==null)
            {
                MsgBox.Show("一级项目不允许删除!");
                return;
            }

            if (treeList1.FocusedNode.HasChildren)
            {
                MsgBox.Show("此项目下有子项目,请先删除子项目!");
                return;
            }

            if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {

                PowerProValues PowerValues = new PowerProValues();
                PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString();
                PowerValues.Year = typeFlag2;
                PowerProTypes ppss = new PowerProTypes();
                ppss.ID = treeList1.FocusedNode["ID"].ToString();
                ppss.Flag2 = typeFlag2;
                PowerProTypes ppss1 = Services.BaseService.GetOneByKey<PowerProTypes>(ppss);
                PowerValues.TypeID1 = ppss1.Code;
                try
                {
                    //DeletePowerValuesByType里面删除数据和分类
                    Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues);

                    TreeListNode brotherNode = null;
                    try
                    {
                        if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1)
                        {
                            brotherNode = treeList1.FocusedNode.PrevNode;
                            if (brotherNode == null)
                            {
                                brotherNode = treeList1.FocusedNode.NextNode;
                            }
                        }
                    }
                    catch { }
                    treeList1.DeleteNode(treeList1.FocusedNode);
                    LoadData();

                }
                catch (Exception ex)
                {
                    MsgBox.Show("删除出错:" + ex.Message);
                }
            }
        }
コード例 #5
0
ファイル: Form9_LangFang.cs プロジェクト: EdgarEDT/myitoppsp
        private void InsertLineData1()
        {
            PowerEachList pel = this.ctrlPowerEachList1.FocusedObject;
            bool bl = true;
            string parentid = "";
            string id = "";
            string flag2 = "";
            TreeListNode tln = treeList1.FocusedNode;
            //if (tln != null)
            //{
            //    bl = false;
            //    try
            //    {
            //         parentid = tln["ParentID"].ToString();
            //         id = tln["ID"].ToString();
            //         flag2 = tln["Flag2"].ToString();
            //    }
            //    catch
            //    { }
            //}
            //else
               // {
                id = "0";
                flag2 = pel.UID;

            //}

            PSP_PowerProValues_LangFang z = new PSP_PowerProValues_LangFang();
            PowerProYears h = new PowerProYears();
            PowerProValues j = new PowerProValues();

            object obj = Services.BaseService.GetObject("SelectPowerProTypesList", "");

            try
            {
                DataTable dts = new DataTable();
                OpenFileDialog op = new OpenFileDialog();
                op.Filter = "Excel文件(*.xls)|*.xls";
                if (op.ShowDialog() == DialogResult.OK)
                {
                    dts = GetExcel(op.FileName);

                    for (int i = 1; i < dts.Rows.Count; i++)
                    {
                        if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0)
                            continue;
                        z.ID = Guid.NewGuid().ToString();
                        string strflag = "";
                        foreach (DataColumn dc in dts.Columns)
                        {
                           strflag = dc.Caption.ToString();
                            try {
                            switch (strflag)
                            {
                                case "项目名称":
                                        z.Title = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "工程名称":
                                        z.L3 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "电压等级":
                                    z.L4 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "主变台数":
                                    z.L5 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "单台容量(MVA)":
                                    z.L6 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "总容量(MVA)":
                                    z.IsConn = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "建设形式":
                                     z.L7 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;

                                case "线路长度(KM)":
                                    z.L8 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "导线型号":
                                    z.L9 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                //case "投资造价":
                                //    z.L11 = dts.Rows[i][dc.ColumnName].ToString();
                                //    break;
                                //case "造价比例":
                                //    z.L12 = dts.Rows[i][dc.ColumnName].ToString();
                                //    break;
                                case "标准造价(万元)":
                                    z.L10 =double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "造价调整(万元)":
                                    z.L11 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "工程总价(万元)":
                                    z.L12 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                default:
                                    j.Value = dts.Rows[i][dc.ColumnName].ToString();
                                    j.TypeID = z.ID;
                                    j.Year = dc.ColumnName;
                                    j.TypeID1 = flag2;
                                    Services.BaseService.Update<PowerProValues>(j);
                                    break;
                            }
                        }
                        catch { }
                        }
                        z.Flag2 = flag2;
                        z.ParentID = "0";
                        //z.Flag = 1;
                   PSP_PowerProValues_LangFang lf=(PSP_PowerProValues_LangFang)Services.BaseService.GetObject("SelectPSP_PowerProValues_LangFangByObject",z);
                   if (lf == null)
                   {
                       Services.BaseService.Create<PSP_PowerProValues_LangFang>(z);
                   }
                 else
                   {
                       z.Code = lf.Code;
                       z.Flag = lf.Flag;
                       Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangBytable", z);
                   }

                    }
            }
            ReLoadData();
               }
            catch { MsgBox.Show("导入格式不正确!"); }
        }
コード例 #6
0
ファイル: Form9_Liao.cs プロジェクト: EdgarEDT/myitoppsp
        private void InsertLineData1()
        {
            TreeListNode tln = treeList1.FocusedNode;
            if (tln == null)
                return;
            PowerProTypes z = new PowerProTypes();
            PowerProYears h = new PowerProYears();
            PowerProValues j = new PowerProValues();
            string parentid = tln["ParentID"].ToString();
            string id = tln["ID"].ToString();
            string flag2 = tln["Flag2"].ToString();
            object obj = Services.BaseService.GetObject("SelectPowerProTypesList", "");

            try
            {
                DataTable dts = new DataTable();
                OpenFileDialog op = new OpenFileDialog();
                op.Filter = "Excel文件(*.xls)|*.xls";
                if (op.ShowDialog() == DialogResult.OK)
                {
                    dts = GetExcel(op.FileName);

                    for (int i = 1; i < dts.Rows.Count; i++)
                    {
                        if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0)
                            continue;
                        z.ID = Guid.NewGuid().ToString();
                        string strflag = "";
                        foreach (DataColumn dc in dts.Columns)
                        {
                           strflag = dc.Caption.ToString();
                            try {
                            switch (strflag)
                            {
                                case "项目名称":

                                        z.Title = dts.Rows[i][dc.ColumnName].ToString();

                                    break;
                                case "计划开工时间":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.StartYear = 0; }
                                    else
                                        z.StartYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "计划结束时间":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.EndYear = 0; }
                                    else
                                        z.EndYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "备注":
                                    z.IsConn = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                case "备注2":
                                    break;
                                case "台数":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.L1 = 0; }
                                    else
                                        z.L1 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "容量(MVA)":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.L2 = 0; }
                                    else
                                        z.L2 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "负荷率(%)":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.L5 = 0; }
                                    else
                                        z.L5 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "最大负荷(MVA)":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.L6 = 0; }
                                    else
                                        z.L6 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "长度(KM)":
                                    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                                    { z.L3 = 0; }
                                    else
                                        z.L3 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                                    break;
                                case "型号":
                                    z.L4 = dts.Rows[i][dc.ColumnName].ToString();
                                    break;
                                default:
                                    j.Value = dts.Rows[i][dc.ColumnName].ToString();
                                    j.TypeID = z.ID;
                                    j.Year = dc.ColumnName;
                                  //  j.TypeID1 = flag2;
                                    Services.BaseService.Create<PowerProValues>(j);
                                    break;
                            }
                        }
                        catch { }
                            ////if (dc.Caption.IndexOf("自定义列") >= 0)
                            ////{

                            ////    j.Value = dts.Rows[i][dc.ColumnName].ToString();
                            ////    j.TypeID = z.ID;
                            ////    j.Year = dc.ColumnName;
                            ////    j.TypeID1 = flag2;
                            ////    Services.BaseService.Create<PowerProValues>(j);
                            ////}
                            ////if (dc.Caption.IndexOf("项目名称") >= 0)
                            ////{
                            ////    z.Title = dts.Rows[i][dc.ColumnName].ToString();
                            ////}
                            ////if (dc.Caption.IndexOf("台数") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.L1 = 0; }
                            ////    else
                            ////    z.L1 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("容量") >= 0)
                            ////{       if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////        { z.L2 = 0; }
                            ////    else
                            ////    z.L2 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("负荷率") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.L5 = 0; }
                            ////    else
                            ////    z.L5 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("最大负荷") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.L6 = 0; }
                            ////    else
                            ////    z.L6 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("长度") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.L3 = 0; }
                            ////    else
                            ////    z.L3 = double.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("型号") >= 0)
                            ////{
                            ////    z.L4 = dts.Rows[i][dc.ColumnName].ToString();
                            ////}
                            ////if (dc.Caption.IndexOf("计划开工") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.StartYear =0 ; }
                            ////    else
                            ////        z.StartYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("计划结束") >= 0)
                            ////{
                            ////    if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            ////    { z.EndYear = 0; }
                            ////    else
                            ////        z.EndYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString());
                            ////}
                            ////if (dc.Caption.IndexOf("备注") >= 0)
                            ////{
                            ////    z.IsConn = dts.Rows[i][dc.ColumnName].ToString();
                            ////}

                        }
                        z.Flag2 = flag2;
                        z.ParentID = id;
                        z.Flag = 1;
                        Services.BaseService.Create<PowerProTypes>(z);
                    }
            }
            ReLoadData();
               }
            catch { MsgBox.Show("导入格式不正确!"); }
        }
コード例 #7
0
ファイル: FormNewType4.cs プロジェクト: EdgarEDT/myitoppsp
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            //  string z="自定义列";
            type = psp_Year.Year = spinEdit1.Text;
            psp_Year.Flag = flag2;
            if (type.ToString() == "")
            {
                MsgBox.Show("类别名称不能为空");
                return;

            }

            try
            {

                if (!IsUpdate)
                {

                    if (Common.Services.BaseService.GetObject("SelectPowerProYearsByYearFlag", psp_Year) == null)
                    {
                        try
                        {
                            Common.Services.BaseService.Create<PowerProYears>(psp_Year);
                            this.DialogResult = DialogResult.OK;
                        }
                        catch (Exception ex)
                        {
                            MsgBox.Show("出错啦:" + ex.Message);
                        }
                    }
                    else
                    {
                        MsgBox.Show("此分类已经存在,请重新输入!");
                    }
                }
                else
                {
                    try
                    {

                        PowerProTypes psp_Type = new PowerProTypes();
                        psp_Type.Flag2 = type1;
                        IList<PowerProTypes> listTypes = new List<PowerProTypes>();
                        try
                        {
                            listTypes = Common.Services.BaseService.GetList<PowerProTypes>("SelectPowerProTypesByFlag2", psp_Type);
                        }
                        catch (Exception ex)
                        { MsgBox.Show(ex.Message); }

                        foreach (PowerProTypes pstt in listTypes)
                        {
                            PowerProValues psv = new PowerProValues();
                            psv.TypeID = pstt.ID;
                            psv.Year = psp_Year.Year;
                            psv.Value = year2;
                            psv.TypeID1 = type1;
                            Common.Services.BaseService.Update("UpdatePowerProValuesByYear1", psv);
                        }

                        Common.Services.BaseService.Update<PowerProYears>(psp_Year);
                        this.DialogResult = DialogResult.OK;
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("出错啦:" + ex.Message);
                    }

                }
            }
            catch(Exception ex)
            {
                MsgBox.Show("出错啦:" + ex.Message);
            }
        }
コード例 #8
0
ファイル: Form9_Liao.cs プロジェクト: EdgarEDT/myitoppsp
        private void InsertLineData2()
        {
            PowerEachList pel = this.ctrlPowerEachList11.FocusedObject;
            if (pel==null)
            {
                MsgBox.Show("请先添加项目规划");
                return;
            }
            TreeListNode tln = treeList1.FocusedNode;

            //try
            //{
            //    string parentid = tln["ParentID"].ToString();
            //    string id = tln["ID"].ToString();
            //    string flag2 = tln["Flag2"].ToString();
            //}
            //catch { }
            string typeid = pel.UID;

            PowerProTypes z = new PowerProTypes();
            PowerProYears h = new PowerProYears();
            PowerProValues j = new PowerProValues();

            PowerProYears ppy1=new PowerProYears();
            ppy1.Flag=typeid;

            //IList<PowerProYears> listppy = Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", ppy1);

            try
            {
                DataTable dts = new DataTable();
                OpenFileDialog op = new OpenFileDialog();
                op.Filter = "Excel文件(*.xls)|*.xls";
                if (op.ShowDialog() == DialogResult.OK)
                {
                    dts = GetExcel(op.FileName);

                    for (int i = 0; i < dts.Rows.Count; i++)
                    {
                        //if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0)
                        //    continue;
                        z = new PowerProTypes();
                        string guid=Guid.NewGuid().ToString();
                        z.ID = guid;
                        z.Flag2 = typeid;
                       // z.ParentID = id;

                        string strflag = "";
                        foreach (DataColumn dc in dts.Columns)
                        {
                            strflag = dc.Caption.ToString();
                            try
                            {
                                switch (strflag)
                                {
                                    case "区域名称":
                                        z.Title = dts.Rows[i][dc.ColumnName].ToString();
                                        break;
                                    case "项目名称":
                                        z.Code = dts.Rows[i][dc.ColumnName].ToString();
                                        break;
                                    case "建设性质":
                                        z.L4 = dts.Rows[i][dc.ColumnName].ToString();
                                        break;

                                    case "变电容量(MVA)":
                                        try
                                        {
                                            z.IsConn =dts.Rows[i][dc.ColumnName].ToString();
                                        }
                                        catch { z.L2 = 0; }
                                        break;

                                    case "线路长度(KM)":
                                        try
                                        {
                                            z.Remark = dts.Rows[i][dc.ColumnName].ToString();
                                        }
                                        catch { z.L3 = 0; }
                                        break;

                                    case "投产年限":
                                        try
                                        {
                                            z.L5 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString());
                                        }
                                        catch { z.L5 = 0; }
                                        break;

                                    case "总投资(万元)":
                                        try
                                        {
                                            z.L6 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString());
                                        }
                                        catch { z.L6 = 0; }
                                        break;

                                    default:
                                        try
                                        {
                                            PowerProYears ppy2 = new PowerProYears();
                                            ppy2.Year = strflag;
                                            ppy2.Flag = typeid;

                                            IList<PowerProYears> listyear2 = Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsByYearFlag", ppy2);
                                            if (listyear2.Count == 0)
                                            {
                                                Services.BaseService.Create<PowerProYears>(ppy2);
                                            }
                                            PowerProTypes pvalues = (PowerProTypes)Services.BaseService.GetObject("SelectPowerProTypesByCodeAndTitle", z);
                                            if (pvalues != null)
                                                z.ID = pvalues.ID;
                                            j = new PowerProValues();
                                            j.TypeID = z.ID;
                                            j.TypeID1 = typeid;
                                            j.Year = strflag;
                                            j.Value = dts.Rows[i][dc.ColumnName].ToString();
                                            Services.BaseService.Update<PowerProValues>(j);
                                        }
                                        catch { }
                                        break;
                                }
                            }
                            catch { }
                        }
                        Services.BaseService.Update("UpdatePowerProTypesByCodeAndTitle", z);
                    }
                }
                ReLoadData();
            }
            catch { MsgBox.Show("导入格式不正确!"); }
        }
コード例 #9
0
        private void FrmEditProject_Load(object sender, EventArgs e)
        {
            SetData();
            string q1 = "";
            string q2 = "";
            string q3 = "";
            string q4 = "";
            string q5 = "";
            string q6 = "";
            string q7 = "";
            string q8 = "";
            string q9 = "";
            string q10 = "";
            string q11 = "";
            string q12 = "";

            int t1 = 0;

            PSP_PowerProValues_LangFang ppt = new PSP_PowerProValues_LangFang();
            ppt.ID = poweruid;
            ppt.Flag2 = flag;

            PSP_PowerProValues_LangFang ps = Common.Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppt);
            if (ps != null)
            {
                groupBox1.Text = ps.Title;
                powerid = ps.Code;
                t1 = ps.Flag;

               // q1 = ps.L1;
               // q2 = ps.L2;
                q3 = ps.L3;
                q4 = ps.L4;
                q5 = ps.L5;
                q6 = ps.L6;
                q7 = ps.L7;
                q8 = ps.L8;
                q9 = ps.L9;
                q10 = ps.L10.ToString();
                q11 = ps.L11;
                q12 = ps.L12.ToString();

            }

            LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid);
            if (li22 != null || t1==1)
            {
                isline = true;
            }

            substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid);
            if (sb != null || t1 == 2)
            {
                isPower = true;
            }

            PowerProValues ppv = new PowerProValues();
            ppv.TypeID = poweruid;
            ppv.TypeID1 = flag;
            IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv);

            PowerProYears pps = new PowerProYears();
            pps.Flag = flag;
            IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps);

            lb=new Label[li.Count];
            te=new TextEdit[li.Count];

            int i=0;

            //if (!isPower)
               // {
                ////lt1.Text = "�豸����:";
                ////lt1.Location = new Point(52, 27 + 33 * i);
                ////groupBox1.Controls.Add(lt1);

                ////tt1 = new TextEdit();
                ////tt1.Location = new Point(157, 26 + 33 * i);
                ////tt1.Size = new Size(231, 21);
                ////tt1.TextChanged += new EventHandler(tt1_TextChanged);
                ////tt1.Properties.DisplayFormat.FormatString = "n4";
                ////tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt1.Properties.EditFormat.FormatString = "n4";
                ////tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt1.Properties.Mask.EditMask = "#####0.####";
                ////tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                ////groupBox1.Controls.Add(tt1);

                ////i++;

                ////lt2.Text = "̨��:";
                ////lt2.Location = new Point(52, 27 + 33 * i);
                ////groupBox1.Controls.Add(lt2);

                ////tt2 = new TextEdit();
                ////tt2.Location = new Point(157, 26 + 33 * i);
                ////tt2.Size = new Size(231, 21);
                ////groupBox1.Controls.Add(tt2);

                ////i++;
               // }

            //if (!isline)
            {
                lt3.Text = "�� �� �� �� :";
                lt3.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt3);

               // tt3 = new TextEdit();
                cb0.Location = new Point(157, 26 + 33 * i);
                cb0.Size = new Size(231, 21);

                cb0.Properties.DisplayFormat.FormatString = "n0";
                cb0.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                cb0.Properties.EditFormat.FormatString = "n0";
                cb0.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
               // cb0.Properties.Mask.EditMask = "########";
                cb0.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(cb0);

                i++;

                lt4.Text = "�� ѹ �� �� :";
                lt4.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt4);

               // tt4 = new TextEdit();
                cb1.Location = new Point(157, 26 + 33 * i);
                cb1.Size = new Size(231, 21);

                cb1.Properties.DisplayFormat.FormatString = "n4";
                cb1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                cb1.Properties.EditFormat.FormatString = "n4";
                cb1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
               // cb1.Properties.Mask.EditMask = "#####0.####";
                cb1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(cb1);
                i++;

                lt5.Text = "�� �� ̨ �� :";
                lt5.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt5);

              //  tt5 = new TextEdit();
                cb2.Location = new Point(157, 26 + 33 * i);
                cb2.Size = new Size(231, 21);

                cb2.Properties.DisplayFormat.FormatString = "####.##";
                cb2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                cb2.Properties.EditFormat.FormatString = "####.##";
                cb2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
               // cb2.Properties.Mask.EditMask = "P2";
                cb2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(cb2);
                i++;

                lt6.Text = "��̨������MVA��:";
                lt6.Location = new Point(50, 27 + 33 * i);
                lt6.Width = 105;
                groupBox1.Controls.Add(lt6);

                //tt6 = new TextEdit();
                cb3.Location = new Point(157, 26 + 33 * i);
                cb3.Size = new Size(231, 21);

                cb3.Properties.DisplayFormat.FormatString = "n4";
                cb3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                cb3.Properties.EditFormat.FormatString = "n4";
                cb3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
              //  cb3.Properties.Mask.EditMask = "#####0.####";
                cb3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(cb3);

                i++;

                lt7.Text = "�� �� �� ʽ :";
                lt7.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt7);

                //tt6 = new TextEdit();
                cb4.Location = new Point(157, 26 + 33 * i);
                cb4.Size = new Size(231, 21);

                cb4.Properties.DisplayFormat.FormatString = "n4";
                cb4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                cb4.Properties.EditFormat.FormatString = "n4";
                cb4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
               // cb4.Properties.Mask.EditMask = "#####0.####";
                cb4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(cb4);

                i++;

                lt8.Text = "��·���ȣ�KM��:";
                lt8.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt8);

                //tt6 = new TextEdit();
                tt4.Location = new Point(157, 26 + 33 * i);
                tt4.Size = new Size(231, 21);

                tt4.Properties.DisplayFormat.FormatString = "n4";
                tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                tt4.Properties.EditFormat.FormatString = "n4";
                tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
              //  tt4.Properties.Mask.EditMask = "#####0.####";
                tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(tt4);

                i++;

                lt9.Text = "�� �� �� �� :";
                lt9.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt9);

                //tt6 = new TextEdit();
                cb5.Location = new Point(157, 26 + 33 * i);
                cb5.Size = new Size(231, 21);

                cb5.Properties.DisplayFormat.FormatString = "n4";
                cb5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None;
                cb5.Properties.EditFormat.FormatString = "n4";
                cb5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None;
               // cb5.Properties.Mask.EditMask = "#####0.####";
                cb5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;

                groupBox1.Controls.Add(cb5);

                i++;

                Project_Sum sum = new Project_Sum();
                sum.S5 = islineflag;
                sum.S1 = q4;
                IList<Project_Sum> list = Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5",sum);
                upedit.Properties.DataSource = list;
                LookUpColumnInfo a = new LookUpColumnInfo();
                a.FieldName = "T3";
                a.Caption = "������ʽ";
                LookUpColumnInfo c = new LookUpColumnInfo();
                c.FieldName = "T2";
                c.Caption = "���߹�ģ";
                LookUpColumnInfo b = new LookUpColumnInfo();
                b.FieldName = "T1";
                b.Caption = "����̨��������";
                LookUpColumnInfo d = new LookUpColumnInfo();
                d.Caption = "��̬Ͷ��";
                d.FieldName = "Num";
                LookUpColumnInfo nn = new LookUpColumnInfo();
                nn.FieldName = "Name";
                nn.Caption = "���";
                LookUpColumnInfo f = new LookUpColumnInfo();
                f.FieldName = "Type";
                f.Caption = "����";
                upedit.Properties.Columns.Add(f);
                upedit.Properties.Columns.Add(nn);
                upedit.Properties.Columns.Add(b);
                upedit.Properties.Columns.Add(c);
                upedit.Properties.Columns.Add(a);
                upedit.Properties.Columns.Add(d);
                upedit.Properties.DisplayMember = "Num";
                //upedit.Properties.SearchMode = SearchMode.AutoComplete;
                //upedit.Properties.AutoSearchColumnIndex = 5;
                upedit.Properties.DropDownRows =5;
                upedit.Properties.PopupWidth = 500;
                upedit.Properties.ShowHeader = true;

                lt10.Text = "Ͷ �� �� �� :";
                lt10.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt10);
                upedit.Location = new Point(157, 26 + 33 * i);
                upedit.Size = new Size(231, 21);
                upedit.Properties.DisplayFormat.FormatString = "n4";
                upedit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                upedit.Properties.EditFormat.FormatString = "n4";
                upedit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                upedit.Properties.Mask.EditMask = "###############0.####";
                upedit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                upedit.Properties.AllowNullInput=DevExpress.Utils.DefaultBoolean.True;
                upedit.TextChanged += new EventHandler(upedit_TextChanged);
                groupBox1.Controls.Add(upedit);

                i++;

                lt11.Text = "�� �� �� �� :";
                lt11.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt11);

                //tt6 = new TextEdit();
                tt6.Location = new Point(157, 26 + 33 * i);
                tt6.Size = new Size(231, 21);

                tt6.Properties.DisplayFormat.FormatString = "n4";
                tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.EditFormat.FormatString = "n4";
                tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.Mask.EditMask = "###############0.####";
                tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                tt6.TextChanged += new EventHandler(tt6_TextChanged);
                groupBox1.Controls.Add(tt6);

                i++;

                lt12.Text = "�� �� �� �� :";
                lt12.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt12);

                //tt6 = new TextEdit();
                tt5.Location = new Point(157, 26 + 33 * i);
                tt5.Size = new Size(231, 21);

                tt5.Properties.DisplayFormat.FormatString = "n4";
                tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.EditFormat.FormatString = "n4";
                tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.Mask.EditMask = "###############0.####";
                tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt5);

                i++;
            }

            int j = 0;
            foreach (PowerProYears ppy in li)
            {
                lb[j] = new Label();
                lb[j].Name = "Label" + ppy.Year;
                lb[j].Text = ppy.Year + ":";
                lb[j].Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lb[j]);

                te[j] = new TextEdit();
                te[j].Name = "Text" + ppy.Year;
                te[j].Location = new Point(157, 26 + 33 * i);
                te[j].Size = new Size(231, 21);
                groupBox1.Controls.Add(te[j]);

                foreach (PowerProValues ppy1 in listValues)
                {
                    if (ppy.Year == ppy1.Year)
                        te[j].Text = ppy1.Value;
                }
                j++;
                i++;
            }

            if (isline)
            {
                try
                {
                  // cb5.Properties.Items.Contains(q9.ToString());

                    //tt1.Text = q3.ToString();
                    //tt2.Text = q4.ToString();

                    //if (li22 != null)
                    //{
                    //    tt1.Text = li22.Length;
                    //    tt2.Text = li22.LineType;
                    //}
                }
                catch { }

            }
            if (isPower)
            {
                try
                {
                    ////tt3.Text = q1.ToString();
                    //tt4.Text = q4.ToString();
                    //tt5.Text = q5.ToString();
                    //tt6.Text = q6.ToString();

                    //if (sb != null)
                    //{
                    //    tt5.Text = sb.Number.ToString();
                    //    tt4.Text = sb.ObligateField2;
                    //    tt6.Text = sb.Burthen.ToString();
                    //}

                }
                catch { }
            }

            PSP_PowerProValues_LangFang pplf = new PSP_PowerProValues_LangFang();

            pplf.Flag2 = flag;

            IList<PSP_PowerProValues_LangFang> plfs = Common.Services.BaseService.GetList<PSP_PowerProValues_LangFang>("SelectPSP_PowerProValues_LangFangByFlag2OrderL3", pplf);

            tt4.Text = q8.ToString();
            tt5.Text = q10.ToString();
            tt6.Text = q12.ToString();

            if (plfs.Count == 0)
            {
                cb0.Text = "";
            }
            foreach (PSP_PowerProValues_LangFang pv in plfs)
            {
                if(pv.L3!=""&&pv.L3.Length>0)
                cb0.Properties.Items.Add(pv.L3);
            }
            cb0.Text = q3.ToString();
            cb1.Text = q4.ToString();
            cb2.Text = q5.ToString();
            cb3.Text = q6.ToString();
            cb4.Text = q7.ToString();
            cb5.Text = q9.ToString();
            lookupedit = q11;
            upedit.Properties.NullText = q11;
            groupBox1.Size = new Size(434, 40+ 33 * i);
            simpleButton1.Location = new Point(296, 60 + 33 * i);
            simpleButton2.Location = new Point(389, 60 + 33 * i);
            this.Size = new Size(490, 130 + 33 * i);
        }
コード例 #10
0
ファイル: FrmEditProject4.cs プロジェクト: EdgarEDT/myitoppsp
        private void FrmEditProject_Load(object sender, EventArgs e)
        {
            string q1 = "";
            string q2 = "";
            string q3 = "";
            string q4 = "";
            string q5 = "";
            double? q6 = null;
            string q7 = "";
            string q8 = "";

            string c1 = "";
            string c2 = "";
            string c3 = "";

            int t1 = 0;
            PowerProTypes ppt = new PowerProTypes();
            try
            {
                ppt.ID = poweruid.ToString();
            }
            catch { }
            ppt.Flag2 = flag;
            try {
                ppt = (PowerProTypes)Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt);

                }
            catch { }

                if (ppt != null)
                {

                    q1 = ppt.Remark;
                    q2 = ppt.L4.ToString();
                    q3 = ppt.Title;
                    q4 = ppt.IsConn;
                    q5 = ppt.L5.ToString();
                    q6 = ppt.L6;
                    q7 = ppt.Code.ToString();

                }

            PowerProValues ppv = new PowerProValues();
            ppv.TypeID = poweruid;
            ppv.TypeID1 = flag;
            IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv);

            PowerProYears pps = new PowerProYears();
            pps.Flag = flag;
            IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps);

            lb=new Label[li.Count];
            te=new TextEdit[li.Count];

            int i=0;

            lt3.Text = "��������:";
            lt3.Location = new Point(52, 27 + 33 * i);
            groupBox1.Controls.Add(lt3);

            tt3 = new TextEdit();
            tt3.Location = new Point(157, 26 + 33 * i);
            tt3.Size = new Size(231, 21);
            groupBox1.Controls.Add(tt3);

            i++;

            lt7.Text = "��Ŀ����:";
            lt7.Location = new Point(52, 27 + 33 * i);
            groupBox1.Controls.Add(lt7);

            tt7 = new TextEdit();
            tt7.Location = new Point(157, 26 + 33 * i);
            tt7.Size = new Size(231, 21);
            groupBox1.Controls.Add(tt7);

            i++;

                lt2.Text = "��������:";
                lt2.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt2);

                tt2 = new TextEdit();
                tt2.Location = new Point(157, 26 + 33 * i);
                tt2.Size = new Size(231, 21);
                groupBox1.Controls.Add(tt2);

                i++;

                lt4.Text = "�������:";
                lt4.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt4);

                tt4 = new TextEdit();
                tt4.Location = new Point(157, 26 + 33 * i);
                tt4.Size = new Size(231, 21);

                ////tt4.Properties.DisplayFormat.FormatString = "n4";
                ////tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt4.Properties.EditFormat.FormatString = "n4";
                ////tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt4.Properties.Mask.EditMask = "#########";
                ////tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt4);
                i++;

                lt1.Text = "��·����:";
                lt1.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt1);

                tt1 = new TextEdit();
                tt1.Location = new Point(157, 26 + 33 * i);
                tt1.Size = new Size(231, 21);

                ////tt1.Properties.DisplayFormat.FormatString = "n4";
                ////tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt1.Properties.EditFormat.FormatString = "n4";
                ////tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ////tt1.Properties.Mask.EditMask = "#####0.####";
                ////tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt1);

                i++;

                lt5.Text = "Ͷ������:";
                lt5.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt5);

                tt5 = new TextEdit();
                tt5.Location = new Point(157, 26 + 33 * i);
                tt5.Size = new Size(231, 21);

                tt5.Properties.DisplayFormat.FormatString = "n4";
                tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.EditFormat.FormatString = "n4";
                tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.Mask.EditMask = "####";
                tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt5);
                i++;

                lt6.Text = "��Ͷ�ʣ���Ԫ��:";
                lt6.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt6);

                tt6 = new TextEdit();
                tt6.Location = new Point(157, 26 + 33 * i);
                tt6.Size = new Size(231, 21);

                tt6.Properties.DisplayFormat.FormatString = "n4";
                tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.EditFormat.FormatString = "n4";
                tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.Mask.EditMask = "#####0.####";
                tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt6);

                i++;

            int j = 0;
            foreach (PowerProYears ppy in li)
            {
                lb[j] = new Label();
                lb[j].Name = "Label" + ppy.Year;
                lb[j].Text = ppy.Year + ":";
                lb[j].Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lb[j]);

                te[j] = new TextEdit();
                te[j].Name = "Text" + ppy.Year;
                te[j].Location = new Point(157, 26 + 33 * i);
                te[j].Size = new Size(231, 21);
                groupBox1.Controls.Add(te[j]);

                foreach (PowerProValues ppy1 in listValues)
                {
                    if (ppy.Year == ppy1.Year)
                        te[j].Text = ppy1.Value;
                }
                j++;
                i++;
            }

            try
            {
                tt1.Text = q1.ToString();
                tt4.Text = q4.ToString();

            }
            catch { }

            try
            {
                tt3.Text = q3.ToString();
                tt2.Text = q2.ToString();
                tt5.Text = q5.ToString();
                tt6.Text = q6.ToString();
                tt7.Text = q7.ToString();
            }
            catch { }

            groupBox1.Size = new Size(434, 30 + 33 * i);
            simpleButton1.Location = new Point(296, 50 + 33 * i);
            simpleButton2.Location = new Point(389, 50 + 33 * i);
            this.Size = new Size(490, 130 + 33 * i);
        }
コード例 #11
0
ファイル: FrmEditStuff.cs プロジェクト: EdgarEDT/myitoppsp
        private void FrmEditProject_Load(object sender, EventArgs e)
        {
            PowerProTypes ps = (PowerProTypes)Common.Services.BaseService.GetObject("SelectPowerProTypesByCode", powerid);
            if (ps != null)
            {
                groupBox1.Text = ps.Title;
                poweruid = ps.ID;
            }

            PowerProValues ppv = new PowerProValues();
            ppv.TypeID = poweruid;
            IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv);

            PowerProYears pps = new PowerProYears();
            pps.Flag = flag;

            IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps);

            lb=new Label[li.Count];
            te=new TextEdit[li.Count];

            int i=0;
            foreach (PowerProYears ppy in li)
            {
                lb[i] = new Label();
                lb[i].Name= "Label"+ppy.Year;
                lb[i].Text = ppy.Year+":";
                lb[i].Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lb[i]);

                te[i] = new TextEdit();
                te[i].Name = "Text" + ppy.Year;
                te[i].Location = new Point(157, 26 + 33 * i);
                te[i].Size = new Size(231, 21);
                groupBox1.Controls.Add(te[i]);

                foreach (PowerProValues ppy1 in listValues)
                {
                    if (ppy.Year == ppy1.Year)
                        te[i].Text = ppy1.Value;
                }

                i++;

            }

            if (isline)
            {
                la.Text = "����";
                la.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(la);

                TextEdit ta = new TextEdit();
                ta.Location = new Point(157, 26 + 33 * i);
                ta.Size = new Size(231, 21);
                groupBox1.Controls.Add(ta);

                lb1.Text = "����";
                lb1.Location = new Point(52, 27 + 33 * (i + 1));
                groupBox1.Controls.Add(lb1);

                TextEdit tb = new TextEdit();
                tb.Location = new Point(157, 26 + 33 * (i + 1));
                tb.Size = new Size(231, 21);
                groupBox1.Controls.Add(tb);

                lc.Text = "��ѹ";
                lc.Location = new Point(52, 27 + 33 * (i + 2));
                groupBox1.Controls.Add(lc);

                TextEdit tc = new TextEdit();
                tc.Location = new Point(157, 26 + 33 * (i + 2));
                tc.Size = new Size(231, 21);
                groupBox1.Controls.Add(tc);
            }
            if(isPower)
            {
                l11.Text = "����";
                l11.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(l11);

                TextEdit t11 = new TextEdit();
                t11.Location = new Point(157, 26 + 33 * i);
                t11.Size = new Size(231, 21);
                groupBox1.Controls.Add(t11);

                l22.Text = "��ѹ�ȼ�";
                l22.Location = new Point(52, 27 + 33 * (i + 1));
                groupBox1.Controls.Add(l22);

                TextEdit t22 = new TextEdit();
                t22.Location = new Point(157, 26 + 33 * (i + 1));
                t22.Size = new Size(231, 21);
                groupBox1.Controls.Add(t22);

                l33.Text = "������";
                l33.Location = new Point(52, 27 + 33 * (i + 2));
                groupBox1.Controls.Add(l33);

                TextEdit t33 = new TextEdit();
                t33.Location = new Point(157, 26 + 33 * (i + 2));
                t33.Size = new Size(231, 21);
                groupBox1.Controls.Add(t33);
            }
        }
コード例 #12
0
ファイル: FrmEditProject.cs プロジェクト: EdgarEDT/myitoppsp
        private void FrmEditProject_Load(object sender, EventArgs e)
        {
            double? q1 = null;
            double? q2 = null;
            double? q3 = null;
            string q4 = "";
            double? q5 = null;
            double? q6 = null;
            string q7 = "";
            string q8 = "";

            string c1 = "";
            string c2 = "";
            string c3 = "";

            int t1 = 0;

            PowerProTypes ppt = new PowerProTypes();
            ppt.ID = poweruid;
            ppt.Flag2 = flag;

            PowerProTypes ps = Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt);
            if (ps != null)
            {
                groupBox1.Text = ps.Title;
                powerid = ps.Code;
                c1 = ps.StartYear.ToString();
                c2 = ps.EndYear.ToString();
                c3 = ps.Remark;
                t1 = ps.Flag;

                q1 = ps.L1;
                q2 = ps.L2;
                q3 = ps.L3;
                q4 = ps.L4;
                q5 = ps.L5;
                q6 = ps.L6;
            }

            LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid);
            if (li22 != null || t1==1)
            {
                isline = true;
            }

            substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid);
            if (sb != null || t1 == 2)
            {
                isPower = true;
            }

            PowerProValues ppv = new PowerProValues();
            ppv.TypeID = poweruid;
            ppv.TypeID1 = flag;
            IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv);

            PowerProYears pps = new PowerProYears();
            pps.Flag = flag;
            IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps);

            lb=new Label[li.Count];
            te=new TextEdit[li.Count];

            int i=0;

            if (!isPower)
            {
                lt1.Text = "����:";
                lt1.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt1);

                tt1 = new TextEdit();
                tt1.Location = new Point(157, 26 + 33 * i);
                tt1.Size = new Size(231, 21);

                tt1.Properties.DisplayFormat.FormatString = "n4";
                tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt1.Properties.EditFormat.FormatString = "n4";
                tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt1.Properties.Mask.EditMask = "#####0.####";
                tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt1);

                i++;

                lt2.Text = "�ͺ�:";
                lt2.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt2);

                tt2 = new TextEdit();
                tt2.Location = new Point(157, 26 + 33 * i);
                tt2.Size = new Size(231, 21);
                groupBox1.Controls.Add(tt2);

                i++;
            }

            if (!isline)
            {
                lt3.Text = "̨��:";
                lt3.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt3);

                tt3 = new TextEdit();
                tt3.Location = new Point(157, 26 + 33 * i);
                tt3.Size = new Size(231, 21);

                tt3.Properties.DisplayFormat.FormatString = "n0";
                tt3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt3.Properties.EditFormat.FormatString = "n0";
                tt3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt3.Properties.Mask.EditMask = "########";
                tt3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt3);

                i++;

                lt4.Text = "����:";
                lt4.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt4);

                tt4 = new TextEdit();
                tt4.Location = new Point(157, 26 + 33 * i);
                tt4.Size = new Size(231, 21);

                tt4.Properties.DisplayFormat.FormatString = "n4";
                tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt4.Properties.EditFormat.FormatString = "n4";
                tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt4.Properties.Mask.EditMask = "#####0.####";
                tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt4);
                i++;

                lt5.Text = "������(%):";
                lt5.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt5);

                tt5 = new TextEdit();
                tt5.Location = new Point(157, 26 + 33 * i);
                tt5.Size = new Size(231, 21);

                tt5.Properties.DisplayFormat.FormatString = "####.##";
                tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.EditFormat.FormatString = "####.##";
                tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt5.Properties.Mask.EditMask = "P2";
                tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt5);
                i++;

                lt6.Text = "��󸺺�:";
                lt6.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lt6);

                tt6 = new TextEdit();
                tt6.Location = new Point(157, 26 + 33 * i);
                tt6.Size = new Size(231, 21);

                tt6.Properties.DisplayFormat.FormatString = "n4";
                tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.EditFormat.FormatString = "n4";
                tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                tt6.Properties.Mask.EditMask = "#####0.####";
                tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;

                groupBox1.Controls.Add(tt6);

                i++;
            }

            int j = 0;
            foreach (PowerProYears ppy in li)
            {
                lb[j] = new Label();
                lb[j].Name = "Label" + ppy.Year;
                lb[j].Text = ppy.Year + ":";
                lb[j].Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(lb[j]);

                te[j] = new TextEdit();
                te[j].Name = "Text" + ppy.Year;
                te[j].Location = new Point(157, 26 + 33 * i);
                te[j].Size = new Size(231, 21);
                groupBox1.Controls.Add(te[j]);

                foreach (PowerProValues ppy1 in listValues)
                {
                    if (ppy.Year == ppy1.Year)
                        te[j].Text = ppy1.Value;
                }
                j++;
                i++;
            }

            if (!isstuff)
            {
                ls1.Text = "�ƻ���ʼʱ��:";
                ls1.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(ls1);

                ts1 = new TextEdit();
                ts1.Location = new Point(157, 27 + 33 * i);
                ts1.Size = new Size(231, 21);
                if (c1 == "0" || c1 == "")
                {
                    ts1.Text = "";
                }
                else
                {
                    ts1.Text = c1;
                }

                ts1.Properties.DisplayFormat.FormatString = "n0";
                ts1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ts1.Properties.EditFormat.FormatString = "n0";
                ts1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ts1.Properties.Mask.EditMask = "####";
                ts1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                groupBox1.Controls.Add(ts1);

                i++;

                ls2.Text = "Ԥ��Ͷ��ʱ��:";
                ls2.Location = new Point(52, 27 + 33 * i);
                groupBox1.Controls.Add(ls2);

                ts2 = new TextEdit();
                ts2.Location = new Point(157, 27 + 33 * i);
                ts2.Size = new Size(231, 21);

                ts2.Properties.DisplayFormat.FormatString = "n0";
                ts2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ts2.Properties.EditFormat.FormatString = "n0";
                ts2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                ts2.Properties.Mask.EditMask = "####";
                ts2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                groupBox1.Controls.Add(ts2);

                if (c2 == "0" || c2 == "")
                {
                    ts2.Text = "";
                }
                else
                {
                    ts2.Text = c2;
                }

                i++;
            }

            ls3.Text = "��ע:";
            ls3.Location = new Point(52, 27 + 33 * i);
            groupBox1.Controls.Add(ls3);

            ts3 = new TextEdit();
            ts3.Location = new Point(157, 27 + 33 * i);
            ts3.Size = new Size(231, 21);
            groupBox1.Controls.Add(ts3);
            ts3.Text = c3;

            if (isline)
            {
                try
                {
                    tt1.Text = q3.ToString();
                    tt2.Text = q4.ToString();

                    if (li22 != null)
                    {
                        tt1.Text = li22.Length;
                        tt2.Text = li22.LineType;
                    }
                }
                catch { }

            }
            if (isPower)
            {
                try
                {
                    tt3.Text = q1.ToString();
                    tt4.Text = q2.ToString();
                    tt5.Text = q5.ToString();
                    tt6.Text = q6.ToString();

                    if (sb != null)
                    {
                        tt4.Text = sb.Number.ToString();
                        tt5.Text = sb.ObligateField2;
                        tt6.Text = sb.Burthen.ToString();
                    }

                }
                catch { }
            }

            groupBox1.Size = new Size(434, 130 + 33 * i);
            simpleButton1.Location = new Point(296, 150 + 33 * i);
            simpleButton2.Location = new Point(389, 150 + 33 * i);
            this.Size = new Size(490, 230 + 33 * i);
        }