コード例 #1
0
ファイル: AddNote.cs プロジェクト: martincheng717/CareManager
        public async Task <AddNoteOutput> ExecuteAsync(AddNoteInput req)
        {
            using (var db = new SqlDatabaseEx(CommandText))
            {
                db.AddInParameter(db.Command, "@pChangeBy ", DbType.String, Environment.UserName);
                db.AddInParameter(db.Command, "@pNote ", DbType.String, req.Note);
                db.AddInParameter(db.Command, "@pAccountIdentifier", DbType.Guid, req.AccountIdentifier);
                db.AddInParameter(db.Command, "@pCareAgentName", DbType.String, req.UserFullName);
                db.AddInParameter(db.Command, "@pCareAgentUserName", DbType.String, req.CareAgentUserName);
                db.AddParameter(db.Command, "@RETURN_VALUE", DbType.Int32, ParameterDirection.ReturnValue, string.Empty, DataRowVersion.Default, null);
                await db.ExecuteNonQueryAsync();

                int noteKey;
                if (!int.TryParse(Convert.ToString(db.Command.Parameters["@RETURN_VALUE"].Value), out noteKey))
                {
                    throw new GdErrorException("Invalid NoteKey returned",
                                               new LogObject("AddNote_ExecuteAsync",
                                                             new Dictionary <string, object>
                    {
                        { "CareAgentUserName", req.CareAgentUserName },
                        { "Note", req.Note }
                    }));
                }
                return(new AddNoteOutput {
                    Notekey = noteKey
                });
            }
        }
コード例 #2
0
        public async Task <CallTransferOutput> ExecuteAsync(CallTransferInput input)
        {
            using (var db = new SqlDatabaseEx(CommandText))
            {
                db.AddInParameter(db.Command, "@pPartnerCaseToken", DbType.String, input.PartnerCaseNo);
                db.AddInParameter(db.Command, "@pPartnerCallTypeKey", DbType.Int32, input.PartnerCallTypeKey);
                db.AddInParameter(db.Command, "@pSessionID", DbType.Guid, Guid.NewGuid());
                db.AddInParameter(db.Command, "@pChangeBy", DbType.String, "Partner");
                if (!string.IsNullOrEmpty(input.AccountIdentifier))
                {
                    db.AddInParameter(db.Command, "@pAccountIdentifier", DbType.Guid, new Guid(input.AccountIdentifier));
                }
                db.AddParameter(db.Command, "@RETURN_VALUE", DbType.Int32, ParameterDirection.ReturnValue, string.Empty, DataRowVersion.Default, null);
                await db.ExecuteNonQueryAsync();

                int qMasterKey;
                if (!int.TryParse(Convert.ToString(db.Command.Parameters["@RETURN_VALUE"].Value), out qMasterKey))
                {
                    throw new GdErrorException("Invalid QMasterKey returned",
                                               new LogObject("InsertQMaster_ExecuteAsync",
                                                             new Dictionary <string, object>
                    {
                        { "PartnerCaseToken", input.PartnerCaseNo },
                        { "AccountIdentifier", input.AccountIdentifier },
                        { "PartnerCallTypeKey", input.PartnerCallTypeKey },
                    }));
                }
                return(new CallTransferOutput {
                    QMasterKey = qMasterKey
                });
            }
        }
コード例 #3
0
        public async Task <bool> ExecuteAsync(UpdateQMasterInput input)
        {
            using (var db = new SqlDatabaseEx(CommandText))
            {
                db.AddInParameter(db.Command, "@pQMasterKey", DbType.Int32, input.QMasterKey);
                db.AddInParameter(db.Command, "@pCaseID", DbType.String, input.CaseID);
                db.AddInParameter(db.Command, "@pChangeBy", DbType.String, Environment.UserName);
                await db.ExecuteNonQueryAsync(new Dictionary <string, object> {
                    { "QMasterKey", input.QMasterKey }
                });

                return(true);
            }
        }