Example #1
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            BurdenMonth obj = new BurdenMonth();
            obj.UID = Guid.NewGuid().ToString() + "|" + Itop.Client.MIS.ProgUID;
            //ִ����Ӳ���
            using (FrmBurdenMonthDialog dlg = new FrmBurdenMonthDialog())
            {
                dlg.TitleName = this.gridView.GroupPanelText;
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //���¶�����뵽������
            ObjectList.Add(obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Example #2
0
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            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 k = 0; k < dts.Rows.Count; k++)
                     {
                         string year = dts.Rows[k][1].ToString();
                         //string da = dts.Rows[1][1].ToString();
                         //string jj = da.Substring(0, 2);
                         //string day = year + da.Substring(2, da.Length - 2).Replace("(", "").Replace(")", "").Replace("��", "").Replace("��", "");

                         BurdenMonth bl = new BurdenMonth();
                         bl.UID = bl.UID + "|" + Itop.Client.MIS.ProgUID;
                         bl.CreateDate = DateTime.Now;

                         bl.UpdateDate= DateTime.Now;
                         bl.BurdenYear =  int.Parse(year);
                         //try
                         //{
                         //    bl. = DateTime.Parse(year);
                         //}
                         //catch
                         //{
                         //    bl.BurdenDate = DateTime.Now;
                         //}
                         string pjt = " ProjectID='" + MIS.ProgUID + "'and Title='" + dts.Rows[k][0].ToString() + "'";
                         PS_Table_AreaWH lt = (PS_Table_AreaWH)Common.Services.BaseService.GetObject("SelectPS_Table_AreaWHByConn", pjt);
                         if (lt != null)
                         {
                             bl.AreaID = lt.ID;
                         }

                         bl.Title="BurdenYear ='" +bl.BurdenYear+"' and  uid like '%" + Itop.Client.MIS.ProgUID + "%' and AreaID='"+bl.AreaID+"'";
                         IList<BurdenMonth> lis = Common.Services.BaseService.GetList<BurdenMonth>("SelectBurdenMonthByWhere", bl.Title);

                         foreach (BurdenMonth bltemp in lis)
                         {

                             bl.UID = bltemp.UID;

                             bl.CreateDate = bltemp.CreateDate;

                             bl.UpdateDate = bltemp.UpdateDate;
                             break;

                         }

                        try{
                            bl.Month1 = double.Parse(dts.Rows[k][2].ToString());
                        }
                        catch { }
                        try{
                         bl.Month2 = double.Parse(dts.Rows[k][3].ToString());
                        }
                        catch { }
                        try{
                         bl.Month3 = double.Parse(dts.Rows[k][4].ToString());
                        }
                        catch { }
                        try{
                         bl.Month4 = double.Parse(dts.Rows[k][5].ToString());
                        }
                        catch { }
                        try{
                         bl.Month5 = double.Parse(dts.Rows[k][6].ToString());
                        }
                        catch { }
                        try{
                         bl.Month6 = double.Parse(dts.Rows[k][7].ToString());
                        }
                        catch { }
                        try{
                         bl.Month7 = double.Parse(dts.Rows[k][8].ToString());
                        }
                        catch { }
                        try{
                         bl.Month8 = double.Parse(dts.Rows[k][9].ToString());
                        }
                        catch { }
                        try{
                         bl.Month9 = double.Parse(dts.Rows[k][10].ToString());
                        }
                        catch { }
                        try{
                         bl.Month10 = double.Parse(dts.Rows[k][11].ToString());
                        }
                        catch { }
                        try{
                         bl.Month11 = double.Parse(dts.Rows[k][12].ToString());
                        }
                        catch { }
                        try{
                         bl.Month12 = double.Parse(dts.Rows[k][13].ToString());
                        }
                        catch { }

                         double minData = 0;
                         double maxData = 0;
                         double sumData = 0;

                         Common.Services.BaseService.Delete<BurdenMonth>(bl);
                         Common.Services.BaseService.Create<BurdenMonth>(bl);
                         ctrlBurdenMonth1.ObjectList.Add(bl);

                     }
                     ctrlBurdenMonth1.RefreshData();
                     UpdataChart();
                     MsgBox.Show("�ѵ���ɹ���");
                 }
             }
             catch { MsgBox.Show("�����ʽ����ȷ��"); }
        }
