コード例 #1
0
        public static DocsSecondLevel getImage(int profileId, int imageId, string connectionName)
        {
            try
            {
                DocsSecondLevel docsReturn = new DocsSecondLevel();
                Database        db         = DatabaseFactory.CreateDatabase(connectionName);
                DbCommand       dbCommand  = db.GetStoredProcCommand("GetDocsSecondLevel");
                dbCommand.CommandTimeout = 60;
                db.AddInParameter(dbCommand, "ProfileId ", DbType.Int32, profileId);
                db.AddInParameter(dbCommand, "imageId ", DbType.Int32, imageId);
                IDataReader result = db.ExecuteReader(dbCommand);
                while (result.Read())
                {
                    docsReturn.ProfileId    = int.Parse(result["ProfileId"].ToString());
                    docsReturn.Name         = result["Name"].ToString();
                    docsReturn.Image        = (byte[])result["Image"];
                    docsReturn.ImageId      = int.Parse(result["imageId"].ToString());
                    docsReturn.NameDocument = result["DocName"].ToString();
                    docsReturn.InsertDate   = result["InsertDate"] is DBNull?DateTime.Parse("01/01/1900") : DateTime.Parse(result["InsertDate"].ToString());

                    docsReturn.UpdateDate = result["UpdateDate"] is DBNull?DateTime.Parse("01/01/1900") : DateTime.Parse(result["UpdateDate"].ToString());

                    docsReturn.DeleteDate = result["DeleteDate"] is DBNull?DateTime.Parse("01/01/1900") : DateTime.Parse(result["DeleteDate"].ToString());

                    docsReturn.Enable = bool.Parse(result["Enable"].ToString());
                }
                return(docsReturn);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
コード例 #2
0
 public static bool AddImage(DocsSecondLevel docsEntities)
 {
     try
     {
         return(DocsSecondLevelDA.AddImage(docsEntities, CommonENT.MYCTSDBPROFILES_CONNECTION));
     }
     catch (Exception err) { return(false); }
 }
コード例 #3
0
        public static DocsSecondLevel getImageById(int imageId)
        {
            DocsSecondLevel docs = new DocsSecondLevel();

            try
            {
                docs = DocsSecondLevelDA.getImageById(imageId, CommonENT.MYCTSDBPROFILES_CONNECTION);
                return(docs);
            }
            catch { return(docs); }
        }
コード例 #4
0
        public static bool UpdateImage(DocsSecondLevel docsEntities)
        {
            bool success = false;

            try
            {
                DocsSecondLevelDA.UpdateImage(docsEntities, CommonENT.MYCTSDBPROFILES_CONNECTION);
                success = true;
                return(success);
            }
            catch { return(success); }
        }
コード例 #5
0
        public static bool DeleteImage(DocsSecondLevel docsEntities, string connectionName)
        {
            bool success = false;

            try
            {
                Database  db        = DatabaseFactory.CreateDatabase(connectionName);
                DbCommand dbCommand = db.GetStoredProcCommand("DeleteDocsSecondLevel");
                dbCommand.CommandTimeout = 60;
                db.AddInParameter(dbCommand, "ProfileId ", DbType.Int32, docsEntities.ProfileId);
                db.AddInParameter(dbCommand, "imageId ", DbType.Int32, docsEntities.ImageId);
                db.AddInParameter(dbCommand, "DeleteDate ", DbType.DateTime, docsEntities.DeleteDate);
                success = db.ExecuteNonQuery(dbCommand) > 0 ? true : false;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(success);
        }
コード例 #6
0
        public static bool AddImage(DocsSecondLevel docsEntities, string connectionName)
        {
            bool success = false;

            try
            {
                Database  db        = DatabaseFactory.CreateDatabase(connectionName);
                DbCommand dbCommand = db.GetStoredProcCommand("SetDocsSecondLevel");
                dbCommand.CommandTimeout = 60;
                db.AddInParameter(dbCommand, "ProfileId ", DbType.Int32, docsEntities.ProfileId);
                db.AddInParameter(dbCommand, "Name ", DbType.String, docsEntities.Name);
                db.AddInParameter(dbCommand, "Image ", DbType.Binary, docsEntities.Image);
                db.AddInParameter(dbCommand, "Enable ", DbType.Boolean, docsEntities.Enable);
                db.AddInParameter(dbCommand, "DocName", DbType.String, docsEntities.NameDocument);
                success = db.ExecuteNonQuery(dbCommand) > 0 ? true : false;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(success);
        }