Пример #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            PSP_P_Years psp_Year = new PSP_P_Years();
            psp_Year.Flag = flag2;
            psp_Year.Flag2 = 10000;
            yearValue = psp_Year.Year = (int)spinEdit1.Value;
            if(_getYearOnly)
            {
                this.DialogResult = DialogResult.OK;
                return;
            }

            try
            {
                if (Common.Services.BaseService.GetObject("SelectPSP_P_YearsByYearFlag", psp_Year) == null)
                {
                    try
                    {
                        Common.Services.BaseService.Create<PSP_P_Years>(psp_Year);
                        this.DialogResult = DialogResult.OK;
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("出错啦:" + ex.Message);
                    }
                }
                else
                {
                    MsgBox.Show("此年份已经存在,请重新输入!");
                }
            }
            catch(Exception ex)
            {
                MsgBox.Show("出错啦:" + ex.Message);
            }
        }
Пример #2
0
        private void GetFFData(int sid,string type,string title)
        {
            FormXiaoshi_Fs ffs = new FormXiaoshi_Fs();
            ffs.Type = type;
            ffs.ForecastReports = forecastReport;

            if (ffs.ShowDialog() != DialogResult.OK)
                return;

            Hashtable hs = ffs.HS;

            if (hs.Count != 3)
                return;

            int uid = (int)hs["H1"];
            TreeListNode tn = (TreeListNode)hs["H2"];
            bool bool1 = (bool)hs["H3"];

            PSP_P_Types pt=new PSP_P_Types();
            if (bool1)
            {
                PSP_Types pt1 = Services.BaseService.GetOneByKey<PSP_Types>(uid);
                InitTypes(pt1, pt);
            }
            else
            {
                pt = Services.BaseService.GetOneByKey<PSP_P_Types>(uid);
            }

            #region �趨types

            string str2 = " ID=" + sid + " and Flag='" + typeFlag + "' and Flag2='" + forecastReport.ID + "' ";
            IList listTypes = Common.Services.BaseService.GetList("SelectPSP_P_TypesByWhere", str2);
            if (listTypes.Count != 0)
            {
                PSP_P_Values ppvvv = new PSP_P_Values();
                ppvvv.TypeID = sid;
                ppvvv.Flag2 = forecastReport.ID;
                Services.BaseService.Update("DeletePSP_P_ValuesByType", ppvvv);
            }

            pt.ID = sid;
            pt.Flag2 = forecastReport.ID;
            pt.Flag = typeFlag;
            pt.Title = title;
            Services.BaseService.Create<PSP_P_Types>(pt);
            #endregion

            #region �趨year value

            Hashtable hta = new Hashtable();

            ArrayList al = new ArrayList();
            foreach (TreeListColumn tlc in tn.TreeList.Columns)
            {
                if (tlc.FieldName.IndexOf("��") >= 0)
                {
                    int year = 0;
                    try
                    {
                        year=int.Parse(tlc.FieldName.Replace("��", ""));
                    }
                    catch { }

                    if (year != 0 && year > forecastReport.EndYear)
                        continue;

                    hta.Add(Guid.NewGuid().ToString(), year);

                    try
                    {
                        PSP_P_Values pv = new PSP_P_Values();
                        pv.Year=year;
                        pv.TypeID=sid;
                        try
                        {
                            pv.Value = double.Parse(tn[tlc.FieldName].ToString());
                        }
                        catch { }
                        pv.Flag2 = forecastReport.ID;
                        Services.BaseService.Create<PSP_P_Values>(pv);
                    }
                    catch { }

                    try
                    {
                        PSP_P_Years ppy = new PSP_P_Years();
                        ppy.Flag = forecastReport.ID;
                        ppy.Flag2 = typeFlag;
                        ppy.Year = year;
                        Services.BaseService.Create<PSP_P_Years>(ppy);
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                    }
                }
            }

            for (int m = forecastReport.StartYear; m <= forecastReport.EndYear; m++)
            {
                if (!hta.ContainsValue(m))
                {
                    try
                    {
                        PSP_P_Years ppy = new PSP_P_Years();
                        ppy.Flag = forecastReport.ID;
                        ppy.Flag2 = typeFlag;
                        ppy.Year = m;
                        Services.BaseService.Create<PSP_P_Years>(ppy);
                    }
                    catch (Exception ex)
                    { //MessageBox.Show(ex.Message);
                    }

                }

            }

            #endregion

            Application.DoEvents();
            this.Cursor = Cursors.WaitCursor;
            treeList1.BeginUpdate();
            LoadData();
            treeList1.EndUpdate();
            this.Cursor = Cursors.Default;
            Compute();
            RefreshChart();
        }
