Beispiel #1
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (!EditRight)
            {
                MsgBox.Show("��û��Ȩ�޽��д��������");
                return;
            }

            FormTypeTitleRemark frm = new FormTypeTitleRemark();
            frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            if(treeList1.FocusedNode.GetValue("S1")!=DBNull.Value)
            frm.TypeRemark = treeList1.FocusedNode.GetValue("S1").ToString();
            frm.Text = "�޸ķ�����";
            PSP_BigUser_Types psp_Type = new PSP_BigUser_Types();
            psp_Type.S1 = frm.TypeRemark;
            psp_Type.Title = frm.TypeTitle;
            psp_Type.ItemID = ItemID;
            psp_Type.S2 = Convert.ToString(treeList1.FocusedNode.GetValue("S2"));
            psp_Type.ID =Convert.ToInt32( treeList1.FocusedNode.GetValue("ID"));
            if (frm.ShowDialog() == DialogResult.OK)
            {

                psp_Type.Title = frm.TypeTitle;
                psp_Type.S1 = frm.TypeRemark;
                PSP_BigUser_Types psp_Typetemp = new PSP_BigUser_Types();
                psp_Typetemp=(PSP_BigUser_Types)Common.Services.BaseService.GetObject("SelectPSP_BigUser_TypesByTitleItemID", psp_Type);
                if (psp_Typetemp != null)
                    {
                        if (psp_Type.ID != psp_Typetemp.ID)
                        {
                            MsgBox.Show("�������û��Ѿ�����");
                            return;
                        }
                    }
                    try
                    {
                        Common.Services.BaseService.Update<PSP_BigUser_Types>(psp_Type);
                        treeList1.FocusedNode.SetValue("Title", frm.TypeTitle);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("�޸ij����" + ex.Message);
                    }
                }
        }
Beispiel #2
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!AddRight)
            {
                MsgBox.Show("��û��Ȩ�޽��д��������");
                return;
            }

            FormTypeTitleRemark frm = new FormTypeTitleRemark();
            frm.Text = "���Ӵ��û�";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PSP_BigUser_Types psp_Type = new PSP_BigUser_Types();
                PSP_BigUser_Types psp_Type2 = new PSP_BigUser_Types();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.S1 = frm.TypeRemark;

                psp_Type.ItemID = ItemID;

                if (Common.Services.BaseService.GetObject("SelectPSP_BigUser_TypesByTitleItemID", psp_Type) == null)
                {
                    try
                    {
                        psp_Type.S2 = typeFlag.ToString();
                        Common.Services.BaseService.Create("InsertPSP_BigUser_Types", psp_Type);
                        psp_Type2 = (PSP_BigUser_Types)Common.Services.BaseService.GetObject("SelectPSP_BigUser_TypesByTitleItemID", psp_Type);
                        psp_Type.ID = psp_Type2.ID;
                        dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("���Ӵ��û������" + ex.Message);
                    }
                }
                else
                {
                    psp_Type2 =(PSP_BigUser_Types)Common.Services.BaseService.GetObject("SelectPSP_BigUser_TypesByTitleItemID", psp_Type);
                    if(psp_Type2.S2.Contains(typeFlag.ToString()))
                    {
                          MsgBox.Show("�������û��Ѿ�����");
                            return;
                    }
                    else
                    {

                        psp_Type.ID = psp_Type2.ID;
                        if (psp_Type2.S2 != "")
                            psp_Type.S2 = psp_Type2.S2 + "," + typeFlag.ToString();
                        Common.Services.BaseService.Update<PSP_BigUser_Types>(psp_Type);
                        dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                    }
                }

            }
        }