public override void Update(ContractNote item)
 {
     if (item.ID == 0)
     {
         throw new ArgumentNullException("Item.InvoiceGrpId", "An item InvoiceGrpId was provided for the update.");
     }
     try
     {
         string sql = String.Format("update {0}.contract_note set "
                                    + "  contract_id = :contract_id "
                                    + "  ,added_dt = sysdate "
                                    + "  ,added_by = user "
                                    + "  ,note = :note "
                                    + "where contract_note_id = :contract_note_id"
                                    , SchemaName);
         List <OracleParameter> parameters = new List <OracleParameter>();
         parameters.Add(OracleHelper.CreateParameter(":contract_note_id", item.ID, OracleType.Int32, ParameterDirection.InputOutput));
         parameters.Add(OracleHelper.CreateParameter(":contract_id", item.ContractID, OracleType.Int32, ParameterDirection.Input));
         parameters.Add(OracleHelper.CreateParameter(":note", item.Note, OracleType.VarChar, ParameterDirection.Input));
         OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
     }
     catch (OracleException ex)
     {
         throw ex;
     }
 }
        public override void Remove(ContractNote item)
        {
            string sql = String.Format("delete {0}.contract_note where contract_note_id = :contract_note_id", SchemaName);

            OracleParameter[] p = { OracleHelper.CreateParameter(":contract_note_id", item.ID, OracleType.Int32, ParameterDirection.Input) };
            OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, p);
        }
        /// <summary>
        /// Add & Edit Contract Notes Info data
        /// </summary>
        /// <param name="contractNotes"></param>
        /// <returns>contractNoteId</returns>
        public ContractNote AddEditContractNote(ContractNote contractNotes)
        {
            ContractNote note = new ContractNote();

            //Checks if input request is not null
            if (contractNotes != null)
            {
                _cmd = _db.GetStoredProcCommand("AddEditContractNotes");
                // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
                _db.AddInParameter(_cmd, "@ContractNoteID ", DbType.Int64, contractNotes.ContractNoteId);
                _db.AddInParameter(_cmd, "@ContractID ", DbType.Int64, contractNotes.ContractId);
                _db.AddInParameter(_cmd, "@Status", DbType.Int32, contractNotes.Status);
                _db.AddInParameter(_cmd, "@NoteText", DbType.String, contractNotes.NoteText.ToTrim());
                _db.AddInParameter(_cmd, "@UserName", DbType.String, contractNotes.UserName.ToTrim());
                // Retrieve the results of the Stored Procedure in Datatable
                DataSet contractNotesDataSet = _db.ExecuteDataSet(_cmd);

                if (contractNotesDataSet.IsTableDataPopulated(0))
                {
                    string localDateTime = Utilities.GetLocalTimeString(contractNotes.CurrentDateTime,
                                                                        Convert.ToDateTime(contractNotesDataSet.Tables[0].Rows[0]["InsertDate"].ToString()));
                    note.ContractNoteId = long.Parse(contractNotesDataSet.Tables[0].Rows[0]["InsertedId"].ToString());
                    note.InsertDate     = Convert.ToDateTime(localDateTime);
                }
            }
            //returns response to Business layer
            return(note);
        }
