Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have created a page where employee will have to provide Insurance certificate, fitness certificate and road tax.
User will enter due dates for all the above 3 mentioned fields.
System will send notification thru mail to user 15 days, 7 days, 1 day prior and on same due date.
I want to save 4 different dates in database based on notification dates which is mentioned above.
Can anyone help me this?

C#
private int InsertRecord()
    {
        int _retVal = -1;
        try
        {
            int _errorCode = (int)ErrorCodes.NoError;
            string _tblNM = DBStructure.TABLE_ASSET_MASTER;
            
            FieldNames[] _selFlds = new FieldNames[1];
            _selFlds[0].FieldName = DBStructure.ASSET_MASTER_CODE;

            cndCheck[] _whCnd = new cndCheck[2];

            _whCnd[0].FieldName = DBStructure.ASSET_MASTER_CODE;
            _whCnd[0].FieldType = Fieldtypes.Char;
            _whCnd[0].FirstFieldValue = AssetCode.ToString();
            _whCnd[0].ArithmeticOp = ArithmeticOperator.EQUALS;
            _whCnd[0].LogicOp = LogicalOperator.AND;

            _whCnd[1].FieldName = DBStructure.ASSET_MASTER_ACCOUNT_ID;
            _whCnd[1].FieldType = Fieldtypes.Integer;
            _whCnd[1].FirstFieldValue = UserGroupID.ToString();
            _whCnd[1].ArithmeticOp = ArithmeticOperator.EQUALS;
            
             DataSet _dsAsset = _dalAccess.Select(false, _tblNM, true, _selFlds, _whCnd, out _errorCode);

             if (_errorCode == (int)ErrorCodes.NoError)
             {
                 if (_dsAsset.Tables[0].Rows.Count > 0)
                     StatusDescription = GetGlobalResourceObject(ResorceFileName, "AssetExists").ToString();
                 else
                 {
                     RecordValues[] _newRec = new RecordValues[24];

                     _newRec[0].FieldName = DBStructure.ASSET_MASTER_CODE;
                     _newRec[0].FieldType = Fieldtypes.VarChar;
                     _newRec[0].FieldValue = AssetCode;

                     _newRec[1].FieldName = DBStructure.ASSET_MASTER_NAME;
                     _newRec[1].FieldType = Fieldtypes.VarChar;
                     _newRec[1].FieldValue = AssetName;

                     _newRec[2].FieldName = DBStructure.ASSET_MASTER_DESCRIPTION;
                     _newRec[2].FieldType = Fieldtypes.VarChar;
                     _newRec[2].FieldValue = AssetDesc;

                     _newRec[16].FieldName = DBStructure.ASSET_MASTER_INSURANCE_DUE_DATE;
                     _newRec[16].FieldType = Fieldtypes.Integer;
                     _newRec[16].FieldValue = String.IsNullOrEmpty(InsuranceDueDate.ToString()) ? null : InsuranceDueDate.ToString();

                     _newRec[17].FieldName = DBStructure.ASSET_MASTER_FITNESS_CERTIFICATION_DUE_DATE;
                     _newRec[17].FieldType = Fieldtypes.Integer;
                     _newRec[17].FieldValue = String.IsNullOrEmpty(FitnessCertificationDueDate.ToString()) ? null : FitnessCertificationDueDate.ToString();

                     _newRec[18].FieldName = DBStructure.ASSET_MASTER_ROAD_TAX_DUE_DATE;
                     _newRec[18].FieldType = Fieldtypes.Integer;
                     _newRec[18].FieldValue = String.IsNullOrEmpty(RoadTaxDueDate.ToString()) ? null : RoadTaxDueDate.ToString();
Posted
Updated 25-Feb-14 2:03am
v4
Comments
Kornfeld Eliyahu Peter 25-Feb-14 7:42am    
Have you done anything so far? Show some effort (code or searching)! As is it ain't a question...
Kornfeld Eliyahu Peter 25-Feb-14 7:59am    
Try to add this to a formatted code block inside your original question - use improve button...
Member 10395687 25-Feb-14 8:00am    
InsuranceDueDate, FitnessCertificateDate and RoadTaxDate are Due Dates
while inserting i should check due date and implement a logic so tat for each due date 4 different calculated dates shud be saved in database.

Certificate table

certifciatename Duedate
Insurance 10/03/2014
Fitness 12/03/2014
rodatax 15/03/2014


Scheduledays table
5
10
0

In the stored procedure calculate the date difference for the certificate and then do join with schedule days.you will get the matching records output.

Create a scheduler service(window service) that will run on schedule interval. that will pull the details and send mail to the user.
 
Share this answer
 
Could you please help me with stored procedure?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Mar-14 0:46am    
This is a question, not an answer. Such posts are considered as abuse.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900