Beispiel #1
0
        public static Boolean InsertUpdateLK_SDAT(clsLK_SDAT objLK_SDAT)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateLK_SDAT";

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

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

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

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