Exemplo n.º 1
0
        private void AddDataToList(DataRow node, IList <PSP_P_Values> list, DataTable dt)
        {
            foreach (DataColumn col in dt.Columns)
            {
                if (col.ColumnName.IndexOf("年") > 0)
                {
                    object obj = node[col.ColumnName];
                    if (obj != DBNull.Value)
                    {
                        if (Convert.ToInt32(col.ColumnName.Replace("年", "")) < forecastReport.StartYear)
                        {
                            continue;
                        }
                        PSP_P_Values v = new PSP_P_Values();
                        v.Flag2   = Convert.ToInt32(node["Flag2"]);
                        v.TypeID  = Convert.ToInt32(node["ID"]);
                        v.Caption = node["Title"].ToString() + "," + v.TypeID;
                        v.Year    = Convert.ToInt32(col.ColumnName.Replace("年", ""));
                        v.Value   = (double)node[col.ColumnName];

                        list.Add(v);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void InitValues(PSP_Values pv, PSP_P_Values pv1)
 {
     pv1.ID     = pv.ID;
     pv1.TypeID = pv.TypeID;
     pv1.Flag2  = typeFlag2;
     pv1.Value  = pv.Value;
     pv1.Year   = pv.Year;
 }
Exemplo n.º 3
0
        //读取数据
        private void LoadValues()
        {
            PSP_P_Values PSP_P_Values = new PSP_P_Values();

            PSP_P_Values.ID = typeFlag2;//用ID字段存放Flag2的值

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

            foreach (PSP_P_Values value in listValues)
            {
                TreeListNode node = treeList1.FindNodeByFieldValue("ID", value.TypeID);
                if (node != null)
                {
                    node.SetValue(value.Year + "年", value.Value);
                }
            }
        }
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow obj = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);

            if (obj == null)
            {
                return;
            }



            PSP_P_Values ppv = new PSP_P_Values();

            ppv.Flag2         = Convert.ToInt32(obj["ID"]);
            ppv.TypeID        = 80003;
            li                = Services.BaseService.GetList <PSP_P_Values>("SelectPSP_P_ValuesByTypeIDFlag2", ppv);
            this.DialogResult = DialogResult.OK;
        }
Exemplo n.º 5
0
        private bool SaveCellValue(int year, int typeID, double value)
        {
            PSP_P_Values psp_values = new PSP_P_Values();

            psp_values.TypeID = typeID;
            psp_values.Value  = value;
            psp_values.Year   = year;
            psp_values.Flag2  = typeFlag2;

            try
            {
                Common.Services.BaseService.Update <PSP_P_Values>(psp_values);
            }
            catch (Exception ex)
            {
                MsgBox.Show("保存数据出错:" + ex.Message);
                return(false);
            }
            return(true);
        }
Exemplo n.º 6
0
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            string parentid = treeList1.FocusedNode["ParentID"].ToString();
            string flag     = treeList1.FocusedNode["flag"].ToString();


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

            if (!base.DeleteRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            if (MsgBox.ShowYesNo("是否删除分类 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                PSP_P_Types psp_Type = new PSP_P_Types();
                Class1.TreeNodeToDataObject <PSP_P_Types>(psp_Type, treeList1.FocusedNode);
                PSP_P_Values psp_Values = new PSP_P_Values();
                psp_Values.TypeID = psp_Type.ID;
                psp_Values.Flag2  = typeFlag2;

                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    Common.Services.BaseService.Update("DeletePSP_P_ValuesByType", psp_Values);

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

                    //删除后,如果同级还有其它分类,则重新计算此类的所有年份数据
                    if (brotherNode != null)
                    {
                        foreach (TreeListColumn column in treeList1.Columns)
                        {
                            if (column.FieldName.IndexOf("年") > 0)
                            {
                                CalculateSum(brotherNode, column);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.Cursor = Cursors.WaitCursor;
                    treeList1.BeginUpdate();
                    LoadData();
                    treeList1.EndUpdate();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Exemplo n.º 7
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PSP_ForecastReports ct = (PSP_ForecastReports)this.ctrlPSP_ForecastReports1.GridView.GetRow(this.ctrlPSP_ForecastReports1.GridView.FocusedRowHandle);

            if (ct == null)
            {
                return;
            }

            typeFlag2 = ct.ID;

            Form1_Fs ffs = new Form1_Fs();

            ffs.Type = type;

            if (ffs.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int       fl2 = ffs.FL2;
            bool      bl  = ffs.IsJingJi;
            Hashtable hs  = ffs.HS;

            if (hs.Count == 0)
            {
                return;
            }

            if (bl)
            {
                fl2 = 1;
                PSP_Years py = new PSP_Years();
                py.Flag = fl2;
                IList <PSP_Years> listyear = Services.BaseService.GetList <PSP_Years>("SelectPSP_YearsListByFlag", py);



                Hashtable hsa = new Hashtable();
                foreach (DictionaryEntry de3 in hs)
                {
                    PSP_Types pt = (PSP_Types)de3.Value;

                    PSP_P_Types ppta = new PSP_P_Types();
                    ppta.ID    = pt.ID;
                    ppta.Flag2 = typeFlag2;

                    IList <PSP_P_Types> listppt = Services.BaseService.GetList <PSP_P_Types>("SelectPSP_P_TypesByFlag2ID", ppta);
                    if (listppt.Count > 0)
                    {
                        continue;
                    }

                    PSP_P_Types ppt = new PSP_P_Types();
                    InitTypes(pt, ppt);
                    Services.BaseService.Create <PSP_P_Types>(ppt);

                    hsa.Add(Guid.NewGuid().ToString(), "");

                    PSP_Values pv = new PSP_Values();
                    pv.TypeID = pt.ID;

                    IList <PSP_Values> listppt1 = Services.BaseService.GetList <PSP_Values>("SelectPSP_ValuesList", pv);

                    Hashtable httss = new Hashtable();

                    foreach (PSP_Values pv1 in listppt1)
                    {
                        PSP_P_Values ppv = new PSP_P_Values();
                        InitValues(pv1, ppv);
                        try
                        {
                            Services.BaseService.Create <PSP_P_Values>(ppv);
                        }
                        catch { }
                    }
                }

                if (hsa.Count > 0)
                {
                    foreach (PSP_Years py1 in listyear)
                    {
                        PSP_P_Years ppy = new PSP_P_Years();
                        InitYears(py1, ppy);
                        try
                        {
                            Services.BaseService.Create <PSP_P_Years>(ppy);
                        }
                        catch { }
                    }
                }
            }
            else
            {
                PSP_P_Years py = new PSP_P_Years();
                py.Flag = fl2;
                IList <PSP_P_Years> listyear = Services.BaseService.GetList <PSP_P_Years>("SelectPSP_P_YearsListByFlag", py);



                Hashtable hsa = new Hashtable();
                foreach (DictionaryEntry de3 in hs)
                {
                    PSP_P_Types pt = (PSP_P_Types)de3.Value;
                    pt.Flag2 = typeFlag2;

                    IList <PSP_P_Types> listppt = Services.BaseService.GetList <PSP_P_Types>("SelectPSP_P_TypesByFlag2ID", pt);
                    if (listppt.Count > 0)
                    {
                        continue;
                    }

                    Services.BaseService.Create <PSP_P_Types>(pt);

                    hsa.Add(Guid.NewGuid().ToString(), "");

                    PSP_P_Values pv = new PSP_P_Values();
                    pv.TypeID = pt.ID;

                    IList <PSP_P_Values> listppt1 = Services.BaseService.GetList <PSP_P_Values>("SelectPSP_P_ValuesList", pv);

                    foreach (PSP_P_Values pv1 in listppt1)
                    {
                        try
                        {
                            pv1.Flag2 = typeFlag2;
                            Services.BaseService.Create <PSP_P_Values>(pv1);
                        }
                        catch { }
                    }
                }

                if (hsa.Count > 0)
                {
                    foreach (PSP_P_Years py1 in listyear)
                    {
                        try
                        {
                            py1.Flag = typeFlag2;
                            Services.BaseService.Create <PSP_P_Years>(py1);
                        }
                        catch { }
                    }
                }
            }

            Application.DoEvents();
            this.Cursor = Cursors.WaitCursor;
            treeList1.BeginUpdate();
            LoadData();
            treeList1.EndUpdate();
            this.Cursor = Cursors.Default;
        }