示例#1
0
        public bool InsertContCardPIC(ContCardPic contCardPic)
        {
            bool result = false;

            try
            {
                using (NpgsqlConnection npgsqlConnection = AppConfig.GetConnection())
                {
                    if (npgsqlConnection.State == ConnectionState.Closed)
                    {
                        npgsqlConnection.Open();
                    }
                    contCardPic.ContCardPicID = CtsCounter.NextValCtsCounter("CONTCARDPIC_CONTCARDPICID_SEQ");
                    contCardPic.PicDtm        = DateTime.Now;
                    string query = "INSERT INTO contcardpic(contcardpicid,contcardid,picdtm,picname,picdata) VALUES(@contcardpicid,@contcardid,@picdtm,@picname,@picdata) ";
                    using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(query, npgsqlConnection))
                    {
                        npgsqlCommand.Parameters.AddWithValue("@contcardpicid", contCardPic.ContCardPicID);
                        npgsqlCommand.Parameters.AddWithValue("@contcardid", contCardPic.ContCardID);
                        npgsqlCommand.Parameters.AddWithValue("@picdtm", contCardPic.PicDtm);
                        npgsqlCommand.Parameters.AddWithValue("@picname", contCardPic.PicName);
                        npgsqlCommand.Parameters.AddWithValue("@picdata", contCardPic.PicData);
                        npgsqlCommand.ExecuteNonQuery();
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
示例#2
0
        public bool InsertSecureGateLog(SecureGateLog secureGateLog)
        {
            bool result = false;

            try
            {
                using (NpgsqlConnection npgsqlConnection = AppConfig.GetConnection())
                {
                    if (npgsqlConnection.State == ConnectionState.Closed)
                    {
                        npgsqlConnection.Open();
                    }
                    string query = "INSERT INTO securegatelog(securegatelogid,dtm1,loc1,logcat,logremark,refid) VALUES(@SecureGateLogID,@Dtm1,@Loc1,@LogCat,@LogRemark,@RefID)";
                    secureGateLog.SecureGateLogID = CtsCounter.NextValCtsCounter("SecureGateLog_SecureGateLogID_SEQ");
                    secureGateLog.Dtm1            = DateTime.Now;
                    using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(query, npgsqlConnection))
                    {
                        npgsqlCommand.Parameters.AddWithValue("@SecureGateLogID", secureGateLog.SecureGateLogID);

                        npgsqlCommand.Parameters.AddWithValue("@Dtm1", secureGateLog.Dtm1);
                        npgsqlCommand.Parameters.AddWithValue("@Loc1", secureGateLog.Loc1);
                        npgsqlCommand.Parameters.AddWithValue("@LogCat", secureGateLog.LogCat);
                        npgsqlCommand.Parameters.AddWithValue("@LogRemark", secureGateLog.LogRemark);
                        npgsqlCommand.Parameters.AddWithValue("@RefID", secureGateLog.RefID);


                        npgsqlCommand.ExecuteNonQuery();
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }