|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: |
<table border="1" class="leave">
<tr>
<th>Date Applied</th>
<td>
<asp:Label ID="lbl_dateApplied" runat="server"></asp:Label>
</td>
</tr>
<tr>
<th>Leave Type</th>
<td>
<asp:DropDownList ID="ddl_leaveType" runat="server">
<asp:ListItem Value="Annual" Selected= "True" >Annual</asp:ListItem>
<asp:ListItem Value="Medical" >Medical</asp:ListItem>
<asp:ListItem Value="Childcare" >Childcare</asp:ListItem>
<asp:ListItem Value="Maternity" >Maternity</asp:ListItem>
<asp:ListItem Value="Others" >Others</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<th>Employee Name</th>
<td>
<asp:Label ID="lbl_employeeName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<th>Department</th>
<td>
<asp:Label ID="lbl_department" runat="server"></asp:Label>
</td>
</tr>
<tr>
<th>Start date</th>
<td>
<asp:TextBox ID="tb_startDate" AutoPostBack="true" runat="server"
ontextchanged="tb_startDate_TextChanged"></asp:TextBox> <asp:ImageButton
ID="calendarIMG_1" CausesValidation="false" runat="server"
ImageUrl="~/Pages/Images/calendar1.png" onclick="calendarIMG_1_Click" /><br/>
<asp:RequiredFieldValidator runat="server" id="rfv_startDate" controltovalidate="tb_startDate" errormessage="Enter Start Date!" />
<cc1:CalendarExtender ID="CalendarExtender1" Enabled="true" TargetControlID="tb_startDate" format="MM dd yyyy" PopupButtonID="calendarIMG_1" runat="server">
</cc1:CalendarExtender>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="tb_startDate" WatermarkCssClass="watermarked" WatermarkText="(mm dd yyyy)" runat="server">
</cc1:TextBoxWatermarkExtender><br/>
<asp:Label ID="lbl_errorMsg_startDate" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<th>End date</th>
<td>
<asp:TextBox ID="tb_endDate" AutoPostBack="true" runat="server"></asp:TextBox> <asp:ImageButton
ID="calendarIMG_2" CausesValidation="false" runat="server"
ImageUrl="~/Pages/Images/calendar2.png" onclick="calendarIMG_2_Click" /><br/>
<asp:RequiredFieldValidator runat="server" id="rfv_endDate" controltovalidate="tb_endDate" errormessage="Enter End Date!" />
<cc1:CalendarExtender ID="CalendarExtender2" Enabled="true" TargetControlID="tb_endDate" format="MM dd yyyy" PopupButtonID="calendarIMG_2" runat="server">
</cc1:CalendarExtender>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" TargetControlID="tb_endDate" WatermarkCssClass="watermarked" WatermarkText="(mm dd yyyy)" runat="server">
</cc1:TextBoxWatermarkExtender><br/>
<asp:Label ID="lbl_errorMsg_endDate" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<th> </th>
<td>
<asp:DropDownList ID="ddlDateFromAmt" runat="server">
<asp:ListItem Value="0">Full Day</asp:ListItem>
<asp:ListItem Value="1">Half Day (AM)</asp:ListItem>
<asp:ListItem Value="2">Half Day (PM)</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<th>No.Of Days</th>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lbl_numDays" runat="server"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="tb_startDate"
EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="tb_enddate"
EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<th>Approver</th>
<td>
<asp:Label ID="lbl_approver" runat="server"></asp:Label>
</td>
</tr>
<tr>
<th>Remarks<br/>(optional)</th>
<td>
<asp:TextBox ID="tb_remarks" runat="server" Columns="30" Rows="10" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
code behind
============
//funtion that will calculate the number of days and reflect the value in the label
protected void CalculateNumberOfDays()
{
DateTime startTime, endTime;
if (DateTime.TryParse(tb_startDate.Text.ToString(), out startTime) == false)
{
lbl_errorMsg_startDate.Text = "Please select a valid start date.";
return;
}
if (DateTime.TryParse(tb_endDate.Text.ToString(), out endTime) == false)
{
lbl_errorMsg_endDate.Text = "Please select a valid end date.";
return;
}
if (DateTime.Compare(startTime, endTime) > 0)
{
lbl_errorMsg_startDate.Text = "Please select a valid date range.";
lbl_errorMsg_endDate.Text = "Please select a valid date range.";
return;
}
if (int.Parse(ddlDateFromAmt.SelectedValue.ToString()) == 0)
{ //reflect the calculated num of days to the label
lbl_numDays.Text = Weekdays(startTime, endTime).ToString();
}
else
{
lbl_numDays.Text = Weekdays(startTime).ToString();
}
}
int Weekdays(DateTime dtmStart, DateTime dtmEnd)
{
try
{
// This function includes the start and end date in the count if they fall on a weekday
int dowStart = ((int)dtmStart.DayOfWeek == 0 ? 7 : (int)dtmStart.DayOfWeek);
int dowEnd = ((int)dtmEnd.DayOfWeek == 0 ? 7 : (int)dtmEnd.DayOfWeek);
TimeSpan tSpan = dtmEnd - dtmStart;
if (dowStart <= dowEnd)
{
return (((tSpan.Days / 7) * 5) + Math.Max((Math.Min((dowEnd + 1), 6) - dowStart), 0));
}
else
{
return (((tSpan.Days / 7) * 5) + Math.Min((dowEnd + 6) - Math.Min(dowStart, 6), 5));
}
}
catch (Exception ex)
{
throw new Exception(ex.Source.ToString() + ":" + ex.Message.ToString() + ":" + ex.InnerException.ToString());
}
}
double Weekdays(DateTime dtmStart)
{
try
{
// This function includes the start if they fall on a weekday
if ((int)dtmStart.DayOfWeek == 6 || (int)dtmStart.DayOfWeek == 7)
return 0.0;
else
return 0.5;
}
catch (Exception ex)
{
throw new Exception(ex.Source.ToString() + ":" + ex.Message.ToString() + ":" + ex.InnerException.ToString());
}
}
|
Advertisement
| Hall of Fame |