Example #3
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            BurdenMonth obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

            //���������һ������
            BurdenMonth objCopy = new BurdenMonth();
            DataConverter.CopyTo<BurdenMonth>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmBurdenMonthDialog dlg = new FrmBurdenMonthDialog())
            {
                dlg.TitleName = this.gridView.GroupPanelText;
                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<BurdenMonth>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Example #4
0
        //��ȡ����
        private void LoadValues()
        {
            PSP_ForecastValues psp_Value = new PSP_ForecastValues();
            psp_Value.ForecastID = forecastReport.ID;

            IList<PSP_ForecastValues> listValues = Common.Services.BaseService.GetList<PSP_ForecastValues>("SelectPSP_ForecastValuesByForecastID", psp_Value);

            if (listValues.Count == 0)
            {
                BurdenMonth bm1 = new BurdenMonth();
                bm1.BurdenYear = forecastReport.StartYear;

                BurdenMonth bm = (BurdenMonth)Common.Services.BaseService.GetObject("SelectBurdenMonthByBurdenYear", bm1);
                if (bm != null)
                {
                    //TreeListNode node = treeList1.FindNodeByFieldValue("TypeID", value.TypeID);
                    //if (node != null)
                    //{
                    //    node.SetValue(value.Year + "��", value.Value);
                    //}
                    treeList1.MoveFirst();
                    TreeListNode node = treeList1.FocusedNode;
                    node.SetValue("1��", bm.Month1);
                    node.SetValue("2��", bm.Month2);
                    node.SetValue("3��", bm.Month3);
                    node.SetValue("4��", bm.Month4);
                    node.SetValue("5��", bm.Month5);
                    node.SetValue("6��", bm.Month6);
                    node.SetValue("7��", bm.Month7);
                    node.SetValue("8��", bm.Month8);
                    node.SetValue("9��", bm.Month9);
                    node.SetValue("10��", bm.Month10);
                    node.SetValue("11��", bm.Month11);
                    node.SetValue("12��", bm.Month12);

                    double bmsum=bm.Month1+bm.Month2+bm.Month3+bm.Month4+bm.Month5+bm.Month6;
                    bmsum+=bm.Month7+bm.Month8+bm.Month9+bm.Month10+bm.Month11+bm.Month12;

                    double bmmax = Math.Max(bm.Month1, bm.Month2);
                    bmmax = Math.Max(bmmax, bm.Month3);
                    bmmax = Math.Max(bmmax, bm.Month4);
                    bmmax = Math.Max(bmmax, bm.Month5);
                    bmmax = Math.Max(bmmax, bm.Month6);
                    bmmax = Math.Max(bmmax, bm.Month7);
                    bmmax = Math.Max(bmmax, bm.Month8);
                    bmmax = Math.Max(bmmax, bm.Month9);
                    bmmax = Math.Max(bmmax, bm.Month10);
                    bmmax = Math.Max(bmmax, bm.Month11);
                    bmmax = Math.Max(bmmax, bm.Month12);

                    node.SetValue("13��", bmsum);
                    node.SetValue("14��", bmmax);
                    node.SetValue("15��", bmsum / (bmmax*12));

                }

            }

            else
            {
                foreach (PSP_ForecastValues value in listValues)
                {
                    TreeListNode node = treeList1.FindNodeByFieldValue("TypeID", value.TypeID);
                    if (node != null)
                    {
                        node.SetValue(value.Year + "��", value.Value);
                    }
                }
            }
        }