vb.net plz用代码指导我. [英] vb.net plz guide me with the code.

查看:99
本文介绍了vb.net plz用代码指导我.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 对于分配给40天的一年的假期,它包括所有类型的假期...现在Emp1第一次将申请2天的假期...因此,根据我的说法,该假期将从年假中扣除.....由于我已将代码写为剩余叶子=年假-无天假申请",因此现在DB假余额为38天.在下个月,Emp1将再次申请3天休假,因此现在我不打算将此休假从年度休假中扣除,而必须从剩余休假中扣除,即从38天开始.....如35天,依此类推.请用代码指导我.


致谢

Hi For one year leaves be allotted to 40 days it includes all types of leaves...now for the first time Emp1 will apply leave for 2 days...so according to me that leave will be deducted from Annual Leaves.....since i have written the code as Remaining Leaves =Annual Leave- No of Days Leave Applied, Now in DB Leave Balance will be 38 days. in the Next month again Emp1 will apply 3 days Leave so now i dnt wnt this Leave to be deducted from Annual Leaves instead it has to be deducted from Remaining Leaves i.e from 38days....and after tht in DB Remaining Leaves should be updatd as 35 days and so on. plz guide me with the code.


Thanks Regards

推荐答案

在您的数据库中,您必须保留2个字段(年度叶子已应用的叶子),因为当您比较代码中的值时,它很有用.

示例案例:
就像您说的那样,该员工有2个条目(请参见SQL表下方)
现在,
如果用户输入无效值....说50,该怎么办?你怎么处理呢?
您必须使用DB值验证用户输入.从DB&获取值暂时存储(使用静态变量等)&用于验证
顺便说一句,我是C#开发人员,所以请在下面在这里
In your database you must keep 2 fields(Annual Leaves & Leaves applied) because its useful when you compare the values in your code.

Example case :
Like you said there are 2 entries for that employee(See below the SQL table)
Now,
What if the user enter the invalid value .... say 50? How can you handle this?
You must validate the user input with DB values. Get the values from DB & store that temporarily(using static variable or something) & use it for validation
BTW I''m a C# developer so excuse me here below
If UserInput > AnnualLeaves then 'AnnualLeaves = 40 & UserInput = 50
MessageBox.Show "Input Value value greater than Annual Leaves"
Else If UserInput > RemainingLeaves then 'RemainingLeaves = AnnualLeaves - Leavesapplied = 35
MessageBox.Show "Input Value value greater than Remaining Leaves"
End if


因此,在这里您可以使用这种方法来验证2种情况.但是在您的情况下,只有一个验证(您可以执行第二个验证,但使用硬编码/固定值= 40)


So here using this way you can validate 2 cases. But in your case only one validation(You can do the 2nd validation but using hardcode/fixed value = 40)

Employee Table
Employee | Annual Leaves
------------------------
Emp1     |            40





Employee Leaves Table
Employee | Leaves applied
-------------------------
Emp1     |              2
Emp1     |              3


我们不做您的作业:它的设置是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

尝试手动操作,首先在纸上,而不是在计算机上.
完成这些工作后,您就会知道其中涉及到哪些步骤,并且应该很容易将其转换为代码.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try to do it manually, on pieces of paper first, rather than on computer.
When you have that working, you know what steps are involved, and it should be pretty easy for you to translate into code.


if(BalanceLeave = 0)
BalanceLeave = AnnualLeave-NoOfLeave
其他
BalanceLeave = BalanceLeave-NoOfDays
if(BalanceLeave=0)
BalanceLeave=AnnualLeave-NoOfLeave
else
BalanceLeave=BalanceLeave-NoOfDays


这篇关于vb.net plz用代码指导我.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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