在数据库中保存记录 [英] Saving records in database
本文介绍了在数据库中保存记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个页面,员工必须提供保险证书,健身证明和道路税。
用户将输入上述所有3个字段的截止日期。
系统将在15天,7天,1天前和同一截止日期之前通过邮件向用户发送通知。
我想根据上面提到的通知日期在数据库中保存4个不同的日期。
任何人都可以帮我吗?
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?
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();
推荐答案
证书表
certifciatename Duedate
保险10/03/2014
Fitness 12/03/2014
rodatax 15/03/2014
预定表
5
10
0
在存储过程中计算证书的日期差异,然后按计划天数加入。您将获得匹配记录输出。
创建一个将按计划间隔运行的调度程序服务(窗口服务)。这将提取详细信息并将邮件发送给用户。
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.
你能帮我解决存储过程吗?
Could you please help me with stored procedure?
这篇关于在数据库中保存记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文