节目经理批准文件tHRough商店 [英] show manager approve documents tHRough store

查看:80
本文介绍了节目经理批准文件tHRough商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,当任何用户首次上传文件时,首先要向主管批准然后当主管批准/拒绝文件然后只批准文件然后再次经理然后经理批准/拒绝文件然后只批准文件显示到最终批准的主任



i have a scenario that when any user first upload document then this go for approval first to supervisor then when supervisor approve/reject documents then only approve documents go to manager then again when manager approve/reject document then only approve document shows to director for final approval

ALTER PROCEDURE [dbo].[ALLDOCUMNETS]
AS
  begin
 SELECT DocumentInfo.DocID as DocumentID, 
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocumentInfo.Uploadfile as FileUploaded, 
dbo.DocumentInfo.UploadedBy as UploadedBy,
dbo.Userss.Email as UserEmail,
dbo.DocType.DocType as Document, 
dbo.Department.DepType as Department ,
 dbo.Approval.AppoveBy,  
dbo.ApproveType.ApproveType as Status 
FROM dbo.Department
left JOIN dbo.DocumentInfo
ON dbo.DocumentInfo.DepID=dbo.Department.DepID 
left JOIN dbo.DocType
ON  dbo.DocumentInfo.DocTypeID=dbo.DocType.DocTypeID
 inner JOIN dbo.Userss on Userss.UserName =dbo.DocumentInfo.UploadedBy   
 inner join  dbo.Approval ON dbo.DocumentInfo.DocID = dbo.Approval.DocID INNER JOIN
 dbo.ApproveType ON dbo.Approval.ApproveID = dbo.ApproveType.ApproveID 
  AND  dbo.ApproveType.ApproveType = 'Approve'  

  end



http ://i.stack.imgur.com/w2kS6.png [ ^ ]





以上记录kanez是经理,sundus是主管



在这里我想只显示kanez批准文件显示给导演然后他将能够最终批准但是这里主管和经理文件都去了导演但我想只显示kanez文件批准文件给导演??





http:/ /i.stack.imgur.com/2yvGC.png [ ^ ]


http://i.stack.imgur.com/w2kS6.png[^]


here above record kanez is manager and sundus is supervisor

here i want to show only kanez approve documents show to director then he will be able to final approval but here both supervisor and manager documents go to director but i want to show only kanez document approve documents to director??

tables
http://i.stack.imgur.com/2yvGC.png[^]

推荐答案

嗨Ayesha,

这是一个非常有趣的问题。我想说你可以用两种方式达到你想要的效果。



第一道。

=>您在用户下没有任何管理列。拥有它是一个很好的做法。

例如:你可以在Users表中有一个manager列,并将UserId分配给column.Like。 Kanez是Sundus的经理,董事是Kanez的经理。因此,在过滤数据的同时,我们可以通过获取由此人员批准的所有文件(在这种情况下无论是谁工作的人都在主管下)轻松过滤



第二路

=>在这里,我假设DesigID是给予所有经理的唯一ID。



在这种情况下。你可以查询

if(导演)

开始

........ Where Users.DesigId==@ManagersDesigId

结束



还有很多其他可能的方法也解决这个问题。以上只是一个示例解决方案。我希望您理解上述内容。
Hi Ayesha,
This is quite an interesting question. I would like to say that you can achieve the result you want in 2 ways.

1st Way.
=> You didn't have any managerial column under users. It would be a good practise to have that.
Eg: you can have a manager column in Users table and assign the UserId to the column.Like. Kanez is manager of Sundus and Director guy is the manager of Kanez. So while filtering the data we can easily filter by getting all the documents that is approved by the person whoever is under this(in this case whoever works is under the Director)

2nd Way
=> Here I assume that the DesigID is the unique Id given to all managers.

Under this case.you can check
if(Director)
Begin
........ Where Users.DesigId==@ManagersDesigId
End

There would be many other possible ways to tackle this problem also. The above is just an example solution. I hope you understand the above.


首先,不要将批准类型存储为字符串。将id存储到可能的批准类型列表中。然后,您可以将该列表重现为代码中的枚举,使其在双方都清晰。



我认为您说要添加where子句,其中userss.username ='kanez'。这不就是你需要的吗?您正在进行大量的加入,我建议您在部门为空时使用COALESCE来返回默认值吗?当然,如果文档信息为空(这是您在文档类型上的左连接所适合的),那么你的proc是没有意义的吗?
First of all, don't store the approve type as a string. store an id to a list of possible approval types. You can then reproduce that list as an enum in code, making it clean on both sides.

I think you're saying you want to add a where clause, where userss.username = 'kanez'. Isn't that all you need ? You're doing a lot of left joining, can I suggest you also use COALESCE for when your department is null, to return a default ? Surely if document info is null ( which is what your left join on document type caters for ), then your proc is pointless ?


这篇关于节目经理批准文件tHRough商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