Ejemplo n.º 1
0
        /// <summary>
        /// 添加子分类
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = null;

            if (intFocuses == 1)
            {
                row        = this.treeList1.FocusedNode;
                intFocuses = 0;
            }
            else if (intFocuses == 2)
            {
                row        = this.treeList2.FocusedNode;
                intFocuses = 0;
            }
            if (row == null)
            {
                return;
            }


            FormTypeTitle frm = new FormTypeTitle();

            frm.Text = "增加子分类";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                psp_Type.ParentID = row["ID"].ToString();

                psp_Type.ID = Guid.NewGuid().ToString();

                psp_Type.Forecast   = type;
                psp_Type.ForecastID = forecastReport.ID;

                psp_Type.Title = frm.TypeTitle;
                object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null);
                if (obj != null)
                {
                    psp_Type.Sort = ((int)obj) + 1;
                }
                else
                {
                    psp_Type.Sort = 1;
                }


                try
                {
                    Common.Services.BaseService.Create <Ps_Forecast_Math>(psp_Type);
                    //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_P_Types", psp_Type);
                    dataTable1.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable1.NewRow()));
                    dataTable2.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable2.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }
                RefreshChart();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改分类名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = null;

            if (intFocuses == 1)
            {
                row        = this.treeList1.FocusedNode;
                intFocuses = 0;
            }
            else if (intFocuses == 2)
            {
                row        = this.treeList2.FocusedNode;
                intFocuses = 0;
            }
            if (row == null)
            {
                return;
            }


            string parentid = row["ParentID"].ToString();


            FormTypeTitle frm = new FormTypeTitle();

            frm.TypeTitle = row["Title"].ToString();
            frm.Text      = "修改分类名";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                ForecastClass1.TreeNodeToDataObject(psp_Type, row);


                //psp_Type = Itop.Common.DataConverter.RowToObject<Ps_Forecast_Math>(row);
                psp_Type.Title = frm.TypeTitle;

                try
                {
                    Common.Services.BaseService.Update <Ps_Forecast_Math>(psp_Type);
                    row.SetValue("Title", frm.TypeTitle);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("修改出错:" + ex.Message);
                }
                LoadData();
                RefreshChart();
            }
        }
Ejemplo n.º 3
0
        private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (treeList1.FocusedNode.ParentNode == null)
            {
                MsgBox.Show("一级分类名称不能修改!");
                return;
            }
            ////FrmEditProject5 frm = new FrmEditProject5();

            ////frm.FlagId = typeFlag2.ToString();
            ////frm.Type = type;
            ////frm.PowerUId = treeList1.FocusedNode["ID"].ToString();
            ////frm.Isupdate = true;
            FormTypeTitle frm = new FormTypeTitle();
            frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            frm.Text = "修改项目名";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PSP_Types psp_Type = new PSP_Types();
                Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode);
                psp_Type.Title = frm.TypeTitle;

                try
                {
                    Common.Services.BaseService.Update<PSP_Types>(psp_Type);
                    treeList1.FocusedNode.SetValue("Title", frm.TypeTitle);
                }
                catch (Exception ex)
                {
                    //MsgBox.Show("修改出错:" + ex.Message);
                }
            }
            ReLoad();
        }
Ejemplo n.º 4
0
        private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PSP_Types psp_Type = new PSP_Types();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = (int)focusedNode.GetValue("Flag");
                psp_Type.Flag2 = (int)focusedNode.GetValue("Flag2");
                psp_Type.ParentID = (int)focusedNode.GetValue("ID");

                try
                {
                    psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加子项目出错:" + ex.Message);
                }
            }
        }
Ejemplo n.º 5
0
        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //typeFlag2 = this.ctrlPSP_EachList1.FocusedObject.UID;
            //if (this.ctrlPSP_EachList1.FocusedObject == null)
            //{
            //    MsgBox.Show("没有指定的项目存在,请先添加项目分类管理!");
            //    return;
            //}
            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "增加项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PSP_Types psp_Type = new PSP_Types();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = 0;
                psp_Type.Flag2 = typeFlag2;
                psp_Type.ParentID = 0;

                try
                {
                    psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
              //  ReLoad();
        }
Ejemplo n.º 6
0
        private void barButtonItem23_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = this.treeList1.FocusedNode;
            if (row == null)
            {
                return;
            }

            string parentid = row["ParentID"].ToString();

            FormTypeTitle frm = new FormTypeTitle();
            frm.TypeTitle = row["Title"].ToString();
            frm.Text = "�޸ķ�����";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                ForecastClass1.TreeNodeToDataObject(psp_Type, row);

                //psp_Type = Itop.Common.DataConverter.RowToObject<Ps_Forecast_Math>(row);
                psp_Type.Title = frm.TypeTitle;

                try
                {
                    Common.Services.BaseService.Update<Ps_Forecast_Math>(psp_Type);
                    row.SetValue("Title",frm.TypeTitle);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("�޸ij����" + ex.Message);
                }
                RefreshChart();
            }
        }
