Ejemplo n.º 1
0
        public static Boolean InsertUpdateEvidence_Contractor_Approval(clsEvidence_Contractor_Approval objEvidence_Contractor_Approval)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateEvidence_Contractor_Approval";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objEvidence_Contractor_Approval, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Ejemplo n.º 2
0
        public static clsEvidence_Contractor_Approval SelectEvidence_Contractor_ApprovalById(int?ContractorEvidenceId)
        {
            clsEvidence_Contractor_Approval objEvidence_Contractor_Approval = new clsEvidence_Contractor_Approval();
            bool   isnull = true;
            string SpName = "usp_SelectEvidence_Contractor_Approval";
            var    objPar = new DynamicParameters();

            if (String.IsNullOrEmpty(ContractorEvidenceId.ToString()))
            {
                throw new ArgumentException("Function parameters cannot be blank!");
            }
            else
            {
                try
                {
                    objPar.Add("@ContractorEvidenceId", ContractorEvidenceId, dbType: DbType.Int32);

                    using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                    {
                        objEvidence_Contractor_Approval = db.Query <clsEvidence_Contractor_Approval>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault();
                        isnull = false;
                    }
                }
                catch (Exception ex)
                {
                    ErrorHandler.ErrorLogging(ex, false);
                    ErrorHandler.ReadError();
                }
            }

            if (isnull)
            {
                return(null);
            }
            else
            {
                return(objEvidence_Contractor_Approval);
            }
        }