Exemple #4
0
 /// <summary>
 /// New Note
 /// </summary>
 public void NewNote()
 {
     CurrentNote = new ContractNote(0, _contractId, DateTime.Now, UserId, "<Type Text Here>");
     ContractNotes.Add(CurrentNote);
     IndexText = (ContractNotes.IndexOf(_currentNote) + 1).ToString() + " of " + ContractNotes.Count.ToString();
     OnPropertyChanged("ContractNotes");
 }
 protected override void RowConverter(ContractNote item, DataRow row)
 {
     item.AddedBy    = row["added_by"].ToString();
     item.ContractID = int.Parse(row["contract_id"].ToString());
     item.DateAdded  = DateTime.Parse(row["added_dt"].ToString());
     item.ID         = int.Parse(row["contract_note_id"].ToString());
     item.Note       = row["note"].ToString();
 }
        public JsonResult DeleteContractNotes(int id)
        {
            ContractNote contractNotes = new ContractNote {
                ContractNoteId = id, UserName = GetCurrentUserName()
            };
            //Get the UserName logged in
            bool isSuccess = PostApiResponse <bool>("ContractNote", "DeleteContractNoteById", contractNotes);

            return(Json(new { sucess = isSuccess }));
        }
        public void AddEditContractNoteIfNull()
        {
            var mockAddEditContractNote = new Mock <IContractNoteRepository>();

            mockAddEditContractNote.Setup(f => f.AddEditContractNote(It.IsAny <ContractNote>())).Returns(new ContractNote {
                ContractNoteId = 1
            });
            ContractNoteLogic target = new ContractNoteLogic(mockAddEditContractNote.Object);

            ContractNote actual = target.AddEditContractNote(null);

            Assert.IsNotNull(actual);
        }
        public void DeleteContractNoteByIdMockTest1()
        {
            var          mockDeleteContractNoteById = new Mock <IContractNoteRepository>();
            ContractNote objDeleteContractNotes     = new ContractNote {
                ContractNoteId = 1, UserName = "******"
            };

            mockDeleteContractNoteById.Setup(f => f.DeleteContractNote(objDeleteContractNotes)).Returns(true);
            ContractNoteLogic target = new ContractNoteLogic(mockDeleteContractNoteById.Object);

            bool actual = target.DeleteContractNote(objDeleteContractNotes);

            Assert.AreEqual(true, actual);
        }
        public override ContractNote Get(ContractNote item)
        {
            string sql = String.Format("select  contract_note_id, contract_id, added_dt, added_by, note \r\n"
                                       + "from    {0}.contract_note \r\n"
                                       + "where   contract_note_id = :contract_note_id"
                                       , SchemaName);

            OracleParameter[] p  = { OracleHelper.CreateParameter(":contract_note_id", item.ID, OracleType.Int32, ParameterDirection.Input) };
            DataTable         dt = OracleHelper.ExecuteQuery(base.ConnectionString.Value, sql, p);

            if (dt.Rows.Count > 0)
            {
                return(ConvertDataTableToList(dt)[0]);
            }
            else
            {
                throw new RowNotInTableException("The note was not found.");
            }
        }
        /// <summary>
        ///  Delete Contract Note By Id
        /// </summary>
        /// <param name="contractNotes"></param>
        /// <returns>returnvalue</returns>
        public bool DeleteContractNote(ContractNote contractNotes)
        {
            //holds the response data
            bool returnvalue = false;

            // Initialize the Stored Procedure
            _cmd = _db.GetStoredProcCommand("DeleteContractNotesByID");
            // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
            _db.AddInParameter(_cmd, "@ContractNoteId ", DbType.Int64, contractNotes.ContractNoteId);
            _db.AddInParameter(_cmd, "@UserName ", DbType.String, contractNotes.UserName);
            // Retrieve the results of the Stored Procedure in Datatable
            int updatedRow = _db.ExecuteNonQuery(_cmd);

            //returns response to Business layer
            if (updatedRow > 0)
            {
                returnvalue = true;
            }
            //returns false if any exception occurs
            return(returnvalue);
        }
        public JsonResult SaveContractNotes(ContractNotesViewModel info)
        {
            ContractNote note = AutoMapper.Mapper.Map <ContractNotesViewModel, ContractNote>(info);

            //Get the Name of User logged in
            note.UserName = GetCurrentUserName();
            ContractNote responseNote = PostApiResponse <ContractNote>("ContractNote", "AddEditContractNote", note);

            if (responseNote.ContractNoteId > 0)
            {
                return
                    (Json(
                         new
                {
                    sucess = true,
                    Id = responseNote.ContractNoteId,
                    userName = note.UserName,
                    insertedTime = Convert.ToDateTime(responseNote.InsertDate).ToString(Constants.DateTimeFormatWithSecond)
                }));
            }
            return(Json(new { sucess = false }));
        }