Ejemplo n.º 7
0
        private void barButtonItem15_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = this.treeList1.FocusedNode;
            if (row == null)
            {
                return;
            }

            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "�����ӷ���";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                psp_Type.ParentID = row["ID"].ToString();

                psp_Type.ID = Guid.NewGuid().ToString();

                psp_Type.Forecast = 0;
                psp_Type.ForecastID = forecastReport.ID;

                psp_Type.Title = frm.TypeTitle;
                object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null);
                if (obj != null)
                    psp_Type.Sort = ((int)obj) + 1;
                else
                    psp_Type.Sort = 1;

                try
                {
                    Common.Services.BaseService.Create<Ps_Forecast_Math>(psp_Type);
                    //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_P_Types", psp_Type);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));

                }
                catch (Exception ex)
                {
                    MsgBox.Show("���ӷ�������" + ex.Message);
                }
                RefreshChart();
            }
        }
Ejemplo n.º 8
0
        private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            //if (treeList1.FocusedNode.ParentNode == null)
            //{
            //    MsgBox.Show("一级分类名称不能修改!");
            //    return;
            //}

            FormTypeTitle frm = new FormTypeTitle();
            frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            frm.Text = "修改项目名";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                try
                {

                PowerProTypes psp_Type = Services.BaseService.GetOneByKey<PowerProTypes>(treeList1.FocusedNode["ID"].ToString());
                psp_Type.Title = frm.TypeTitle;

                    Common.Services.BaseService.Update<PowerProTypes>(psp_Type);
                    treeList1.FocusedNode.SetValue("Title", frm.TypeTitle);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("修改出错:" + ex.Message);
                }
            }
        }
Ejemplo n.º 9
0
        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "增加项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerProTypes psp_Type = new PowerProTypes();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = 0;
                psp_Type.Flag2 = typeFlag2;
                psp_Type.ParentID = "0";

                try
                {
                    psp_Type.ID = Common.Services.BaseService.Create("InsertPowerProTypes", psp_Type).ToString();
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            int count = 0;
            string parentid = "";
            if (treeList1.FocusedNode != null)
            {
                parentid = treeList1.FocusedNode["ParentID"].ToString();
            }

            object objs = Services.BaseService.GetObject("SelectPowerEachTotalBySortID", parentid);
            if (objs != null)
                count = (int)objs;

            //PowerEachTotal obj = new PowerEachTotal();
            //obj.SortID = count + 1;
            //obj.ParentID = parentid;
            //obj.PowerLineUID = lineuid;

            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "������Ŀ";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerEachTotal obj = new PowerEachTotal();
                obj.UID = Guid.NewGuid().ToString();
                obj.SortID = count + 1;
                obj.ParentID = parentid;
                obj.PowerLineUID = lineuid;
                obj.StuffName = frm.TypeTitle;

                try
                {
                    Services.BaseService.Create<PowerEachTotal>(obj);
                    dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
                    //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPowerTypes", psp_Type);
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("������Ŀ�����" + ex.Message);
                }
            }

            //using (FrmPowerEachTotalDialog dlg = new FrmPowerEachTotalDialog())
            //{
            //    dlg.IsCreate = true;    //�����½���־
            //    dlg.Object = obj;
            //    if (dlg.ShowDialog() != DialogResult.OK)
            //    {
            //        return;
            //    }
            //}

            //dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            if (treeList1.FocusedNode == null)
                return;

            string uid = treeList1.FocusedNode["UID"].ToString();
            PowerEachTotal obj = Services.BaseService.GetOneByKey<PowerEachTotal>(uid);
            //PowerEachTotal objCopy = new PowerEachTotal();
            //DataConverter.CopyTo<PowerEachTotal>(obj, objCopy);

            FormTypeTitle frm = new FormTypeTitle();
            frm.Text = "�޸���Ŀ";
            frm.TypeTitle = obj.StuffName;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                obj.StuffName = frm.TypeTitle;
                try
                {
                    Services.BaseService.Update<PowerEachTotal>(obj);
                    treeList1.FocusedNode.SetValue("StuffName", obj.StuffName);
                    //dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
                    //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPowerTypes", psp_Type);
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("������Ŀ�����" + ex.Message);
                }
            }

            //////Services.BaseService.Update<PowerEachTotal>(obj);

            //////FrmPowerEachTotalDialog dlg = new FrmPowerEachTotalDialog();
            //////dlg.Object = objCopy;

            //////if (dlg.ShowDialog() != DialogResult.OK)
            //////{
            //////    return;
            //////}

            //DataConverter.CopyTo<PowerEachTotal>(objCopy, obj);
            //treeList1.FocusedNode.SetValue("StuffName", obj.StuffName);
            //treeList1.FocusedNode.SetValue("LCount", obj.LCount);
            //treeList1.FocusedNode.SetValue("Lengths", obj.Lengths);
            //treeList1.FocusedNode.SetValue("Volume", obj.Volume);
            //treeList1.FocusedNode.SetValue("Type", obj.Type);
            //treeList1.FocusedNode.SetValue("Total", obj.Total);
            //treeList1.FocusedNode.SetValue("Remark", obj.Remark);
            //treeList1.FocusedNode.SetValue("IsSum", obj.IsSum);
            //treeList1.FocusedNode.SetValue("ItSum", obj.ItSum);
        }