示例#1
0
        //�޸����
        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                MessageBox.Show("����ѡ���㣡");
                return;
            }
            string ParentID = treeList1.FocusedNode["ID"].ToString();
            FormHistoryTypeEdit frm = new FormHistoryTypeEdit();
            frm.Text = "�޸ķ���";
            frm.TypeTitle=treeList1.FocusedNode["TypeName"].ToString();
            frm.Remark = treeList1.FocusedNode["Remark"].ToString();
            frm.Units = treeList1.FocusedNode["Units"].ToString();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_HistoryType pf = new Ps_HistoryType();
                pf.ID = treeList1.FocusedNode["ID"].ToString();
                pf.Flag = FlagValue;
                pf.Sort = int.Parse(treeList1.FocusedNode["Sort"].ToString());
                pf.ParentID = treeList1.FocusedNode["ParentID"].ToString();
                pf.TypeName = frm.TypeTitle;
                pf.Remark = frm.Remark;
                pf.Units = frm.Units;
                // SelectPs_HistoryTypeMaxsort

                try
                {
                    Common.Services.BaseService.Update<Ps_HistoryType>(pf);
                    //�޸Ĺ���ʵ���е����Ƽ����������
                    IList<Ps_History> phlist = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryBYconnstr", " ID like '" + pf.ID+"%'");
                    for (int i = 0; i < phlist.Count; i++)
                    {

                        if (phlist[i].Title.Contains("("))
                        {
                            phlist[i].Title = pf.TypeName + phlist[i].Title.Substring(phlist[i].Title.IndexOf("("), phlist[i].Title.Length - phlist[i].Title.IndexOf("("));
                        }
                        else
                        {
                            phlist[i].Title = pf.TypeName;
                        }

                        Common.Services.BaseService.Update<Ps_History>(phlist[i]);

                    }

                    treeList1.FocusedNode["TypeName"]=frm.TypeTitle;
                    treeList1.FocusedNode["Units"] = frm.Units;
                    treeList1.FocusedNode["Remark"]=frm.Remark;
                }
                catch (Exception ex) { MsgBox.Show("�޸ķ�������" + ex.Message); }
            }
        }
示例#2
0
        //�������
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                MessageBox.Show("����ѡ���ϼ����");
                return;
            }
            string ParentID = treeList1.FocusedNode["ID"].ToString();
            FormHistoryTypeEdit frm = new FormHistoryTypeEdit();
            frm.Text = "���ӷ���";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_HistoryType pf = new Ps_HistoryType();
                pf.ID = Guid.NewGuid().ToString() + "|" + ProjectUID;
                pf.Flag = FlagValue;
                pf.ParentID = ParentID;
                pf.Sort = (int)Common.Services.BaseService.GetObject("SelectPs_HistoryTypeMaxsort", "") + 1;
                pf.TypeName = frm.TypeTitle;
                pf.Units = frm.Units;
                pf.Remark = frm.Remark;
                // SelectPs_HistoryTypeMaxsort

                try
                {
                    Common.Services.BaseService.Create<Ps_HistoryType>(pf);
                    OldId = pf.ID;
                    LoadData();
                }
                catch (Exception ex) { MsgBox.Show("���ӷ�������" + ex.Message); }
            }
        }