Ejemplo n.º 1
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Econ ec = new Econ();
            ec.UID = "xxx";

            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            try
            {

                fpSpread1.Save(ms, false);

                ec.ExcelData = ms.GetBuffer();

                Services.BaseService.Update<Econ>(ec);
            }
            catch (Exception ex) { MsgBox.Show(ex.Message); }
        }
Ejemplo n.º 2
0
        private void FrmLayoutContents_Load(object sender, EventArgs e)
        {
            numberCellTypes2.DecimalPlaces = 0;
            //numberCellTypes2.FixedPoint = true;
            numberCellTypes3.DecimalPlaces = 1;

            numberCellTypes1.DecimalPlaces = 3;
            numberCellTypes1.FixedPoint = true;

            barButtonItem3.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            Econ ed=new Econ();
                        ed.UID="xxx";
                        bts = Services.BaseService.GetOneByKey<Econ>(ed).ExcelData;
            //isload = 0;

            InitForm();
            InitData();

            isloadstate = true;
            treeList1.ExpandAll();
            treeList1.MoveFirst();
        }
Ejemplo n.º 3
0
        private void SaveLayoutToXml()
        {
            string filepath1 = Path.GetTempPath();
            switch (type2)
            {
                case "66":
                    if (leixing != "����")
                    {
                        LayoutList ll = this.ctrlLayoutList1.FocusedObject;
                        if (ll == null)
                            return;

                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 +ll.UID +"RefreshDatalayout1.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = ll.UID  + "RefreshDatalayout1";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    else
                    {
                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + "RefreshDatalayout1.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = "RefreshDatalayout1";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    break;

                case "10":
                    if (leixing != "����")
                    {
                        LayoutList ll = this.ctrlLayoutList1.FocusedObject;
                        if (ll == null)
                            return;

                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + ll.UID + "RefreshDatalayout2.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = ll.UID + "RefreshDatalayout2";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    else
                    {
                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + "RefreshDatalayout2.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = "RefreshDatalayout2";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    break;
            }
        }
Ejemplo n.º 4
0
        private void barButtonItem7_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (ctrlLayoutList1.FocusedObject == null)
            //{
            //    MsgBox.Show("û�м�¼���ڣ������Ա�����ʽ��");
            //    return;
            //}
            string filepath1 = Path.GetTempPath();
            switch (type2)
            {
                case "66":
                    if (leixing != "����")
                    {
                        LayoutList ll = this.ctrlLayoutList1.FocusedObject;
                        if (ll == null)
                            return;

                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 +ll.UID +"RefreshDatalayout1.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = ll.UID+"RefreshDatalayout1";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    else
                    {
                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + "RefreshDatalayout1.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = "RefreshDatalayout1";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    break;

                case "10":
                    if (leixing != "����")
                    {
                        LayoutList ll = this.ctrlLayoutList1.FocusedObject;
                        if (ll == null)
                            return;

                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + ll.UID + "RefreshDatalayout2.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = ll.UID+ "RefreshDatalayout2";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    else
                    {
                        //this.ctrlLine_Info1.bandedGridView2.SaveLayoutToXml(filepath1 + "RefreshDatalayout2.xml");
                        MemoryStream ms = new MemoryStream();
                        this.ctrlLine_Info1.bandedGridView2.SaveLayoutToStream(ms);
                        Econ ec = new Econ();
                        ec.UID = "RefreshDatalayout2";
                        ec.ExcelData = ms.ToArray();
                        IList<Econ> list = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                        if (list.Count == 0)
                            Services.BaseService.Create<Econ>(ec);
                        else
                            Services.BaseService.Update<Econ>(ec);
                    }
                    break;
            }
        }
Ejemplo n.º 5
0
        public bool RefreshData(string type,string con)
        {
            IList<Line_Info> list = new List<Line_Info>();
            string conn = "";
            try
            {
                types1 = type;
                int dd = 0;
                if (types2 == "220")
                { dd = 220; }
                else if (types2 == "66")
                { dd = 66; }
                else if (types2 == "10")
                { dd = 10; }

                Line_Info li = new Line_Info();
                li.DY = dd;
                li.Flag = type;
                string filepath1 = "";
                Econ ec = new Econ();
                if (types2 == "220")
                {
                    conn = "Code='' and Flag='" + type + "'" + con;
                    list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn);
                    CalcTotal(ref list);
                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml");
                    if (FlagsType == "")
                        ec.UID = "RefreshDatalayout2";
                    else
                        ec.UID = FlagsType + "RefreshDatalayout2";
                }
                if (types2 == "66")
                {
                    conn = "DY>10 and 10000>=DY and AreaID='" + projectid + "' "+con;// ;
                    list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn);
                    CalcTotal(ref list);
                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml");
                    if (FlagsType == "")
                        ec.UID = "RefreshDatalayout1";
                    else
                        ec.UID = FlagsType + "RefreshDatalayout1";
                }
                if (types2 == "10")
                {
                    conn = " DY>0 and 10>=DY " + con;
                    list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn);
                    CalcTotal(ref list);
                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml");                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType + "RefreshDatalayout2.xml");
                    if (FlagsType == "")
                        ec.UID = "RefreshDatalayout2";
                    else
                        ec.UID = FlagsType + "RefreshDatalayout2";
                }
                IList<Econ> listxml = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                //if (listxml.Count != 0)
                //{
                //    MemoryStream ms = new MemoryStream(listxml[0].ExcelData);
                //    this.bandedGridView2.RestoreLayoutFromStream(ms);
                //}
                //if (types2 == "66")
                //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); }
                //else if (types2 == "10")
                //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); }

                string s = " ProjectID='" + Itop.Client.MIS.ProgUID + "'";
                IList list1 = Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", s);
                repositoryItemLookUpEdit1.DisplayMember = "Title";
                repositoryItemLookUpEdit1.NullText = "";
                repositoryItemLookUpEdit1.ValueMember = "ID";
                repositoryItemLookUpEdit1.DataSource = list1;

                //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li);
                this.gridControl.DataSource = list;
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false;
            }

            return true;
        }
Ejemplo n.º 6
0
        public void RefreshLayout()
        {
            try
            {
                string filepath1 = "";
                Econ ec = new Econ();
                if (types2 == "66")
                {

                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml");
                    if (FlagsType == "")
                        ec.UID = "RefreshDatalayout1";
                    else
                        ec.UID = FlagsType + "RefreshDatalayout1";
                }
                if (types2 == "10")
                {

                    //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType + "RefreshDatalayout2.xml");
                    if (FlagsType == "")
                        ec.UID = "RefreshDatalayout2";
                    else
                        ec.UID = FlagsType + "RefreshDatalayout2";
                }
                IList<Econ> listxml = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                if (listxml.Count != 0)
                {
                    MemoryStream ms = new MemoryStream(listxml[0].ExcelData);
                    this.bandedGridView2.RestoreLayoutFromStream(ms);
                }
            }
            catch { }
        }
        public void RefreshLayout()
        {
            try
            {
                string filepath = "";
                Econ ec = new Econ();
                IList<Substation_Info> list = Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByFlag", flags1);
                if (xmlflag == "guihua")
                    ec.UID = xmltype;
                else
                {
                    ec.UID = xmltype + "SubstationLayOut";
                }

                IList<Econ> listxml = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                if (listxml.Count != 0)
                {
                    MemoryStream ms = new MemoryStream(listxml[0].ExcelData);
                    this.bandedGridView1.RestoreLayoutFromStream(ms);
                }
            }
            catch { }
        }
        /// <summary>
        /// ˢ�±���е�����
        /// </summary>
        /// <returns>ture:�ɹ�  false:ʧ��</returns>
        public bool RefreshData1()
        {
            try
            {
                string filepath = "";
                Econ ec = new Econ();
                IList<Substation_Info> list = Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByFlag", flags1);
                if (xmlflag == "guihua")
                    ec.UID = xmltype;
                else
                {
                    ec.UID = xmltype + "SubstationLayOut";
                }

                IList<Econ> listxml = Services.BaseService.GetList<Econ>("SelectEconByKey", ec);
                if (listxml.Count != 0)
                {
                    MemoryStream ms = new MemoryStream(listxml[0].ExcelData);
                    this.bandedGridView1.RestoreLayoutFromStream(ms);
                }
                int i = 1;
                foreach (Substation_Info info in list)
                {
                    info.L23 = i.ToString();
                    i++;
                    double? l2 = info.L2;
                    double? l9 = info.L9;
                    double? l10 = info.L10;

                    try
                    {
                        if (l2 != 0)
                        {
                            l10 = l9 / l2;
                            info.L10 = l10;
                        }

                    }
                    catch { }
                }
                this.gridControl.DataSource = list;
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false;
            }
            return true;
        }
Ejemplo n.º 9
0
        private void InitData()
        {
            if (!isSelect)
            {
                switch (smmprog.ProgId)
                {
                    case "64c9efcb-e6cc-402f-b2fc-f5f6f7d296f7":
                        progName = "�������Է���";
                        type = "fhtxfx";
                        break;

                    case "a50e1781-e470-4721-a6ee-c4b1294d6bd4":
                        progName = "������������";
                        type = "dwjcsj";
                        break;

                    case "3630adcc-9d4b-4059-b44e-4f88ccf76b43":
                        progName = "�����滮������";
                        type = "dwghjc";
                        break;
                }

            }

            string s = " UID like '%|" + ProjectUID + "' and Col1='" + progName + "'";

            ilist = Services.BaseService.GetList("SelectPspTypeListByWhere", s);
            //ilist = Services.BaseService.GetList<PspType>();
            dataTable = DataConverter.ToDataTable(ilist, typeof(PspType));
            treeList1.DataSource = dataTable;

            Econ ed = new Econ();
            ed.UID = "yyy";
            try
            {
                bts = Services.BaseService.GetOneByKey<Econ>(ed).ExcelData;
            }
            catch { }
        }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            Econ ec = new Econ();
            ec.UID = "yyy";

            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            try
            {
                fpSpread1.Save(ms, false);

                ec.ExcelData = ms.GetBuffer();
                Services.BaseService.Create<Econ>(ec);
                //Services.BaseService.Update<Econ>(ec);
            }
            catch (Exception ex) { MsgBox.Show(ex.Message); }
        }
Ejemplo n.º 11
0
        private void InitData()
        {
            //if (!isSelect)
            //{
            //    switch (smmprog.ProgId)
            //    {
            //        case "64c9efcb-e6cc-402f-b2fc-f5f6f7d296f7":
            //            progName = "�������Է���";
            //            type = "fhtxfx";
            //            break;

            //        case "a50e1781-e470-4721-a6ee-c4b1294d6bd4":
            //            progName = "������������";
            //            type = "dwjcsj";
            //            break;

            //        case "3630adcc-9d4b-4059-b44e-4f88ccf76b43":
            //            progName = "�����滮������";
            //            type = "dwghjc";
            //            break;
            //    }

            //}

            PspType pt = new PspType();
            pt.Col1 = ProjectUID;
            ilist = Services.BaseService.GetList("SelectPspTypeList", pt);
            //ilist = Services.BaseService.GetList<PspType>();
            dataTable = DataConverter.ToDataTable(ilist, typeof(PspType));
            treeList1.DataSource = dataTable;

            Econ ed = new Econ();
            ed.UID = "Excel";
            try
            {
                bts = Services.BaseService.GetOneByKey<Econ>(ed).ExcelData;
            }
            catch { }
        }