Пример #3
0
 private void InitYears(PSP_Years pv, PSP_P_Years pv1)
 {
     pv1.ID = pv.ID;
     pv1.Flag = typeFlag2;
     pv1.Year = pv.Year;
 }
Пример #4
0
        //��ȡ��ʷ����
        private void LoadHistoryValue()
        {
            PSP_P_Years psp_Year = new PSP_P_Years();
            psp_Year.Flag = forecastReport.ID;
            IList<PSP_P_Years> listYears = Common.Services.BaseService.GetList<PSP_P_Years>("SelectPSP_P_YearsListByFlag", psp_Year);

            foreach (PSP_P_Years item in listYears)
            {
                dataTable.Columns.Add(item.Year + "Y", typeof(double));

                TreeListColumn column = treeList1.Columns.Add();
                column.FieldName = item.Year + "Y";
                column.Tag = item.Year;
                column.VisibleIndex = -1;
            }

            PSP_Values psp_Values = new PSP_Values();
            psp_Values.ID = forecastReport.ID;//��ID�ֶδ��Flag2��ֵ

            IList<PSP_P_Values> listValues = Common.Services.BaseService.GetList<PSP_P_Values>("SelectPSP_P_ValuesListByFlag2", psp_Values);

            foreach (PSP_P_Values value in listValues)
            {
                TreeListNode node = treeList1.FindNodeByFieldValue("ID", value.TypeID);
                if (node != null)
                {
                    node.SetValue(value.Year + "Y", value.Value);

                    if (value.Year == forecastReport.StartYear)
                    {
                        node.SetValue(value.Year + "��", value.Value);
                    }
                }
            }
        }
Пример #5
0
        private void LoadData()
        {
            if (dataTable != null)
            {
                dataTable.Columns.Clear();
                treeList1.Columns.Clear();
            }

            PSP_P_Types psp_Type = new PSP_P_Types();
            psp_Type.Flag2 = typeFlag2;
            IList listTypes = Common.Services.BaseService.GetList("SelectPSP_P_TypesByFlag2", psp_Type);

            dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_P_Types));

            treeList1.DataSource = dataTable;

            treeList1.Columns["Title"].Caption = "������";
            treeList1.Columns["Title"].Width = 180;
            treeList1.Columns["Title"].OptionsColumn.AllowEdit = false;
            treeList1.Columns["Title"].OptionsColumn.AllowSort = false;
            treeList1.Columns["Flag"].VisibleIndex = -1;
            treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false;
            treeList1.Columns["Flag2"].VisibleIndex = -1;
            treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false;

            PSP_P_Years psp_Year = new PSP_P_Years();
            psp_Year.Flag = typeFlag2;
            IList<PSP_P_Years> listYears = Common.Services.BaseService.GetList<PSP_P_Years>("SelectPSP_P_YearsListByFlag", psp_Year);

            foreach (PSP_P_Years item in listYears)
            {
                try
                {
                    AddColumn(item.Year);
                }
                catch { }
            }
            Application.DoEvents();
            try
                {
                    LoadValues();
                }
                catch { }

            treeList1.ExpandAll();
        }
