Example #1
0
        public static Boolean InsertUpdateContractor_EmpList(clsContractor_EmpList objContractor_EmpList)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateContractor_EmpList";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objContractor_EmpList, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Example #2
0
        public static clsContractor_EmpList SelectContractor_EmpListById(int?ContractorUserListId)
        {
            clsContractor_EmpList objContractor_EmpList = new clsContractor_EmpList();
            bool   isnull = true;
            string SpName = "usp_SelectContractor_EmpList";
            var    objPar = new DynamicParameters();

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

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

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