|
Hello Naveen,
There are different kinds of salary structure.
1. Hourly basis pay
2. Monthy basis pay
3. Weekly basis pay
4. Bi-weekly basis pay
It also depends that you are implementing the HRMS application for which country - India or USA or any other. There are some differences in their salary structures.
And also in salary structure, you can consider some more attributes.
I have given you a short description of the salary structures. You need to study in brief if you want to implement all full features.
|
|
|
|
|
|
I don't have time to give you the table structures, but I can tell you that you want to design the solution with effective dates; meaning Emp A is currently earning 4 hrs per month towards his PTO (paid time off), next year he will be earning 4.25 hrs per month, etc.
You will need to have a background job which adds each employee's accrued hours to a current balance bucket, also you want to have an end of year job which zeros out any unused PTO (use it or lose it).
You will need to take into consideration that if Employee A is asking for a week of vacation in July, but it is only February, you will have to perform logic such as, Current Balance + future accrued balance is that enough time ?
Also take into consideration if 3 guys from the same department want to take time off the same week August to go fishing. Will you be able to run the business ?
Leave management is a tricky thing. Lots of things to consider.
Good luck.
|
|
|
|
|
We have a spec to generate PDF from HTML inputs and send as email attachments.
We were able to use the examples on the article below to accomplish that:
https://www.aspsnippets.com/Articles/iTextSharp-Generate-PDF-in-Memory-and-send-as-Email-Attachment-using-C-VBNet-and-ASPNet.aspx
The issue is that because the article uses HTMLWorker, it is extremely difficult to format data with HTMLWorker.
So, I attempted to convert HTMLWorker to XMLWorker.
Right now, it works by inserting records into the database but the email is not getting sent.
Any ideas what I am doing wrong?
Imports iTextSharp.tool.xml
Imports iTextSharp.text.pdf
Imports System.IO
Imports System.Text
Imports System.Data
Imports System.Net
Imports System.Net.Mail
Imports iTextSharp.text.html.simpleparser
Imports System.Data.SqlClient
Imports System.Runtime.CompilerServices
Partial Class _Default
Inherits System.Web.UI.Page
Private strConn As String = ConfigurationManager.ConnectionStrings("constr").ToString()
Private sqlCon As SqlConnection
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
End If
End Sub
Protected Sub Insert(ByVal sender As Object, ByVal e As EventArgs)
System.Threading.Thread.Sleep(5000)
Try
Dim table As New DataTable()
Using con = New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)
Using cmd = New SqlCommand("INSERT INTO Policies(userid,entrydate,signature, email) VALUES(@empID, @lDate,@signature, @email)", con)
Using da = New SqlDataAdapter(cmd)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("@empID", txtUserName.Text)
cmd.Parameters.AddWithValue("@lDate", txtDate.Text)
cmd.Parameters.AddWithValue("@signature", txtSignature.Text)
cmd.Parameters.AddWithValue("@email", txtEmail.Text)
da.Fill(table)
End Using
End Using
End Using
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(0) {New DataColumn(" ")})
' dt.Rows.Add(txtaffirmation.Text)
SendPDFEmail(dt)
'If the message failed at some point, let the user know
Label1.ForeColor = System.Drawing.Color.Blue
Label1.Text = "Success!<br> A copy of the completed form has been sent to your inbox. If you do not receive an email within 5 minutes (usually immediately), check your spam box."
'Reset markup controls
txtFullName.Text = ""
txtUserName.Text = ""
txtSignature.Text = ""
txtDate.Text = ""
txtEmail.Text = ""
Catch ex As Exception
'If the message failed at some point, let the user know
Label1.ForeColor = System.Drawing.Color.Red
Label1.Text = ex.Message
End Try
''reset markup controls
'ClearTextBoxes(Page)
End Sub
Private Sub SendPDFEmail(ByVal dtb As DataTable)
Dim strHtml As String
Dim memStream As New MemoryStream()
Dim strWriter As New StringWriter()
Dim FullName As String = txtFullName.Text
Dim user As String = txtUserName.Text
Dim signedName As String = txtSignature.Text
Dim lDate As String = txtDate.Text
Dim body As String = "<br />"
body = body & "<table style=""background-color:#F8F8F8"" cellspadding=""2"" border=""0"" width=""100%"" >"
For Each column As DataColumn In dtb.Columns
body = body & "<td style=""color: black"" align=""Left"">" & txtaffirmation.Text & "</td></tr></table><br>"
Next
body = body & " <br><br>"
body = body & "<table style=""background-color:#F8F8F8"" cellspadding=""2"" border=""0"" width=""100%"" >"
body = body & "<tr><td align=""left"">" & FullName & "</td>"
body = body & "<td align=""left"">" & user & "</td></tr>"
body = body & "<tr><td align=""left"">Employee Name</td>"
body = body & "<td align=""left"">Employee ID</td></tr>"
body = body & "<tr><td style=""font-family:Brush Script Std"" align=""left"">" & signedName & " </td><td align=""left"">" & " " & "</td>"
body = body & "<td align=""left"">Employee Signature</td><td align=""left"">" & " " & "</td></tr>"
body = body & "<tr><td align=""left"">" & lDate & "</td><td align=""left"">" & " " & "</td></tr>"
body = body & "<td align=""left"">Date</td><td align=""left"">" & " " & "</td></tr></table>"
strHtml = strWriter.ToString()
strWriter.Close()
strWriter.Dispose()
Dim strFileShortName As String = "test" & DateTime.Now.Ticks & ".pdf"
Dim strFileName As String = HttpContext.Current.Server.MapPath("reports\" & strFileShortName)
Dim docWorkingDocument As iTextSharp.text.Document = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4.Rotate(), 1, 1, 0, 0)
Dim srdDocToString As StringReader = Nothing
Try
Dim pdfWrite As PdfWriter
pdfWrite = PdfWriter.GetInstance(docWorkingDocument, New FileStream(strFileName, FileMode.Create))
srdDocToString = New StringReader(strHtml)
docWorkingDocument.Open()
XMLWorkerHelper.GetInstance().ParseXHtml(pdfWrite, docWorkingDocument, srdDocToString)
Catch ex As Exception
Response.Write(ex.Message)
Finally
If Not docWorkingDocument Is Nothing Then
docWorkingDocument.Close()
docWorkingDocument.Dispose()
End If
If Not srdDocToString Is Nothing Then
srdDocToString.Close()
srdDocToString.Dispose()
End If
End Try
Using memoryStream As New MemoryStream()
Dim writer As PdfWriter = PdfWriter.GetInstance(docWorkingDocument, memoryStream)
docWorkingDocument.Open()
'insert image into pdf
Dim logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/Images/fc3.png"))
logo.SetAbsolutePosition(29, 680) ' insert top left
'logo.ScaleToFit(350.0F, 300.0F) ' reduce image size
docWorkingDocument.Add(logo)
docWorkingDocument.Close()
Dim bytes As Byte() = memoryStream.ToArray()
memoryStream.Close()
Dim mm As New MailMessage("NoReply@email.com", txtEmail.Text)
mm.Subject = "From: " & txtFullName.Text
mm.Body = "Please see attached copy of your completed form. "
mm.Attachments.Add(New Attachment(New MemoryStream(bytes), user & ".pdf"))
mm.IsBodyHtml = True
Dim smtp As New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.EnableSsl = False
Dim NetworkCred As New System.Net.NetworkCredential()
NetworkCred.UserName = "myemail@gmail.com"
NetworkCred.Password = "mpassword"
smtp.UseDefaultCredentials = True
smtp.Credentials = NetworkCred
smtp.Port = 587
smtp.Send(mm)
End Using
End Sub
End Class
|
|
|
|
|
|
Hi Richard,
As always, thank you so much.
You are right about the EnableSSL. It should have been set to True.
About adding those values to config file, I have two questions.
1, you said I wouldn't need ton configure smtpclient instance,
What should it look like completely?
2, Our goal is to present user with three options, to send email using gmail, or outlook or yahoo.
I am not sure why they are doing this but if I add the smtpClient instance in config file, how do I handle the other two?
Hope I am making some sense.
|
|
|
|
|
samflex wrote: What should it look like completely?
Exactly as I posted in my previous message. The default constructor for the SmtpClient picks up the settings from the config file, so you don't need to set anything in your code.
samflex wrote: Our goal is to present user with three options, to send email using gmail, or outlook or yahoo.
In that case, the <mailSettings> element won't work. There isn't an option to load different sets of settings in different scenarios.
I'd still recommend putting the settings in the config file, so that you don't have to recompile your code if they change. But you'll need to store them differently, possibly using a custom configuration section.
How to: Create Custom Configuration Sections Using ConfigurationSection[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I made a slight change which seems to work.
I changed <system.web>...
to
<system.net>...
and then moved
<compilation debug="true" targetFramework="4.0"/>
to <system.web>...
<pre>
<system.web>
<compilation debug="true" targetframework="4.0">
Thanks for all your help as usual.
|
|
|
|
|
Sorry sir, I got pulled away from this for a moment.
Happens all the time!
Anyway, I keep getting this error:
recognized configuration section system.web/mailSettings
after adding this to the config file - exactly as you have it.
|
|
|
|
|
samflex wrote: system.web/mailSettings
samflex wrote: exactly as you have it.
Are you sure about that? Read my message again - it's <system.net> , not <system.web> .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a div which is misbehaving badly. It seems that some very long text entered into this "tableItem" is causing the icon within the div to be pushed down to the next line. How do I stop this maddening behavior?
<pre>
<div style="max-height: 175px; overflow-y: auto; width: auto;">
<table id="tblSelectedItem" runat="server">
<tbody>
<tr>
<td>
<div class='itemStyle'>
<div style='float: left; border: 0; min-width: 245px;'> </div>
<div style='display: inline-block; float: left; border: 0;'>
<img src="~/Images/search.png" id="imgSearch" alt="Select Items" runat="server" class="SearchIconStyle" />
</div>
</div>
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
</div>
.itemStyle {
border: 1px solid #cccccc;
border-radius: 6px;
display: inline-block;
padding: 3px 3px 3px 3px;
white-space: nowrap;
margin: 0;
height: 20px;
}
.SearchIconStyle {
cursor: pointer;
margin-top: 2px;
margin-right: 2px;
}
modified 3-May-17 18:20pm.
|
|
|
|
|
Which table item are you referring to ? I can't see any text in your table item.
|
|
|
|
|
I attempted to add an image, but I do not believe I was able to do that. The text gets put into the div via the code-behind, and could be anything, since it is data that comes from a database.
At any rate, I believe we have solved this issue, or come very close to solving it. For one, I believe we put in a break " ", which appears to have helped. Also, I think a good bit of the supporting JavaScript had to be modified.
Thanks all for your assistance. Have a great weekend!!
|
|
|
|
|
|
Hello,
I am looking for the suggestion to create a datagrid in ASP.NET with column value as CHECKBOX and Radio button as shown below.
Please suggest me how to implement it.
|
|
|
|
|
You have not shown anything.
Secondly, what prevents you from implementing it? Also, please set the data binding to the current data source, and DataGrid will automatically map the types of the columns to possible types. RadioButton, or CheckBox are two different types and have a different purpose. Show your data, sample input means and the table you have.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
You can do it with adding these controls to asp:TemplateField where do you stuck on this?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Hey Guys,
I have run into a small problem, we have sent a bulk email containing a link to a pdf file, a week after the bulk mail the pdf file had to be updated. My problem now is some of the recipients still viewing the cache version of the pdf, is there a way to force the browser to view the updated pdf file?
|
|
|
|
|
Probably like an image file, in which you attach a query string with the date after the file name.
name.pdf?ts=2017042601
If it ain't broke don't fix it
|
|
|
|
|
The problem is that the emails have already been sent so won't be able to add a query string.
|
|
|
|
|
Have the users clear their cache.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Maybe the web server is caching the pdf
If it ain't broke don't fix it
|
|
|
|
|
Hi,
Am using VS2008 Asp.net C#. I used Report.rdlc. I want to set A4size but 'SetPageSettings' function not enabled. It show error 'Does not contain a definition for SetPageSettings'
Below code i used
GlobalCS.sTraineeQry = sTrainQry1 + sTrainQry2 + sTrainQry3 + sTrainQry4 + sTrainQry5 + sTrainQry6 + sTrainQry7 + sTrainQry8 + sTrainQry9;
//set Processing Mode of Report as Local
ReportViewer1.ProcessingMode = ProcessingMode.Local;
//set path of the Local report
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Session_RDLC.rdlc");
dsSession dsSes = GetData(GlobalCS.sTraineeQry);//new dsSession();
//ReportDataSource reportDataSource = new ReportDataSource();
//reportDataSource.Name = "dsSession_DataTable1";
//reportDataSource.Value = dsSes.Tables[0];
ReportDataSource reportDataSource = new ReportDataSource("dsSession_DataTable1", dsSes.Tables[0]);
//ReportViewer1.LocalReport.DataSources.Clear();
System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings();
ps.Landscape = true;
ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170);
ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4;
ReportViewer1.SetPageSettings(ps);
|
|
|
|
|
HI,
I am getting the following Errors,while inserting drop down list values in sql server database
ERROR:
Server Error in '/Online_Book_Shopping' Application.
Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied.
Source Error:
Line 60: cmd.Parameters.Add(password);
Line 61: con.Open();
Line 62: int i= cmd.ExecuteNonQuery();
Line 63: con.Close();
Line 64: }
Source File: e:\Vijaya\Online_Book_Shopping\SignUp.aspx.cs Line: 62
How to solve this???Please Help???
This is my code:
aspx.cs:-
protected void btnn_Click(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
SqlCommand cmd = new SqlCommand("spRegisteruser", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter name = new SqlParameter("@name", txtusername.Text);
SqlParameter mobile = new SqlParameter("@mobile", txtmobilenumber.Text);
SqlParameter password = new SqlParameter("@password", txtpassword.Text);
SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value);
cmd.Parameters.Add(name);
cmd.Parameters.Add(dropdown);
cmd.Parameters.Add(mobile);
cmd.Parameters.Add(password);
con.Open();
int i= cmd.ExecuteNonQuery();
con.Close();
}
Sql table:-
Create Table dbo.RegisteredUsers
(
ID int identity Primary Key,
Name nvarchar(20),
Country_Name nvarchar(30),
Mobile_No bigint,
[Password] nvarchar(20)
)
Go
This is storedprocedure:-
Alter Proc spRegisteruser
@Name nvarchar(20),
@countryname nvarchar(30),
@mobile bigint,
@password nvarchar(20)
As
Begin
Insert dbo.RegisteredUsers Values(@Name,@countryname,@mobile,@password)
End
Web.config:-
<connectionstrings>
<add name="CS" connectionstring="Server=.;Initial Catalog=Sample;Integrated Security=True;">
|
|
|
|
|
The error:
Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Your code:
SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value);
Did you see it now?
You have set a parameter named @country instead of @countryname .
|
|
|
|
|