Exemple #12
0
        public ContractNote Save([FromBody] ContractNote contractNote)
        {
            if (contractNote.Id == 0)
            {
                contractNote.NoteDate = DateTime.Now;
                contractNote.AuthorId = _sessionContext.UserId;
            }

            ModelState.Clear();
            TryValidateModel(contractNote);
            ModelState.Validate();

            if (contractNote.Id > 0)
            {
                _repository.Update(contractNote);
            }
            else
            {
                _repository.Insert(contractNote);
            }

            return(contractNote);
        }
        public override void Add(ContractNote item)
        {
            string sql = String.Format("insert into {0}.contract_note "
                                       + "  (contract_note_id "
                                       + "  ,contract_id                        ,added_dt "
                                       + "  ,added_by                           ,note) "
                                       + "values "
                                       + "  ({0}.contract_note_id.nextval "
                                       + "  ,:contract_id                       ,:added_dt"
                                       + "  ,:added_by                               ,:note) "
                                       + "returning contract_note_id into :contract_note_id"
                                       , SchemaName);
            List <OracleParameter> parameters = new List <OracleParameter>();

            parameters.Add(OracleHelper.CreateParameter(":contract_note_id", null, OracleType.Int32, ParameterDirection.InputOutput));
            parameters.Add(OracleHelper.CreateParameter(":contract_id", item.ContractID, OracleType.Int32, ParameterDirection.Input));
            parameters.Add(OracleHelper.CreateParameter(":added_dt", item.DateAdded, OracleType.Timestamp, ParameterDirection.Input));
            parameters.Add(OracleHelper.CreateParameter(":added_by", item.AddedBy, OracleType.NVarChar, ParameterDirection.Input));
            parameters.Add(OracleHelper.CreateParameter(":note", item.Note, OracleType.VarChar, ParameterDirection.Input));
            OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());

            item.ID = int.Parse(parameters[0].Value.ToString());
        }
        /// <summary>
        /// Gets the contract full information.
        /// </summary>
        /// <param name="contractInfo">The contract information.</param>
        /// <returns></returns>
        public ContractFullInfo GetContractFullInfo(Contract contractInfo)
        {
            //holds the response object
            ContractFullInfo contractFullInfo = new ContractFullInfo();

            // Initialize the Stored Procedure
            _cmd = _db.GetStoredProcCommand("GetContractFullInfo");
            // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
            _db.AddInParameter(_cmd, "@NodeID", DbType.Int64, contractInfo.ContractId);
            _db.AddInParameter(_cmd, "@FacilityId", DbType.Int32, contractInfo.FacilityId);
            _db.AddInParameter(_cmd, "@UserName", DbType.String, contractInfo.UserName);

            // Retrieve the results of the Stored Procedure in Dataset
            DataSet contractDataSet = _db.ExecuteDataSet(_cmd);

            //Check if output result tables exists or not
            if (contractDataSet != null && contractDataSet.Tables.Count > 0)
            {
                //populating ContractBasicInfo data
                if (contractDataSet.Tables[0].Rows != null && contractDataSet.Tables[0] != null && contractDataSet.Tables[0].Rows.Count > 0)
                {
                    contractFullInfo.ContractBasicInfo = new Contract
                    {
                        ContractId =
                            Convert.ToInt64(
                                contractDataSet.Tables[0].Rows[0]["ContractId"]),
                        InsertDate =
                            DBNull.Value ==
                            contractDataSet.Tables[0].Rows[0]["InsertDate"]
                                ? (DateTime?)null
                                : Convert.ToDateTime(
                                contractDataSet.Tables[0].Rows[0]["InsertDate"]),
                        UpdateDate =
                            DBNull.Value ==
                            contractDataSet.Tables[0].Rows[0]["UpdateDate"]
                                ? (DateTime?)null
                                : Convert.ToDateTime(
                                contractDataSet.Tables[0].Rows[0]["UpdateDate"]),
                        ContractName =
                            Convert.ToString(
                                contractDataSet.Tables[0].Rows[0]["ContractName"]),
                        StartDate =
                            Convert.ToDateTime(
                                contractDataSet.Tables[0].Rows[0]["StartDate"]),
                        EndDate =
                            Convert.ToDateTime(
                                contractDataSet.Tables[0].Rows[0]["EndDate"]),
                        FacilityId =
                            Convert.ToInt32(
                                contractDataSet.Tables[0].Rows[0]["FacilityId"]),
                        Status =
                            DBNull.Value != contractDataSet.Tables[0].Rows[0]["Status"] &&
                            Convert.ToInt32(contractDataSet.Tables[0].Rows[0]["Status"]) ==
                            1,
                        IsClaimStartDate =
                            DBNull.Value != contractDataSet.Tables[0].Rows[0]["IsClaimStartDate"] &&
                            Convert.ToInt32(contractDataSet.Tables[0].Rows[0]["IsClaimStartDate"]) ==
                            1,
                        IsContractServiceTypeFound =
                            DBNull.Value != contractDataSet.Tables[0].Rows[0]["IsContractServiceTypeFound"] &&
                            Convert.ToInt32(contractDataSet.Tables[0].Rows[0]["IsContractServiceTypeFound"]) ==
                            1,
                        IsProfessional =
                            DBNull.Value != contractDataSet.Tables[0].Rows[0]["IsProfessionalClaim"] &&
                            Convert.ToInt32(contractDataSet.Tables[0].Rows[0]["IsProfessionalClaim"]) ==
                            1,
                        IsInstitutional =
                            DBNull.Value != contractDataSet.Tables[0].Rows[0]["IsInstitutionalClaim"] &&
                            Convert.ToInt32(contractDataSet.Tables[0].Rows[0]["IsInstitutionalClaim"]) ==
                            1,
                        NodeId =
                            DBNull.Value == contractDataSet.Tables[0].Rows[0]["NodeId"]
                                ? (long?)null
                                : Convert.ToInt64(
                                contractDataSet.Tables[0].Rows[0]["NodeId"]),
                        IsModified =
                            DBNull.Value ==
                            contractDataSet.Tables[0].Rows[0]["IsModified"]
                                ? (int?)null
                                : Convert.ToInt32(
                                contractDataSet.Tables[0].Rows[0]["IsModified"]),
                        ThresholdDaysToExpireAlters =
                            DBNull.Value ==
                            contractDataSet.Tables[0].Rows[0]["ThresholdDaysToExpireAlters"]
                                ? (int?)null
                                : Convert.ToInt32(
                                contractDataSet.Tables[0].Rows[0]["ThresholdDaysToExpireAlters"]),
                        PayerCode = Convert.ToString(
                            contractDataSet.Tables[0].Rows[0]["PayerCode"]),
                        CustomField = DBNull.Value ==
                                      contractDataSet.Tables[0].Rows[0]["CustomField"]
                                    ? (int?)null
                                    : Convert.ToInt32(
                            contractDataSet.Tables[0].Rows[0]["CustomField"]),
                    };
                }

                //Populating ContractPayer's data
                if (contractDataSet.Tables[1].Rows != null && contractDataSet.Tables[1] != null && contractDataSet.Tables[1].Rows.Count > 0)
                {
                    if (contractInfo.ContractId == 0)
                    {
                        contractFullInfo.ContractBasicInfo = new Contract();
                    }
                    contractFullInfo.ContractBasicInfo.Payers = new List <Payer>();
                    for (int i = 0; i < contractDataSet.Tables[1].Rows.Count; i++)
                    {
                        Payer payer = new Payer
                        {
                            PayerName  = Convert.ToString(contractDataSet.Tables[1].Rows[i]["PayerName"]),
                            IsSelected = Convert.ToBoolean(contractDataSet.Tables[1].Rows[i]["IsSelected"]),
                        };
                        contractFullInfo.ContractBasicInfo.Payers.Add(payer);
                    }
                }

                //populating Contract payer Info ID's data
                contractFullInfo.ContractContactIds = new List <Int64>();
                if (contractDataSet.Tables[2].Rows != null && contractDataSet.Tables[2] != null && contractDataSet.Tables[2].Rows.Count > 0)
                {
                    for (int i = 0; i < contractDataSet.Tables[2].Rows.Count; i++)
                    {
                        Int64 contractPayerInfoId = Convert.ToInt64(contractDataSet.Tables[2].Rows[i]["ContractPayerInfoId"]);
                        contractFullInfo.ContractContactIds.Add(contractPayerInfoId);
                    }
                }

                //populating ContractNotes data
                if (contractDataSet.Tables[3].Rows != null && contractDataSet.Tables[3] != null && contractDataSet.Tables[3].Rows.Count > 0)
                {
                    contractFullInfo.ContractNotes = new List <ContractNote>();
                    for (int i = 0; i < contractDataSet.Tables[3].Rows.Count; i++)
                    {
                        string currentDateTime = Utilities.GetLocalTimeString(contractInfo.CurrentDateTime,
                                                                              Convert.ToDateTime((contractDataSet.Tables[3].Rows[i]["InsertDate"].ToString())));
                        ContractNote contractNote = new ContractNote
                        {
                            ContractNoteId =
                                Convert.ToInt64(
                                    contractDataSet.Tables[3].Rows[i]["ContractNoteID"]),
                            ContractId =
                                DBNull.Value == contractDataSet.Tables[3].Rows[i]["ContractID"]
                                    ? (long?)null
                                    : Convert.ToInt64(
                                    contractDataSet.Tables[3].Rows[i]["ContractID"]),
                            InsertDate =
                                DBNull.Value == contractDataSet.Tables[3].Rows[i]["InsertDate"]
                                    ? (DateTime?)null
                                    : Convert.ToDateTime(
                                    contractDataSet.Tables[3].Rows[i]["InsertDate"]),
                            ShortDateTime = DBNull.Value == contractDataSet.Tables[3].Rows[i]["InsertDate"]
                                    ? string.Empty
                                    : Convert.ToDateTime(
                                currentDateTime).ToString("MM/dd/yyyy hh:mm:ss"),
                            UpdateDate =
                                DBNull.Value == contractDataSet.Tables[3].Rows[i]["UpdateDate"]
                                    ? (DateTime?)null
                                    : Convert.ToDateTime(
                                    contractDataSet.Tables[3].Rows[i]["UpdateDate"]),
                            NoteText =
                                Convert.ToString(contractDataSet.Tables[3].Rows[i]["NoteText"]),
                            UserName = DBNull.Value == contractDataSet.Tables[3].Rows[i]["UserName"] ? string.Empty : Convert.ToString(contractDataSet.Tables[3].Rows[i]["UserName"])
                        };
                        contractFullInfo.ContractNotes.Add(contractNote);
                    }
                }

                //populating ContractDocs data
                if (contractDataSet.Tables[4].Rows != null && contractDataSet.Tables[4] != null && contractDataSet.Tables[4].Rows.Count > 0)
                {
                    contractFullInfo.ContractDocs = new List <ContractDoc>();
                    for (int i = 0; i < contractDataSet.Tables[4].Rows.Count; i++)
                    {
                        ContractDoc contractDocs = new ContractDoc
                        {
                            ContractDocId =
                                Convert.ToInt64(
                                    contractDataSet.Tables[4].Rows[i]["ContractDocID"]),
                            InsertDate =
                                DBNull.Value == contractDataSet.Tables[4].Rows[i]["InsertDate"]
                                    ? (DateTime?)null
                                    : Convert.ToDateTime(
                                    contractDataSet.Tables[4].Rows[i]["InsertDate"]),
                            UpdateDate =
                                DBNull.Value == contractDataSet.Tables[4].Rows[i]["UpdateDate"]
                                    ? (DateTime?)null
                                    : Convert.ToDateTime(
                                    contractDataSet.Tables[4].Rows[i]["UpdateDate"]),
                            ContractId =
                                DBNull.Value == contractDataSet.Tables[4].Rows[i]["ContractID"]
                                    ? (long?)null
                                    : Convert.ToInt64(
                                    contractDataSet.Tables[4].Rows[i]["ContractID"]),
                            ContractContent =
                                DBNull.Value ==
                                contractDataSet.Tables[4].Rows[i]["ContractContent"]
                                    ? null
                                    : (byte[])contractDataSet.Tables[4].Rows[i]["ContractContent"],
                            FileName =
                                Convert.ToString(contractDataSet.Tables[4].Rows[i]["FileName"])
                        };

                        contractFullInfo.ContractDocs.Add(contractDocs);
                    }
                }
            }
            //returns response to Business layer
            return(contractFullInfo);
        }
Exemple #15
0
 public ContractNote AddEditContractNote(ContractNote contractNotes)
 {
     return(_contractLogic.AddEditContractNote(contractNotes));
 }
Exemple #16
0
 public bool DeleteContractNoteById(ContractNote contractNotes)
 {
     return(_contractLogic.DeleteContractNote(contractNotes));
 }
 /// <summary>
 /// Deletes the contract note by unique identifier.
 /// </summary>
 /// <param name="contractNotes">The contract note unique identifier.</param>
 /// <returns></returns>
 public bool DeleteContractNote(ContractNote contractNotes)
 {
     return(_contractNotesRepository.DeleteContractNote(contractNotes));
 }
 /// <summary>
 /// Adds the edit contract note.
 /// </summary>
 /// <param name="contractNotes">The contract notes.</param>
 /// <returns></returns>
 public ContractNote AddEditContractNote(ContractNote contractNotes)
 {
     return(_contractNotesRepository.AddEditContractNote(contractNotes));
 }