Пример #6
0
        //读取历史数据
        private void LoadHistoryValue()
        {
            IList<PSP_P_Years> listYears;
            if (!formselect)
            {
                PSP_P_Years psp_Year = new PSP_P_Years();
                psp_Year.Flag = forecastReport.ID;
                listYears = Common.Services.BaseService.GetList<PSP_P_Years>("SelectPSP_P_YearsListByFlag", psp_Year);
            }

            else
            {
                PSP_P_Years psp_Year = new PSP_P_Years();

                psp_Year.Flag = forecastReport.ID;

                psp_Year.Flag2 = typeFlag;
                listYears = Common.Services.BaseService.GetList<PSP_P_Years>("SelectPSP_P_YearsListhaveflag2ByFlag", psp_Year);

            }
                foreach (PSP_P_Years item in listYears)
                {
                    try
                    {
                        dataTable2.Columns.Add(item.Year + "Y", typeof(double));

                        TreeListColumn column = treeList2.Columns.Add();
                        column.FieldName = item.Year + "Y";
                        column.Tag = item.Year;
                        column.VisibleIndex = -1;
                    }
                    catch { }
                }

                PSP_Values psp_Values = new PSP_Values();
                psp_Values.ID = forecastReport.ID;//用ID字段存放Flag2的值

                IList<PSP_P_Values> listValues = Common.Services.BaseService.GetList<PSP_P_Values>("SelectPSP_P_ValuesListByFlag2", psp_Values);

                foreach (PSP_P_Values value in listValues)
                {
                    TreeListNode node = treeList2.FindNodeByFieldValue("ID", value.TypeID);
                    if (node != null)
                    {
                        node.SetValue(value.Year + "Y", value.Value);

                        if (value.Year == forecastReport.StartYear)
                        {
                            node.SetValue(value.Year + "年", value.Value);
                        }
                    }
                }
        }
Пример #7
0
        //��ȡ��ʷ����
        private void LoadHistoryValue()
        {
            PSP_P_Years psp_Year = new PSP_P_Years();
            psp_Year.Flag = forecastReport.ID;
            IList<PSP_P_Years> listYears = Common.Services.BaseService.GetList<PSP_P_Years>("SelectPSP_P_YearsListByFlag", psp_Year);

            //Hashtable hs = new Hashtable();
            //foreach (TreeListColumn tlc in treeList1.Columns)
            //{
            //    if (!hs.ContainsKey(tlc.FieldName))
            //        hs.Add(tlc.FieldName, "");

            //}
            Hashtable ht = new Hashtable();
            foreach (PSP_P_Years item in listYears)
            {
                //if (hs.ContainsKey(item.Year + "Y"))
                //    continue;

                dataTable.Columns.Add(item.Year + "Y", typeof(double));
                TreeListColumn column = treeList1.Columns.Add();
                column.FieldName = item.Year + "Y";
                column.Tag = item.Year;
                column.VisibleIndex = -1;
                if (!ht.ContainsKey(item.Year + "Y"))
                    ht.Add(item.Year + "Y", "");
            }

            PSP_Values psp_Values = new PSP_Values();
            psp_Values.ID = forecastReport.ID;//��ID�ֶδ��Flag2��ֵ

            IList<PSP_P_Values> listValues = Common.Services.BaseService.GetList<PSP_P_Values>("SelectPSP_P_ValuesListByFlag2", psp_Values);

            foreach (PSP_P_Values value in listValues)
            {
                TreeListNode node = treeList1.FindNodeByFieldValue("ID", value.TypeID);
                if (node != null)
                {
                    if (!ht.ContainsKey(value.Year + "Y"))
                    {
                        dataTable.Columns.Add(value.Year + "Y", typeof(double));
                        TreeListColumn column = treeList1.Columns.Add();
                        column.FieldName = value.Year + "Y";
                        column.Tag = value.Year;
                        column.VisibleIndex = -1;
                        ht.Add(value.Year + "Y", "");
                    }

                    node.SetValue(value.Year + "Y", value.Value);

                    if (value.Year == forecastReport.StartYear)
                    {
                        node.SetValue(value.Year + "��", value.Value);
                    }

                }
            }
        }