123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmDepartment">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="公司部门设置";
- GetSchema();
- DepartTree.RootNodeName = GetCurrentCompany();
- Search("SearchAllDepartment");
- ]]>
- </Load>
- <EndLoad>
- <![CDATA[
- ChangeMode("Search");
- ]]>
- </EndLoad>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="Department.No_Department">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchDepartmentWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- }
- else
- {
- if(GetRight(@Title,"新增"))
- {
- ChangeMode("New");
- }
- else
- MessageBox("您没有新增公司部门设置的权限!",@Title);
- }
- }
- else
- {
- MessageBox("请输入部门编号!",@Title);
- }
- }
- ]]>
- </Enter>
- <Click>
- @Temp = ShowSearchBox("DepartmentSearch","INFOMATION",tbNo.CValue);
- if(@Temp != StringEmpty())
- {
- tbNo.CValue = @Temp;
- UpdateForm(false, "");
- if(Search("SearchDepartmentWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- }
- }
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtName" DataSource="Department.Name_Department"/>
- <IKComboBoxEx name="cbSubjection" ValueSource="Department.SubjectionID_Department" DisplaySource="Department.Name_SubDepartment" NoSource="Department.No_SubDepartment"
- DataSource="AllDepartment" ValueMember="ID_DepartmentAll" DisplayMember="Name_DepartmentAll" NoMember="No_DepartmentAll">
- <Events>
- <Reload>
- UpdateForm(false, "cbSubjection");
- Search("SearchAllDepartment");
- UpdateForm(true, "cbSubjection");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtCreator" DataSource="Department.CreateName"/><!--Declare-->
- <IKDateTimeText name="dttCreateDate" DataSource="Department.CreateDate_Department"/>
-
- <IKTextBox name="txtMender" DataSource="Department.LastModUser_DepartmentName"></IKTextBox>
- <IKDateTimeText name="dttMendeDate" DataSource="Department.LastModDate_Department"></IKDateTimeText>
-
- <IKTextBox name="txtComment" DataSource="Department.Comment_Department"/>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchDepartmentFirst", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchDepartmentPrevious", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchDepartmentNext", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchDepartmentLast", tbNo.CValue))
- {
- ChangeMode("View");
- }
- </ClickLast>
- <ClickNew>
- ;
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- </ClickModify>
- <ClickDelete>
- if(Search("SearchSubDepartment", tbNo.CValue))
- {
- if(MessageBox("该部门有下属部门,若删除此部门资料其所有下属部门的资料均会被删除,确定要删除此部门资料吗?",@Title,MB_YESNO)==DialogResult("YES"))
- {
- Delete();
- ChangeMode("Search");
- }
- }
- else
- {
- Delete();
- ChangeMode("Search");
- }
- </ClickDelete>
- <ClickPrint>
- PrintReport();
- </ClickPrint>
- <ClickAudit>
- ;
- </ClickAudit>
- <ClickUnAudit>
- ;
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- if(toolBar.ExpandForm==true)
- {
- pnRight.Visible=true;<!--PanelRight is not existed-->
- }
- else
- {
- pnRight.Visible=false;
- }
- </ClickExpand>
- </Events>
- </IKFormToolBar>
- <IKHiberaTree name="DepartTree" DisplayMember="Name_Department" ValueMember="ID_Department" NoMember="No_Department" SubjectValueMember="SubjectionID_Department" DataSource="treeDep">
- <Events>
- <DoubleClick>
- if( !Equals(DepartTree.SelectNodeNo, tbNo.CValue) )
- {
- ChangeMode("Search");
- tbNo.CValue = DepartTree.SelectNodeNo;
- ActiveControlEvent("tbNo", "Enter");
- }
- </DoubleClick>
- <RightClickItem>
- if(DepartTree.MenuItemText == "新增下属部门")
- {
- ChangeMode("Search");
- }
- else if(DepartTree.MenuItemText == "删除")
- {
- ShowMessageBox("确定要删除当前记录?","YesNo","Question");
- if(Search("SearchSubDepartment", DepartTree.SelectNodeNo))
- {
- if(MessageBox("该部门有下属部门,若删除此部门资料其所有下属部门的资料均会被删除,确定要删除此部门资料吗?",@Title,MB_YESNO)==DialogResult("YES"))
- {
- Delete();
- ChangeMode("Search");
- }
- }
- else
- {
- Delete();
- ChangeMode("Search");
- }
- }
- else if(DepartTree.MenuItemText == "查看资料")
- {
- ChangeMode("Search");
- tbNo.CValue = DepartTree.SelectNodeNo;
- ActiveControlEvent("tbNo", "Enter");
- }
- </RightClickItem>
- </Events>
- </IKHiberaTree>
- </Controls>
- <Tables>
- ;<!--TODO-->
- </Tables>
- <LockInfomation LockID="ID_Department" LockNO="No_Department" LockSearchFunction="SearchDepartmentWithNo"/>
- <ChildForms>
- <ChildForm name="DepartmentSearch" DataSource="Department" SearchFunction="SearchAllDepartmentofsub" SearchFunctionByNo="SearchDepartmentWithNo" MappingName="部门">
- <DataColumn Index="0" MappingName="#Department.No_Department" HeaderText="部门编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Department.Name_Department" HeaderText="部门名称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- </ChildForms>
- </Client>
- <Server>
- <Tables>
- <Table name="Department" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User">
- </GetSchema>
- <New CmdType="Text" CmdText=" INSERT INTO Department (ID_Department, No_Department, Name_Department, SubjectionID_Department, Level_Department, ID_Creator, CreateDate_Department, Comment_Department, SuspendDate_Department,LastModDate_Department,LastModUser_Department)
- VALUES(@ID_Department, @No_Department, @Name_Department, @SubjectionID_Department, @Level_Department, @ID_Creator, @CreateDate_Department, @Comment_Department, @SuspendDate_Department,@LastModDate_Department,@LastModUser_Department)">
- <Params>
- <Param name="@ID_Department" type="Department.ID_Department" sourceColumn="ID_Department" />
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- <Param name="@Name_Department" type="Department.Name_Department" sourceColumn="Name_Department" />
- <Param name="@SubjectionID_Department" type="Department.SubjectionID_Department" sourceColumn="SubjectionID_Department" />
- <Param name="@Level_Department" type="Department.Level_Department" sourceColumn="Level_Department" />
- <Param name="@ID_Creator" type="Department.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_Department" type="Department.CreateDate_Department" sourceColumn="CreateDate_Department" />
- <Param name="@Comment_Department" type="Department.Comment_Department" sourceColumn="Comment_Department" />
- <Param name="@SuspendDate_Department" type="Department.SuspendDate_Department" sourceColumn="SuspendDate_Department" />
-
- <Param name="@LastModUser_Department" type="Department.LastModUser_Department" sourceColumn="LastModUser_Department" />
- <Param name="@LastModDate_Department" type="Department.LastModDate_Department" sourceColumn="LastModDate_Department" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="UPDATE Department SET
- Name_Department=@Name_Department,
- ID_Creator=@ID_Creator,
- CreateDate_Department=@CreateDate_Department,
- Comment_Department=@Comment_Department,
- SuspendDate_Department=@SuspendDate_Department,
- LastModUser_Department=@LastModUser_Department,
- LastModDate_Department=@LastModDate_Department
- WHERE ID_Department=@ID_Department">
- <Params>
- <Param name="@ID_Department" type="Department.ID_Department" sourceColumn="ID_Department" />
- <Param name="@Name_Department" type="Department.Name_Department" sourceColumn="Name_Department" />
- <Param name="@ID_Creator" type="Department.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_Department" type="Department.CreateDate_Department" sourceColumn="CreateDate_Department" />
- <Param name="@Comment_Department" type="Department.Comment_Department" sourceColumn="Comment_Department" />
- <Param name="@SuspendDate_Department" type="Department.SuspendDate_Department" sourceColumn="SuspendDate_Department" />
- <Param name="@LastModUser_Department" type="Department.LastModUser_Department" sourceColumn="LastModUser_Department" />
- <Param name="@LastModDate_Department" type="Department.LastModDate_Department" sourceColumn="LastModDate_Department" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="IF Object_ID(N'tempdb..#DELETE') IS Not NULL
- DROP TABLE #DELETE
- CREATE TABLE #DELETE
- (
- ID_DELETE UNIQUEIDENTIFIER,
- LEV_DELETE INT
- )
-
- DECLARE @ID_LOC UNIQUEIDENTIFIER
- DECLARE @LEV INT
- DECLARE @TEMPLEV INT
- DECLARE @STR NVARCHAR(100)
- DECLARE @COUNTS INT
- DECLARE @COUNT INT
- SELECT @ID_LOC = A.ID_Department,@LEV = A.LEVEL_Department FROM Department A
- LEFT JOIN Department B ON A.ID_Department = B.SUBJECTIONID_Department
- WHERE A.ID_Department = @ID_Department
- SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
- EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
- DECLARE CUR CURSOR FOR SELECT B.ID_Department ,B.LEVEL_Department FROM Department A
- INNER JOIN Department B ON A.ID_Department = B.SUBJECTIONID_Department
- WHERE A.ID_Department = @ID_Department
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
- WHILE @@FETCH_STATUS = 0
- BEGIN
- SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
- EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
- FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
- END
- CLOSE CUR
- DEALLOCATE CUR
- SET @TEMPLEV = @LEV
- SELECT @COUNTS = COUNT(*) FROM (SELECT * FROM #DELETE WHERE LEV_DELETE = @TEMPLEV) COUNTS
- WHILE @COUNTS > 0
- BEGIN
- DECLARE CUR CURSOR FOR SELECT L.ID_Department,L.LEVEL_Department FROM #DELETE T
- INNER JOIN Department L ON T.ID_DELETE = L.SUBJECTIONID_Department
- WHERE T.LEV_DELETE = @TEMPLEV
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
- WHILE @@FETCH_STATUS = 0
- BEGIN
- SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
- EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
- FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
- END
- CLOSE CUR
- DEALLOCATE CUR
- SET @TEMPLEV = @TEMPLEV + 1
- SELECT @COUNTS = COUNT(*) FROM (SELECT * FROM #DELETE WHERE LEV_DELETE = @TEMPLEV) COUNTS
- END
- SELECT @COUNTS = COUNT(*) FROM #DELETE
- DECLARE CUR CURSOR FOR SELECT ID_DELETE FROM #DELETE ORDER BY LEV_DELETE DESC
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ID_LOC
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF @COUNTS != 1
- BEGIN
- SELECT @COUNT=COUNT(*) FROM LockInfoTable WHERE LockInfoTable.RecordID_LockInfoTable = @ID_LOC
- IF @COUNT != 0
- BEGIN
- CLOSE CUR
- DEALLOCATE CUR
- DROP TABLE #DELETE
- RAISERROR('子部门正在被使用,无法执行删除操作!',18,1)
- RETURN
- END
- INSERT INTO LockInfoTable (RecordID_LockInfoTable,Funcode_LockInfoTable,LoginID_LockInfoTable,UserID_LockInfoTable) VALUES (@ID_LOC,'FrmDepartment',NEWID(),NEWID())
- SET @COUNTS = @COUNTS-1
- END
- DECLARE @COU DEC(14,4) SELECT @COU = COUNT(*) FROM (SELECT * FROM Employee WHERE Employee.ID_Department=@ID_LOC) C
- IF @COU > 0
- BEGIN
- CLOSE CUR
- DEALLOCATE CUR
- DROP TABLE #DELETE
- RAISERROR('存在员工',18,19)
- RETURN
- END
- DELETE FROM Employee WHERE Employee.ID_Department=@ID_LOC
- DELETE FROM Department WHERE Department.ID_Department = @ID_LOC
- DELETE FROM LockInfoTable WHERE LockInfoTable.RecordID_LockInfoTable = @ID_LOC AND LockInfoTable.Funcode_LockInfoTable = 'FrmDepartment'
- FETCH NEXT FROM CUR INTO @ID_LOC
- END
- CLOSE CUR
- DEALLOCATE CUR
- DROP TABLE #DELETE">
- <Params>
- <Param name="@ID_Department" type="Department.ID_Department" sourceColumn="ID_Department" />
- </Params>
- </Delete>
- <FKErrorReport ErrorMessage="该部门已被引用,删除失败!"/>
- <UNIQUEErrorReport ErrorMessage="该部门编号或名称已存在,提交失败!"/>
- </Table>
- </Tables>
- <Search>
- <SearchAllDepartmentofsub CmdType="Text" CmdText="SELECT Department.No_Department,Department.Name_Department FROM Department ">
- <Tables>
- <Table name="Alldepartment" />
- </Tables>
- </SearchAllDepartmentofsub>
- <SearchTree CmdType="Text" CmdText="Select ID_Department,No_Department,'('+No_Department+')'+Name_Department As Name_Department, SubjectionID_Department From Department">
- <Tables>
- <Table name="treeDep" />
- </Tables>
- </SearchTree>
- <SearchDepartmentWithNo CmdType="Text" CmdText="SELECT A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User
- WHERE A.No_Department = @No_Department">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartmentWithNo>
- <SearchAllDepartment CmdType="Text" CmdText="SELECT A.ID_Department as ID_DepartmentAll,A.Name_Department as Name_DepartmentAll,A.No_Department as No_DepartmentAll FROM Department A order by No_Department">
- <Tables>
- <Table name="AllDepartment"/>
- </Tables>
- </SearchAllDepartment>
- <SearchDepartmentFirst CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_Department
- SELECT TOP 1 @NextNo = Department.No_Department FROM Department ORDER BY Department.No_Department
- SELECT A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User
- WHERE A.No_Department = @NextNo">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartmentFirst>
- <SearchDepartmentPrevious CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_Department
- SELECT TOP 1 @NextNo = Department.No_Department FROM Department WHERE Department.No_Department < @No_Department ORDER BY Department.No_Department Desc
- SELECT A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User
- WHERE A.No_Department = @NextNo">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartmentPrevious>
- <SearchDepartmentNext CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_Department
- SELECT TOP 1 @NextNo = Department.No_Department FROM Department WHERE Department.No_Department > @No_Department ORDER BY Department.No_Department
- SELECT A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User
- WHERE A.No_Department = @NextNo">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartmentNext>
- <SearchDepartmentLast CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_Department
- SELECT TOP 1 @NextNo = Department.No_Department FROM Department ORDER BY Department.No_Department DESC
- SELECT A.*,B.Name_Department AS Name_SubDepartment, B.No_Department AS No_SubDepartment,Y.Name_User as LastModUser_DepartmentName, U.Name_User AS CreateName FROM Department A
- LEFT JOIN Department B ON A.SubjectionID_Department = B.ID_Department
- LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
- LEFT JOIN AppUser Y ON A.LastModUser_Department = Y.ID_User
- WHERE A.No_Department = @NextNo">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartmentLast>
- <SearchSubDepartment CmdType="Text" CmdText="SELECT * FROM Department A
- INNER JOIN Department B ON A.ID_Department = B.SubjectionID_Department
- WHERE A.No_Department = @No_Department">
- <Params>
- <Param name="@No_Department" type="Department.No_Department" sourceColumn="No_Department" />
- </Params>
- <Tables>
- <Table name="DepartmentSub" />
- </Tables>
- </SearchSubDepartment>
- <SearchLevelByName CmdType="Text" CmdText="SELECT Level_Department FROM Department WHERE Name_Department = @Name_Department">
- <Params>
- <Param name="@Name_Department" type="Department.Name_Department" sourceColumn="Name_Department" />
- </Params>
- <Tables>
- <Table name="DepartmentLevel" />
- </Tables>
- </SearchLevelByName>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly=false;
- txtName.ReadOnly=true;
- txtComment.ReadOnly=true;
- cbSubjection.Enabled=false;
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- #Department.CreateDate_Department=DBNull();
- #Department.LastModDate_Department=DBNull();
- #Department.LastModUser_Department=DBNull();
- Search("SearchTree");
- UpdateForm(true, "");
- tbNo.Focus();
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly=true;
- txtName.ReadOnly=false;
- txtComment.ReadOnly=false;
- cbSubjection.Enabled=true;
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- #Department.No_Department = tbNo.CValue;
- #Department.SubjectionID_Department=DBNull();
- #Department.ID_Department=NewGuid();
- #Department.CreateName=GetCurrentUser();
- #Department.ID_Creator=GetLoginUserID();
- #Department.CreateDate_Department=DateTimeNow();
- #Department.LastModDate_Department=DBNull();
- #Department.LastModUser_Department=DBNull();
- #Department.SuspendDate_Department=DBNull();
- Search("SearchTree");
- UpdateForm(true, "");
- DepartTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);
- txtName.Focus();
- @Status=1;
- </New>
- <View>
- tbNo.ReadOnly=false;
- txtName.ReadOnly=true;
- txtComment.ReadOnly=true;
- cbSubjection.Enabled=false;
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- Search("SearchTree");
- UpdateForm(true, "");
- DepartTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);
- @Status=2;
- </View>
- <Modify>
- tbNo.ReadOnly=true;
- txtName.ReadOnly=false;
- txtComment.ReadOnly=false;
- cbSubjection.Enabled=false;
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=GetRight(@Title,"删除");
- #Department.LastModUser_DepartmentName=GetCurrentUser();
- #Department.LastModDate_Department=DateTimeNow();
- #Department.LastModUser_Department=GetLoginUserID();
- Search("SearchTree");
- UpdateForm(true, "");
- DepartTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);
- txtName.Focus();
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if(txtName.CValue==StringEmpty())
- {
- MessageBox("请输入部门名称!",@Title);
- txtName.Focus();
- return;
- }
- if(!cbSubjection.CheckSelectedItem())
- {
- MessageBox("请选择有效的隶属部门!",@Title);
- cbSubjection.Focus();
- return;
- }
- UpdateForm(false, "");
- if(@Status==1)
- {
- if(Search("SearchLevelByName",cbSubjection.SelectedName))
- {
- #Department.Level_Department=#DepartmentLevel.Level_Department+1;
- }
- else
- {
- #Department.Level_Department=0;
- }
- New();
- }
- if(@Status == 3)
- {
- #Department.LastModDate_Department=DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- </Lables>
- </Form>
- </Forms>
|