예제 #1
0
        public static Boolean InsertUpdateRequirementMaster(clsRequirementMaster objRequirementMaster)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateRequirementMaster";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objRequirementMaster, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
예제 #2
0
        public static clsRequirementMaster SelectRequirementMasterById(int?ACRDReqID)
        {
            clsRequirementMaster objRequirementMaster = new clsRequirementMaster();
            bool   isnull = true;
            string SpName = "usp_SelectRequirementMaster";
            var    objPar = new DynamicParameters();

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

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

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